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
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ 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.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 2562, 2699 ] }
6,107
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ 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) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 3224, 3574 ] }
6,108
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ 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.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 4026, 4161 ] }
6,109
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 4675, 4846 ] }
6,110
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 607, 1231 ] }
6,111
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
toPayable
function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); }
/** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 1443, 1575 ] }
6,112
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 2547, 2923 ] }
6,113
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
SafeERC20
library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */
NatSpecMultiLine
callOptionalReturn
function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
/** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */
NatSpecMultiLine
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 2127, 3246 ] }
6,114
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
StrategyCurveLINKVoterProxy
contract StrategyCurveLINKVoterProxy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant want = address(0xcee60cFa923170e4f8204AE08B4fA6A3F5656F3a); address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant curve = address(0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0); address public constant gauge = address(0xFD4D8a17df4C27c1dD245d153ccf4499e806C87D); address public constant voter = address(0xF147b8125d2ef93FB6965Db97D6746952a133934); address public constant uniswap = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public constant sushiswap = address(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // used for crv <> weth route address public constant link = address(0x514910771AF9Ca656af840dff83E8264EcF986CA); uint256 public keepCRV = 1000; uint256 public treasuryFee = 1000; uint256 public strategistReward = 1000; uint256 public withdrawalFee = 50; uint256 public constant FEE_DENOMINATOR = 10000; address public proxy; address public dex; address public governance; address public controller; address public strategist; address public keeper; uint256 public earned; // lifetime strategy earnings denominated in `want` token event Harvested(uint256 wantEarned, uint256 lifetimeEarned); constructor(address _controller) public { governance = msg.sender; strategist = msg.sender; keeper = msg.sender; controller = _controller; // standardize constructor proxy = address(0x9a165622a744C20E3B2CB443AeD98110a33a231b); dex = sushiswap; } function getName() external pure returns (string memory) { return "StrategyCurveLINKVoterProxy"; } function setStrategist(address _strategist) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); strategist = _strategist; } function setKeeper(address _keeper) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); keeper = _keeper; } function setKeepCRV(uint256 _keepCRV) external { require(msg.sender == governance, "!governance"); keepCRV = _keepCRV; } function setWithdrawalFee(uint256 _withdrawalFee) external { require(msg.sender == governance, "!governance"); withdrawalFee = _withdrawalFee; } function setTreasuryFee(uint256 _treasuryFee) external { require(msg.sender == governance, "!governance"); treasuryFee = _treasuryFee; } function setStrategistReward(uint256 _strategistReward) external { require(msg.sender == governance, "!governance"); strategistReward = _strategistReward; } function setProxy(address _proxy) external { require(msg.sender == governance, "!governance"); proxy = _proxy; } function switchDex(bool isUniswap) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); if (isUniswap) { dex = uniswap; } else { dex = sushiswap; } } function deposit() public { uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { IERC20(want).safeTransfer(proxy, _want); VoterProxy(proxy).deposit(gauge, want); } } // Controller only function for creating additional rewards from dust function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); require(want != address(_asset), "want"); require(crv != address(_asset), "crv"); require(link != address(_asset), "link"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } // Withdraw partial funds, normally used with a vault withdrawal function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } uint256 _fee = _amount.mul(withdrawalFee).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); } function _withdrawSome(uint256 _amount) internal returns (uint256) { return VoterProxy(proxy).withdraw(gauge, want, _amount); } // Withdraw all funds, normally used when migrating strategies function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, balance); } function _withdrawAll() internal { VoterProxy(proxy).withdrawAll(gauge, want); } function harvest() public { require(msg.sender == keeper || msg.sender == strategist || msg.sender == governance, "!keepers"); VoterProxy(proxy).harvest(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { uint256 _keepCRV = _crv.mul(keepCRV).div(FEE_DENOMINATOR); IERC20(crv).safeTransfer(voter, _keepCRV); _crv = _crv.sub(_keepCRV); IERC20(crv).safeApprove(dex, 0); IERC20(crv).safeApprove(dex, _crv); address[] memory path = new address[](3); path[0] = crv; path[1] = weth; path[2] = link; Uni(dex).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now.add(1800)); } uint256 _link = IERC20(link).balanceOf(address(this)); if (_link > 0) { IERC20(link).safeApprove(curve, 0); IERC20(link).safeApprove(curve, _link); ICurveFi(curve).add_liquidity([_link, 0], 0); } uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { uint256 _fee = _want.mul(treasuryFee).div(FEE_DENOMINATOR); uint256 _reward = _want.mul(strategistReward).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); IERC20(want).safeTransfer(strategist, _reward); deposit(); } VoterProxy(proxy).lock(); earned = earned.add(_want); emit Harvested(_want, earned); } function balanceOfWant() public view returns (uint256) { return IERC20(want).balanceOf(address(this)); } function balanceOfPool() public view returns (uint256) { return VoterProxy(proxy).balanceOf(gauge); } function balanceOf() public view returns (uint256) { return balanceOfWant().add(balanceOfPool()); } function setGovernance(address _governance) external { require(msg.sender == governance, "!governance"); governance = _governance; } function setController(address _controller) external { require(msg.sender == governance, "!governance"); controller = _controller; } function() external payable {} }
withdraw
function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); require(want != address(_asset), "want"); require(crv != address(_asset), "crv"); require(link != address(_asset), "link"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); }
// Controller only function for creating additional rewards from dust
LineComment
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 3757, 4151 ] }
6,115
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
StrategyCurveLINKVoterProxy
contract StrategyCurveLINKVoterProxy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant want = address(0xcee60cFa923170e4f8204AE08B4fA6A3F5656F3a); address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant curve = address(0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0); address public constant gauge = address(0xFD4D8a17df4C27c1dD245d153ccf4499e806C87D); address public constant voter = address(0xF147b8125d2ef93FB6965Db97D6746952a133934); address public constant uniswap = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public constant sushiswap = address(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // used for crv <> weth route address public constant link = address(0x514910771AF9Ca656af840dff83E8264EcF986CA); uint256 public keepCRV = 1000; uint256 public treasuryFee = 1000; uint256 public strategistReward = 1000; uint256 public withdrawalFee = 50; uint256 public constant FEE_DENOMINATOR = 10000; address public proxy; address public dex; address public governance; address public controller; address public strategist; address public keeper; uint256 public earned; // lifetime strategy earnings denominated in `want` token event Harvested(uint256 wantEarned, uint256 lifetimeEarned); constructor(address _controller) public { governance = msg.sender; strategist = msg.sender; keeper = msg.sender; controller = _controller; // standardize constructor proxy = address(0x9a165622a744C20E3B2CB443AeD98110a33a231b); dex = sushiswap; } function getName() external pure returns (string memory) { return "StrategyCurveLINKVoterProxy"; } function setStrategist(address _strategist) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); strategist = _strategist; } function setKeeper(address _keeper) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); keeper = _keeper; } function setKeepCRV(uint256 _keepCRV) external { require(msg.sender == governance, "!governance"); keepCRV = _keepCRV; } function setWithdrawalFee(uint256 _withdrawalFee) external { require(msg.sender == governance, "!governance"); withdrawalFee = _withdrawalFee; } function setTreasuryFee(uint256 _treasuryFee) external { require(msg.sender == governance, "!governance"); treasuryFee = _treasuryFee; } function setStrategistReward(uint256 _strategistReward) external { require(msg.sender == governance, "!governance"); strategistReward = _strategistReward; } function setProxy(address _proxy) external { require(msg.sender == governance, "!governance"); proxy = _proxy; } function switchDex(bool isUniswap) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); if (isUniswap) { dex = uniswap; } else { dex = sushiswap; } } function deposit() public { uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { IERC20(want).safeTransfer(proxy, _want); VoterProxy(proxy).deposit(gauge, want); } } // Controller only function for creating additional rewards from dust function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); require(want != address(_asset), "want"); require(crv != address(_asset), "crv"); require(link != address(_asset), "link"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } // Withdraw partial funds, normally used with a vault withdrawal function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } uint256 _fee = _amount.mul(withdrawalFee).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); } function _withdrawSome(uint256 _amount) internal returns (uint256) { return VoterProxy(proxy).withdraw(gauge, want, _amount); } // Withdraw all funds, normally used when migrating strategies function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, balance); } function _withdrawAll() internal { VoterProxy(proxy).withdrawAll(gauge, want); } function harvest() public { require(msg.sender == keeper || msg.sender == strategist || msg.sender == governance, "!keepers"); VoterProxy(proxy).harvest(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { uint256 _keepCRV = _crv.mul(keepCRV).div(FEE_DENOMINATOR); IERC20(crv).safeTransfer(voter, _keepCRV); _crv = _crv.sub(_keepCRV); IERC20(crv).safeApprove(dex, 0); IERC20(crv).safeApprove(dex, _crv); address[] memory path = new address[](3); path[0] = crv; path[1] = weth; path[2] = link; Uni(dex).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now.add(1800)); } uint256 _link = IERC20(link).balanceOf(address(this)); if (_link > 0) { IERC20(link).safeApprove(curve, 0); IERC20(link).safeApprove(curve, _link); ICurveFi(curve).add_liquidity([_link, 0], 0); } uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { uint256 _fee = _want.mul(treasuryFee).div(FEE_DENOMINATOR); uint256 _reward = _want.mul(strategistReward).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); IERC20(want).safeTransfer(strategist, _reward); deposit(); } VoterProxy(proxy).lock(); earned = earned.add(_want); emit Harvested(_want, earned); } function balanceOfWant() public view returns (uint256) { return IERC20(want).balanceOf(address(this)); } function balanceOfPool() public view returns (uint256) { return VoterProxy(proxy).balanceOf(gauge); } function balanceOf() public view returns (uint256) { return balanceOfWant().add(balanceOfPool()); } function setGovernance(address _governance) external { require(msg.sender == governance, "!governance"); governance = _governance; } function setController(address _controller) external { require(msg.sender == governance, "!governance"); controller = _controller; } function() external payable {} }
withdraw
function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } uint256 _fee = _amount.mul(withdrawalFee).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); }
// Withdraw partial funds, normally used with a vault withdrawal
LineComment
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 4224, 4952 ] }
6,116
StrategyCurveLINKVoterProxy
StrategyCurveLINKVoterProxy.sol
0x153fe8894a76f14bc8c8b02dd81efbb6d24e909f
Solidity
StrategyCurveLINKVoterProxy
contract StrategyCurveLINKVoterProxy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant want = address(0xcee60cFa923170e4f8204AE08B4fA6A3F5656F3a); address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant curve = address(0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0); address public constant gauge = address(0xFD4D8a17df4C27c1dD245d153ccf4499e806C87D); address public constant voter = address(0xF147b8125d2ef93FB6965Db97D6746952a133934); address public constant uniswap = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public constant sushiswap = address(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // used for crv <> weth route address public constant link = address(0x514910771AF9Ca656af840dff83E8264EcF986CA); uint256 public keepCRV = 1000; uint256 public treasuryFee = 1000; uint256 public strategistReward = 1000; uint256 public withdrawalFee = 50; uint256 public constant FEE_DENOMINATOR = 10000; address public proxy; address public dex; address public governance; address public controller; address public strategist; address public keeper; uint256 public earned; // lifetime strategy earnings denominated in `want` token event Harvested(uint256 wantEarned, uint256 lifetimeEarned); constructor(address _controller) public { governance = msg.sender; strategist = msg.sender; keeper = msg.sender; controller = _controller; // standardize constructor proxy = address(0x9a165622a744C20E3B2CB443AeD98110a33a231b); dex = sushiswap; } function getName() external pure returns (string memory) { return "StrategyCurveLINKVoterProxy"; } function setStrategist(address _strategist) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); strategist = _strategist; } function setKeeper(address _keeper) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); keeper = _keeper; } function setKeepCRV(uint256 _keepCRV) external { require(msg.sender == governance, "!governance"); keepCRV = _keepCRV; } function setWithdrawalFee(uint256 _withdrawalFee) external { require(msg.sender == governance, "!governance"); withdrawalFee = _withdrawalFee; } function setTreasuryFee(uint256 _treasuryFee) external { require(msg.sender == governance, "!governance"); treasuryFee = _treasuryFee; } function setStrategistReward(uint256 _strategistReward) external { require(msg.sender == governance, "!governance"); strategistReward = _strategistReward; } function setProxy(address _proxy) external { require(msg.sender == governance, "!governance"); proxy = _proxy; } function switchDex(bool isUniswap) external { require(msg.sender == strategist || msg.sender == governance, "!authorized"); if (isUniswap) { dex = uniswap; } else { dex = sushiswap; } } function deposit() public { uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { IERC20(want).safeTransfer(proxy, _want); VoterProxy(proxy).deposit(gauge, want); } } // Controller only function for creating additional rewards from dust function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); require(want != address(_asset), "want"); require(crv != address(_asset), "crv"); require(link != address(_asset), "link"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } // Withdraw partial funds, normally used with a vault withdrawal function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } uint256 _fee = _amount.mul(withdrawalFee).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); } function _withdrawSome(uint256 _amount) internal returns (uint256) { return VoterProxy(proxy).withdraw(gauge, want, _amount); } // Withdraw all funds, normally used when migrating strategies function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, balance); } function _withdrawAll() internal { VoterProxy(proxy).withdrawAll(gauge, want); } function harvest() public { require(msg.sender == keeper || msg.sender == strategist || msg.sender == governance, "!keepers"); VoterProxy(proxy).harvest(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { uint256 _keepCRV = _crv.mul(keepCRV).div(FEE_DENOMINATOR); IERC20(crv).safeTransfer(voter, _keepCRV); _crv = _crv.sub(_keepCRV); IERC20(crv).safeApprove(dex, 0); IERC20(crv).safeApprove(dex, _crv); address[] memory path = new address[](3); path[0] = crv; path[1] = weth; path[2] = link; Uni(dex).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now.add(1800)); } uint256 _link = IERC20(link).balanceOf(address(this)); if (_link > 0) { IERC20(link).safeApprove(curve, 0); IERC20(link).safeApprove(curve, _link); ICurveFi(curve).add_liquidity([_link, 0], 0); } uint256 _want = IERC20(want).balanceOf(address(this)); if (_want > 0) { uint256 _fee = _want.mul(treasuryFee).div(FEE_DENOMINATOR); uint256 _reward = _want.mul(strategistReward).div(FEE_DENOMINATOR); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); IERC20(want).safeTransfer(strategist, _reward); deposit(); } VoterProxy(proxy).lock(); earned = earned.add(_want); emit Harvested(_want, earned); } function balanceOfWant() public view returns (uint256) { return IERC20(want).balanceOf(address(this)); } function balanceOfPool() public view returns (uint256) { return VoterProxy(proxy).balanceOf(gauge); } function balanceOf() public view returns (uint256) { return balanceOfWant().add(balanceOfPool()); } function setGovernance(address _governance) external { require(msg.sender == governance, "!governance"); governance = _governance; } function setController(address _controller) external { require(msg.sender == governance, "!governance"); controller = _controller; } function() external payable {} }
withdrawAll
function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); _withdrawAll(); balance = IERC20(want).balanceOf(address(this)); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, balance); }
// Withdraw all funds, normally used when migrating strategies
LineComment
v0.5.17+commit.d19bba13
Unknown
bzzr://daf0a5f408826bee6b9553d7574de4a6d1cb04c31aa2a20140dd8677e59a2f31
{ "func_code_index": [ 5172, 5617 ] }
6,117
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
totalSupply
function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } }
/// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 1039, 1221 ] }
6,118
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
tokenOfOwnerByIndex
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); }
/// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 1419, 1958 ] }
6,119
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
tokenByIndex
function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; }
/// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 1984, 2133 ] }
6,120
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
balanceOf
function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } }
/// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 2578, 2986 ] }
6,121
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
ownerOf
function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } }
/// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3128, 3373 ] }
6,122
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
_mint
function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } }
/// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3646, 4223 ] }
6,123
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
_exists
function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; }
/// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 4249, 4370 ] }
6,124
Mingoes
contracts/src/ERC721/ERC721M.sol
0xe6f475c11ad693e48455fcaf7bca33fe84ce71b0
Solidity
ERC721M
abstract contract ERC721M is ERC721 { /* -------------------------------------------------------------------------- */ /* ERC721M STORAGE */ /* -------------------------------------------------------------------------- */ /// @dev The index is the token ID counter and points to its owner. address[] internal _owners; /* -------------------------------------------------------------------------- */ /* CONSTRUCTOR */ /* -------------------------------------------------------------------------- */ constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) { // Initializes the index to 1. _owners.push(); } /* -------------------------------------------------------------------------- */ /* ENUMERABLE LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function totalSupply() public view override returns (uint256) { // Overflow is impossible as _owners.length is initialized to 1. unchecked { return _owners.length - 1; } } /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < balanceOf(owner), "INVALID_INDEX"); // Both of the counters cannot overflow because the loop breaks before that. unchecked { uint256 count; uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < _currentIndex; i++) { if (owner == ownerOf(i)) { if (count == index) return i; else count++; } } } revert("NOT_FOUND"); } /// @inheritdoc ERC721 function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(_exists(index), "INVALID_INDEX"); return index; } /* -------------------------------------------------------------------------- */ /* ERC721 LOGIC */ /* -------------------------------------------------------------------------- */ /// @dev O(totalSupply), it is discouraged to call this function from other contracts /// as it can become very expensive, especially with higher total collection sizes. /// @inheritdoc ERC721 function balanceOf(address owner) public view virtual override returns (uint256 balance) { require(owner != address(0), "INVALID_OWNER"); unchecked { // Start at 1 since token 0 does not exist uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i = 1; i < _currentIndex; i++) { if (owner == ownerOf(i)) { balance++; } } } } /// @dev O(MAX_TX), gradually moves to O(1) as more tokens get transferred and /// the owners are explicitly set. /// @inheritdoc ERC721 function ownerOf(uint256 id) public view virtual override returns (address owner) { require(_exists(id), "NONEXISTENT_TOKEN"); for (uint256 i = id; ; i++) { owner = _owners[i]; if (owner != address(0)) { return owner; } } } /* -------------------------------------------------------------------------- */ /* INTERNAL LOGIC */ /* -------------------------------------------------------------------------- */ /// @inheritdoc ERC721 function _mint(address to, uint256 amount) internal virtual override { require(to != address(0), "INVALID_RECIPIENT"); require(amount != 0, "INVALID_AMOUNT"); unchecked { uint256 _currentIndex = _owners.length; // == totalSupply() + 1 == _owners.length - 1 + 1 for (uint256 i; i < amount - 1; i++) { // storing address(0) while also incrementing the index _owners.push(); emit Transfer(address(0), to, _currentIndex + i); } // storing the actual owner _owners.push(to); emit Transfer(address(0), to, _currentIndex + (amount - 1)); } } /// @inheritdoc ERC721 function _exists(uint256 id) internal view virtual override returns (bool) { return id != 0 && id < _owners.length; } /// @inheritdoc ERC721 function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); } }
_transfer
function _transfer( address from, address to, uint256 id ) internal virtual override { require(ownerOf(id) == from, "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require(msg.sender == from || getApproved(id) == msg.sender || isApprovedForAll(from, msg.sender), "NOT_AUTHORIZED"); delete _tokenApprovals[id]; _owners[id] = to; unchecked { uint256 prevId = id - 1; if (_owners[prevId] == address(0)) { _owners[prevId] = from; } } emit Transfer(from, to, id); }
/// @inheritdoc ERC721
NatSpecSingleLine
v0.8.11+commit.d7f03943
{ "func_code_index": [ 4396, 4913 ] }
6,125
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
CryptoLiveLeak
function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes }
/** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 844, 1393 ] }
6,126
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
/** * Internal transfer, only can be called by this contract */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 1477, 2319 ] }
6,127
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); }
/** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 2525, 2637 ] }
6,128
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 2912, 3213 ] }
6,129
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 3477, 3653 ] }
6,130
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 4047, 4399 ] }
6,131
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
burn
function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; }
/** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 4569, 4943 ] }
6,132
CryptoLiveLeak
CryptoLiveLeak.sol
0x3dc9a42fa7afe57be03c58fd7f4411b1e466c508
Solidity
CryptoLiveLeak
contract CryptoLiveLeak { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function CryptoLiveLeak( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
burnFrom
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; }
/** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.20-nightly.2018.1.29+commit.a668b9de
bzzr://ef4c25d09c0a1e32b2086741c6a65c050647c694a483ca7bdd869cd30f23175a
{ "func_code_index": [ 5201, 5812 ] }
6,133
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; }
// ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 1003, 1124 ] }
6,134
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 1344, 1473 ] }
6,135
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 1817, 2099 ] }
6,136
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 2607, 2820 ] }
6,137
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 3351, 3714 ] }
6,138
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 3997, 4153 ] }
6,139
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approveAndCall
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 4508, 4830 ] }
6,140
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
function () public payable { revert(); }
// ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 5022, 5081 ] }
6,141
EtherDigitalFinance
EtherDigitalFinance.sol
0xed72fbfaf9c6b24d1d77bb69be3371c2593d0a3e
Solidity
EtherDigitalFinance
contract EtherDigitalFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "EDF"; name = "Ether Digital Finance"; decimals = 18; _totalSupply = 200000000000000000000000000; balances[0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2] = _totalSupply; emit Transfer(address(0), 0x9b95661a5d1083DB9C8763f7FF77c99Ee10Ef0D2, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); }
// ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
None
bzzr://b0cfa19ecffa2fba524b64130f022ed2182f98cbc15164730363b8f97cf9fbe6
{ "func_code_index": [ 5314, 5503 ] }
6,142
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
setDiscountPercentage
function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; }
/** * @dev If users use CVR, they will pay _discountPercentage % of cost. */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 2079, 2286 ] }
6,143
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
_getNeededTokenAmount
function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; }
/** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 2441, 3289 ] }
6,144
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
getNeededTokenAmount
function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); }
/** * @dev Get needed _token0 amount for _desiredAmount of _token1 */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 3379, 3628 ] }
6,145
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
getTokenAmountForUSDC
function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); }
/** * get needed _token amount for _desiredAmount of USDC */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 3894, 4096 ] }
6,146
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
getTokenAmountForETH
function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); }
/** * get needed _token amount for _desiredAmount of ETH */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 4176, 4369 ] }
6,147
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
swapTokenWithETH
function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); }
/** * @param _amount: this one is the value with decimals */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 4450, 4909 ] }
6,148
ExchangeAgent
ExchangeAgent.sol
0x5365fd7770c795e82869c57b5b254ccaae91d07a
Solidity
ExchangeAgent
contract ExchangeAgent is Ownable, IExchangeAgent, ReentrancyGuard { event AddGateway(address _sender, address _gateway); event RemoveGateway(address _sender, address _gateway); event AddAvailableCurrency(address _sender, address _currency); event RemoveAvailableCurrency(address _sender, address _currency); event UpdateSlippage(address _sender, uint256 _slippage); event WithdrawAsset(address _user, address _to, address _token, uint256 _amount); event UpdateSlippageRate(address _user, uint256 _slippageRate); mapping(address => bool) public whiteList; // white listed CoverCompared gateways // available currencies in CoverCompared, token => bool // for now we allow CVR mapping(address => bool) public availableCurrencies; address public immutable CVR_ADDRESS; address public immutable USDC_ADDRESS; /** * We are using Uniswap V2 TWAP oracle - so it should be WETH addres in Uniswap V2 */ address public immutable WETH; address public immutable UNISWAP_FACTORY; address public immutable TWAP_ORACLE_PRICE_FEED_FACTORY; uint256 public SLIPPPAGE_RAGE; /** * when users try to use CVR to buy products, we will discount some percentage(25% at first stage) */ uint256 public discountPercentage = 75; constructor( address _CVR_ADDRESS, address _USDC_ADDRESS, address _WETH, address _UNISWAP_FACTORY, address _TWAP_ORACLE_PRICE_FEED_FACTORY ) { CVR_ADDRESS = _CVR_ADDRESS; USDC_ADDRESS = _USDC_ADDRESS; WETH = _WETH; UNISWAP_FACTORY = _UNISWAP_FACTORY; TWAP_ORACLE_PRICE_FEED_FACTORY = _TWAP_ORACLE_PRICE_FEED_FACTORY; SLIPPPAGE_RAGE = 100; } receive() external payable {} modifier onlyWhiteListed(address _gateway) { require(whiteList[_gateway], "Only white listed addresses are acceptable"); _; } /** * @dev If users use CVR, they will pay _discountPercentage % of cost. */ function setDiscountPercentage(uint256 _discountPercentage) external onlyOwner { require(_discountPercentage <= 100, "Exceeded value"); discountPercentage = _discountPercentage; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 * _desiredAmount should consider decimals based on _token1 */ function _getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) private view returns (uint256) { address pair = IUniswapV2Factory(UNISWAP_FACTORY).getPair(_token0, _token1); require(pair != address(0), "There's no pair"); address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); require(twapOraclePriceFeed != address(0), "There's no twap oracle for this pair"); uint256 neededAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token1, _desiredAmount); if (_token0 == CVR_ADDRESS) { neededAmount = (neededAmount * discountPercentage) / 100; } return neededAmount; } /** * @dev Get needed _token0 amount for _desiredAmount of _token1 */ function getNeededTokenAmount( address _token0, address _token1, uint256 _desiredAmount ) external view override returns (uint256) { return _getNeededTokenAmount(_token0, _token1, _desiredAmount); } function getETHAmountForUSDC(uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(WETH, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of USDC */ function getTokenAmountForUSDC(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, USDC_ADDRESS, _desiredAmount); } /** * get needed _token amount for _desiredAmount of ETH */ function getTokenAmountForETH(address _token, uint256 _desiredAmount) external view override returns (uint256) { return _getNeededTokenAmount(_token, WETH, _desiredAmount); } /** * @param _amount: this one is the value with decimals */ function swapTokenWithETH( address _token, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { // store CVR in this exchagne contract // send eth to buy gateway based on the uniswap price require(availableCurrencies[_token], "Token should be added in available list"); _swapTokenWithToken(_token, WETH, _amount, _desiredAmount); } function swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) external override onlyWhiteListed(msg.sender) nonReentrant { require(availableCurrencies[_token0], "Token should be added in available list"); _swapTokenWithToken(_token0, _token1, _amount, _desiredAmount); } /** * @dev exchange _amount of _token0 with _token1 by twap oracle price */ function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } } function addWhiteList(address _gateway) external onlyOwner { require(!whiteList[_gateway], "Already white listed"); whiteList[_gateway] = true; emit AddGateway(msg.sender, _gateway); } function removeWhiteList(address _gateway) external onlyOwner { require(whiteList[_gateway], "Not white listed"); whiteList[_gateway] = false; emit RemoveGateway(msg.sender, _gateway); } function addCurrency(address _currency) external onlyOwner { require(!availableCurrencies[_currency], "Already available"); availableCurrencies[_currency] = true; emit AddAvailableCurrency(msg.sender, _currency); } function removeCurrency(address _currency) external onlyOwner { require(availableCurrencies[_currency], "Not available yet"); availableCurrencies[_currency] = false; emit RemoveAvailableCurrency(msg.sender, _currency); } function setSlippageRate(uint256 _slippageRate) external onlyOwner { require(_slippageRate > 0 && _slippageRate < 100, "Overflow range"); SLIPPPAGE_RAGE = _slippageRate * 100; emit UpdateSlippageRate(msg.sender, _slippageRate); } function withdrawAsset( address _to, address _token, uint256 _amount ) external onlyOwner { if (_token == address(0)) { TransferHelper.safeTransferETH(_to, _amount); } else { TransferHelper.safeTransfer(_token, _to, _amount); } emit WithdrawAsset(owner(), _to, _token, _amount); } }
/** * @dev This smart contract is for getting CVR_ETH, CVR_USDT price */
NatSpecMultiLine
_swapTokenWithToken
function _swapTokenWithToken( address _token0, address _token1, uint256 _amount, uint256 _desiredAmount ) private { address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed( _token0, _token1 ); uint256 swapAmount = ITwapOraclePriceFeed(twapOraclePriceFeed).consult(_token0, _amount); uint256 availableMinAmount = (_desiredAmount * (10000 - SLIPPPAGE_RAGE)) / 10000; if (_token0 == CVR_ADDRESS) { availableMinAmount = (availableMinAmount * discountPercentage) / 100; } require(swapAmount > availableMinAmount, "Overflow min amount"); TransferHelper.safeTransferFrom(_token0, msg.sender, address(this), _amount); if (_token1 == WETH) { TransferHelper.safeTransferETH(msg.sender, _desiredAmount); } else { TransferHelper.safeTransfer(_token1, msg.sender, _desiredAmount); } }
/** * @dev exchange _amount of _token0 with _token1 by twap oracle price */
NatSpecMultiLine
v0.8.0+commit.c7dfd78e
MIT
ipfs://18e7d105c94bc6c221d6e9b10b345a4c9585e62afb8ac1269b8df2b7047de27c
{ "func_code_index": [ 5390, 6439 ] }
6,149
MiuRescueTeam
/contracts/MiuRescueTeam.sol
0xbd3c6af08f193e52d7e897c66ad7de4237369dbb
Solidity
MiuRescueTeam
contract MiuRescueTeam is ERC721, Ownable { string public baseURI; uint256 public supply = 10000; uint256 public totalSupply; address miuDevTeam = 0x2d0F4bcD4D2f08FAbD5a9e6Ed7c7eE86aFC3B73f; address miuFounder = 0xeC35A4F27f5163e3035510E13a227fA518c4906d; address miuFounder1 = 0x9aFaAaE1FE850CD71324930Fa399BC41ae7Aa0ce; address miuFounder2 = 0xDF210CF3aec762903c8F9bf4249FDb4aE84fAf19; address miuAdvisor = 0xfBC76261FD55cF91b81a97dbcc2B3F6118f2B935; address miuIllustrator1 = 0x1D1997Edf9Ea8D75bCd2E24211AA3665f0146374; address miuIllustrator2 = 0x4ce808fAd9923398e63D8A760f24409301BdC0F9; address miuCommunity1 = 0x81845ec7df4Fa5776998053457b8c4fB1e60CF84; address miuCommunity2 = 0xbc164c450B9b56669649c9b7AaB50e65085E5F6D; address miuDiscord = 0x331bB44Bfd8095B8887A12a4A854D179386b0c44; address miuWfAWDonate = 0x9D5025B327E6B863E5050141C987d988c07fd8B2; address miuProjectBox = 0xC20786135D630B3F79F1413D0d8cF401F1bDb860; //presale settings uint256 public publicDate = 1642975200000; constructor( string memory _initBaseURI ) ERC721("Miu Rescue Team", "MIU"){ setBaseURI(_initBaseURI); mintVault(); } function getPrice(uint256 quantity) public view returns (uint256){ uint256 totalPrice = 0; if (publicDate <= block.timestamp) { for (uint256 i = 0; i < quantity; i++) { totalPrice += 0.06 ether; } return totalPrice; } uint256 current = totalSupply; for (uint256 i = 0; i < quantity; i++) { if (current >= 1800) { totalPrice += 0.06 ether; } else { totalPrice += 0.04 ether; } current++; } return totalPrice; } // public function mint(uint256 _mintAmount) public payable{ require(publicDate <= block.timestamp, "Not yet"); require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } function presaleMint(uint256 _mintAmount) public payable{ require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } //only owner function gift(uint[] calldata quantity, address[] calldata recipient) public onlyOwner{ require(quantity.length == recipient.length, "Provide quantities and recipients" ); uint totalQuantity = 0; for(uint i = 0; i < quantity.length; ++i){ totalQuantity += quantity[i]; } require(totalSupply + totalQuantity + 1 <= supply, "0" ); for(uint i = 0; i < recipient.length; ++i){ for(uint j = 0; j < quantity[i]; ++j){ _safeMint(recipient[i], totalSupply + 1); totalSupply++; } } } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(miuDevTeam).transfer((balance * 150) / 1000); payable(miuFounder1).transfer((balance * 190) / 1000); payable(miuFounder2).transfer((balance * 190) / 1000); payable(miuAdvisor).transfer((balance * 100) / 1000); payable(miuIllustrator1).transfer((balance * 80) / 1000); payable(miuIllustrator2).transfer((balance * 80) / 1000); payable(miuCommunity1).transfer((balance * 70) / 1000); payable(miuCommunity2).transfer((balance * 70) / 1000); payable(miuDiscord).transfer((balance * 40) / 1000); payable(miuProjectBox).transfer((balance * 10) / 1000); payable(miuWfAWDonate).transfer((balance * 20) / 1000); } function setSupply(uint256 _supply) public onlyOwner { supply = _supply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } //internal function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; } function _baseURI() internal view override returns (string memory) { return baseURI; } }
mint
function mint(uint256 _mintAmount) public payable{ require(publicDate <= block.timestamp, "Not yet"); require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; }
// public
LineComment
v0.8.11+commit.d7f03943
{ "func_code_index": [ 1619, 1955 ] }
6,150
MiuRescueTeam
/contracts/MiuRescueTeam.sol
0xbd3c6af08f193e52d7e897c66ad7de4237369dbb
Solidity
MiuRescueTeam
contract MiuRescueTeam is ERC721, Ownable { string public baseURI; uint256 public supply = 10000; uint256 public totalSupply; address miuDevTeam = 0x2d0F4bcD4D2f08FAbD5a9e6Ed7c7eE86aFC3B73f; address miuFounder = 0xeC35A4F27f5163e3035510E13a227fA518c4906d; address miuFounder1 = 0x9aFaAaE1FE850CD71324930Fa399BC41ae7Aa0ce; address miuFounder2 = 0xDF210CF3aec762903c8F9bf4249FDb4aE84fAf19; address miuAdvisor = 0xfBC76261FD55cF91b81a97dbcc2B3F6118f2B935; address miuIllustrator1 = 0x1D1997Edf9Ea8D75bCd2E24211AA3665f0146374; address miuIllustrator2 = 0x4ce808fAd9923398e63D8A760f24409301BdC0F9; address miuCommunity1 = 0x81845ec7df4Fa5776998053457b8c4fB1e60CF84; address miuCommunity2 = 0xbc164c450B9b56669649c9b7AaB50e65085E5F6D; address miuDiscord = 0x331bB44Bfd8095B8887A12a4A854D179386b0c44; address miuWfAWDonate = 0x9D5025B327E6B863E5050141C987d988c07fd8B2; address miuProjectBox = 0xC20786135D630B3F79F1413D0d8cF401F1bDb860; //presale settings uint256 public publicDate = 1642975200000; constructor( string memory _initBaseURI ) ERC721("Miu Rescue Team", "MIU"){ setBaseURI(_initBaseURI); mintVault(); } function getPrice(uint256 quantity) public view returns (uint256){ uint256 totalPrice = 0; if (publicDate <= block.timestamp) { for (uint256 i = 0; i < quantity; i++) { totalPrice += 0.06 ether; } return totalPrice; } uint256 current = totalSupply; for (uint256 i = 0; i < quantity; i++) { if (current >= 1800) { totalPrice += 0.06 ether; } else { totalPrice += 0.04 ether; } current++; } return totalPrice; } // public function mint(uint256 _mintAmount) public payable{ require(publicDate <= block.timestamp, "Not yet"); require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } function presaleMint(uint256 _mintAmount) public payable{ require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } //only owner function gift(uint[] calldata quantity, address[] calldata recipient) public onlyOwner{ require(quantity.length == recipient.length, "Provide quantities and recipients" ); uint totalQuantity = 0; for(uint i = 0; i < quantity.length; ++i){ totalQuantity += quantity[i]; } require(totalSupply + totalQuantity + 1 <= supply, "0" ); for(uint i = 0; i < recipient.length; ++i){ for(uint j = 0; j < quantity[i]; ++j){ _safeMint(recipient[i], totalSupply + 1); totalSupply++; } } } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(miuDevTeam).transfer((balance * 150) / 1000); payable(miuFounder1).transfer((balance * 190) / 1000); payable(miuFounder2).transfer((balance * 190) / 1000); payable(miuAdvisor).transfer((balance * 100) / 1000); payable(miuIllustrator1).transfer((balance * 80) / 1000); payable(miuIllustrator2).transfer((balance * 80) / 1000); payable(miuCommunity1).transfer((balance * 70) / 1000); payable(miuCommunity2).transfer((balance * 70) / 1000); payable(miuDiscord).transfer((balance * 40) / 1000); payable(miuProjectBox).transfer((balance * 10) / 1000); payable(miuWfAWDonate).transfer((balance * 20) / 1000); } function setSupply(uint256 _supply) public onlyOwner { supply = _supply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } //internal function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; } function _baseURI() internal view override returns (string memory) { return baseURI; } }
gift
function gift(uint[] calldata quantity, address[] calldata recipient) public onlyOwner{ require(quantity.length == recipient.length, "Provide quantities and recipients" ); uint totalQuantity = 0; for(uint i = 0; i < quantity.length; ++i){ totalQuantity += quantity[i]; } require(totalSupply + totalQuantity + 1 <= supply, "0" ); for(uint i = 0; i < recipient.length; ++i){ for(uint j = 0; j < quantity[i]; ++j){ _safeMint(recipient[i], totalSupply + 1); otalSupply++; } } }
//only owner
LineComment
v0.8.11+commit.d7f03943
{ "func_code_index": [ 2263, 2764 ] }
6,151
MiuRescueTeam
/contracts/MiuRescueTeam.sol
0xbd3c6af08f193e52d7e897c66ad7de4237369dbb
Solidity
MiuRescueTeam
contract MiuRescueTeam is ERC721, Ownable { string public baseURI; uint256 public supply = 10000; uint256 public totalSupply; address miuDevTeam = 0x2d0F4bcD4D2f08FAbD5a9e6Ed7c7eE86aFC3B73f; address miuFounder = 0xeC35A4F27f5163e3035510E13a227fA518c4906d; address miuFounder1 = 0x9aFaAaE1FE850CD71324930Fa399BC41ae7Aa0ce; address miuFounder2 = 0xDF210CF3aec762903c8F9bf4249FDb4aE84fAf19; address miuAdvisor = 0xfBC76261FD55cF91b81a97dbcc2B3F6118f2B935; address miuIllustrator1 = 0x1D1997Edf9Ea8D75bCd2E24211AA3665f0146374; address miuIllustrator2 = 0x4ce808fAd9923398e63D8A760f24409301BdC0F9; address miuCommunity1 = 0x81845ec7df4Fa5776998053457b8c4fB1e60CF84; address miuCommunity2 = 0xbc164c450B9b56669649c9b7AaB50e65085E5F6D; address miuDiscord = 0x331bB44Bfd8095B8887A12a4A854D179386b0c44; address miuWfAWDonate = 0x9D5025B327E6B863E5050141C987d988c07fd8B2; address miuProjectBox = 0xC20786135D630B3F79F1413D0d8cF401F1bDb860; //presale settings uint256 public publicDate = 1642975200000; constructor( string memory _initBaseURI ) ERC721("Miu Rescue Team", "MIU"){ setBaseURI(_initBaseURI); mintVault(); } function getPrice(uint256 quantity) public view returns (uint256){ uint256 totalPrice = 0; if (publicDate <= block.timestamp) { for (uint256 i = 0; i < quantity; i++) { totalPrice += 0.06 ether; } return totalPrice; } uint256 current = totalSupply; for (uint256 i = 0; i < quantity; i++) { if (current >= 1800) { totalPrice += 0.06 ether; } else { totalPrice += 0.04 ether; } current++; } return totalPrice; } // public function mint(uint256 _mintAmount) public payable{ require(publicDate <= block.timestamp, "Not yet"); require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } function presaleMint(uint256 _mintAmount) public payable{ require(totalSupply + _mintAmount + 1 <= supply, "0" ); require(msg.value >= getPrice(_mintAmount)); for (uint256 i; i < _mintAmount; i++) { _safeMint(msg.sender, totalSupply + 1 + i); } totalSupply += _mintAmount; } //only owner function gift(uint[] calldata quantity, address[] calldata recipient) public onlyOwner{ require(quantity.length == recipient.length, "Provide quantities and recipients" ); uint totalQuantity = 0; for(uint i = 0; i < quantity.length; ++i){ totalQuantity += quantity[i]; } require(totalSupply + totalQuantity + 1 <= supply, "0" ); for(uint i = 0; i < recipient.length; ++i){ for(uint j = 0; j < quantity[i]; ++j){ _safeMint(recipient[i], totalSupply + 1); totalSupply++; } } } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(miuDevTeam).transfer((balance * 150) / 1000); payable(miuFounder1).transfer((balance * 190) / 1000); payable(miuFounder2).transfer((balance * 190) / 1000); payable(miuAdvisor).transfer((balance * 100) / 1000); payable(miuIllustrator1).transfer((balance * 80) / 1000); payable(miuIllustrator2).transfer((balance * 80) / 1000); payable(miuCommunity1).transfer((balance * 70) / 1000); payable(miuCommunity2).transfer((balance * 70) / 1000); payable(miuDiscord).transfer((balance * 40) / 1000); payable(miuProjectBox).transfer((balance * 10) / 1000); payable(miuWfAWDonate).transfer((balance * 20) / 1000); } function setSupply(uint256 _supply) public onlyOwner { supply = _supply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } //internal function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; } function _baseURI() internal view override returns (string memory) { return baseURI; } }
mintVault
function mintVault() internal { for (uint256 i; i < 130; i++) { _safeMint(miuFounder, totalSupply + 1 + i); } totalSupply = 130; }
//internal
LineComment
v0.8.11+commit.d7f03943
{ "func_code_index": [ 3680, 3822 ] }
6,152
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
randomLevel
function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); }
/* * Choose a random rarity level */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 1956, 2354 ] }
6,153
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
randomTrait
function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); }
/* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 2533, 3003 ] }
6,154
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
encodeTraits
function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; }
/* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 3293, 3552 ] }
6,155
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
setLevelProbabilities
function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; }
/* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 3780, 4035 ] }
6,156
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
setCategoryOptions
function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; }
/* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 4294, 4920 ] }
6,157
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoopTraits.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoopTraits
contract CryptoPoopTraits is ERC721, Ownable { using SafeMath for uint; using SafeMath for uint8; using SafeMath for uint32; using SafeMath for uint64; using SafeMath for uint256; // Levels of rarity uint8 internal constant COMMON = 0; uint8 internal constant UNCOMMON = 1; uint8 internal constant RARE = 2; uint8 internal constant EPIC = 3; uint8 internal constant LEGENDARY = 4; uint8 internal constant NUM_LEVELS = 5; uint8[] internal levelProbabilities; // Categories within which we'll randomly assign uint8 internal constant BACKGROUNDS = 0; uint8 internal constant BACK_ACCESSORIES = 1; uint8 internal constant BODIES = 2; uint8 internal constant FACES = 3; uint8 internal constant FRONT_ACCESSORIES = 4; uint8 internal constant NUM_CATEGORIES = 5; // List the option numbers that fall into each category in each rarity level uint8[][NUM_LEVELS] internal backgroundOptions; uint8[][NUM_LEVELS] internal backAccessoryOptions; uint8[][NUM_LEVELS] internal bodyOptions; uint8[][NUM_LEVELS] internal faceOptions; uint8[][NUM_LEVELS] internal frontAccessoryOptions; // traitLookup[category][level][i] = an optionId uint8[][NUM_LEVELS][NUM_CATEGORIES] internal traitLookup; // Mapping from token ID to trait encodings mapping (uint256 => uint64) internal _tokenTraits; // Fired when an NFT rolls or re-rolls its traits event TraitAssigned(address indexed tokenOwner, uint256 tokenId, uint64 encodedTraits); constructor() ERC721("CryptoPoops","POOPS") { // Initialize number boundaries for each rarity level, on a 100-sided die: // 65% chance of common, 20% uncommon, 10% rare, 4% epic, 1% legendary levelProbabilities = [65, 85, 95, 99, 100]; // Initialize lookup data traitLookup = [ backgroundOptions, backAccessoryOptions, bodyOptions, faceOptions, frontAccessoryOptions ]; } /* * Choose a random rarity level */ function randomLevel() internal returns(uint8) { uint highestLevel = COMMON; uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % 100; while ((highestLevel < NUM_LEVELS) && (randomNumber >= levelProbabilities[highestLevel])) { highestLevel++; } traitNonce++; return uint8(highestLevel); } /* * Choose a random trait from the specified category and rarity level * @dev traitLookup[_category][_level] contains an array of IDs for this level and category */ function randomTrait(uint8 _level, uint8 _category) internal returns(uint8) { uint numOptions = traitLookup[_category][_level].length; require(numOptions >= 1, "Category/level traits not set yet"); uint randomNumber = uint(keccak256(abi.encodePacked( block.timestamp, msg.sender, block.number, traitNonce))) % numOptions; uint randomOptionId = traitLookup[_category][_level][randomNumber]; traitNonce++; return uint8(randomOptionId); } /* * Encode traits into a single uint * * @dev an encoded uint64 that can store up to 8 distinct categories of max 32 options each * The structure is the following: * | unused byte | unused byte | unused byte | front acc | faces | bodies | back acc | backgrounds | */ function encodeTraits(uint8[NUM_CATEGORIES] memory _traits) internal pure returns(uint64) { uint64 encodedTraits= 0; for (uint8 i; i < NUM_CATEGORIES; i++) { encodedTraits |= (uint64(_traits[i]) << (8 * i)); } return encodedTraits; } /* * Set the rarity level options for the trait encoding * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setLevelProbabilities(uint8[] calldata _levelProbabilities) external onlyOwner { require(_levelProbabilities.length == NUM_LEVELS, "Array length doesn't match number of levels"); levelProbabilities = _levelProbabilities; } /* * Set the trait options for the trait encoding for a given category, by rarity level * * @dev This allows for lower gas in contract deploy and avoids potential gaslimit overruns * MUST SET THESE AT LEAST ONCE BEFORE STARTING THE SALE */ function setCategoryOptions(uint8[] calldata _commonOptions, uint8[] calldata _uncommonOptions, uint8[] calldata _rareOptions, uint8[] calldata _epicOptions, uint8[] calldata _legendaryOptions, uint8 _categoryNumber) external onlyOwner { require(_categoryNumber < NUM_CATEGORIES, "Category doesn't exist"); traitLookup[_categoryNumber][COMMON] = _commonOptions; traitLookup[_categoryNumber][UNCOMMON] = _uncommonOptions; traitLookup[_categoryNumber][RARE] = _rareOptions; traitLookup[_categoryNumber][EPIC] = _epicOptions; traitLookup[_categoryNumber][LEGENDARY] = _legendaryOptions; } /* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */ function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; } }
getCategoryOptions
function getCategoryOptions(uint8 _categoryNumber, uint8 _rarityLevel) external view returns(uint8[] memory) { require(_categoryNumber < NUM_CATEGORIES, "Category number doesn't exist"); require(_rarityLevel < NUM_LEVELS, "Rarity level doesn't exist"); uint numOptions = traitLookup[_categoryNumber][_rarityLevel].length; uint8[] memory options = new uint8[](numOptions); for (uint i; i < numOptions; i++) { options[i] = traitLookup[_categoryNumber][_rarityLevel][i]; } return options; }
/* * Get the trait options for a given category and rarity combination * * @dev Useful in testing and may be useful for a contract ecosystem */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 5080, 5608 ] }
6,158
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
PskERC20
function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; }
/** * Constructor function */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 918, 15951 ] }
6,159
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
/** * Internal transfer, only can be called by this contract */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 16035, 17036 ] }
6,160
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
/** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 17242, 17399 ] }
6,161
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 17674, 17975 ] }
6,162
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 18239, 18465 ] }
6,163
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 18859, 19203 ] }
6,164
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
burn
function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; }
/** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 19373, 19752 ] }
6,165
PskERC20
PskERC20.sol
0x1c5f43710a1776b0ea7191b7ead75d4b98d69858
Solidity
PskERC20
contract PskERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; // Locked address mapping mapping (address => uint256) public lockedUntil; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function */ function PskERC20() public { uint256 initialSupply = 68072143; totalSupply = initialSupply * 10 ** uint256(decimals); name = 'Pool of Stake Master Token'; symbol = 'PSK'; balanceOf[address(this)] = totalSupply; emit Transfer(address(this), address(this), totalSupply); // Launch Transfers _transfer(address(this),0x8b89dc977c1D4e1B78803342487dEcee0a2Ba02c,378000000000000000000000); _transfer(address(this),0xC19c9dd81D4b8B3FaDE83eEF6f2863Ac9B76B7FB,34912500000000000000000); _transfer(address(this),0x5Ea29C0a72Ab68bE62c7942d5b3aD69d4f29d4dA,1640625000000000000000000); _transfer(address(this),0x14a926e168278cC0c00286837de51e29F814b8D3,12250000000000000000000); _transfer(address(this),0xD46d9fE2d8f991913Bd4f77536abBa4598EA29A9,131250000000000000000000); _transfer(address(this),0x0019312D39a13302Fbacedf995f702F6e071D9e8,175000000000000000000000); _transfer(address(this),0x0FBd0E32aFE5082FED52837d96df7E34a9252bC3,8750000000000000000000); _transfer(address(this),0x10E6a8f9Dbe3A6BF4aB8D07233A45125Fb411eF1,5250000000000000000000); _transfer(address(this),0x93ED3C6a78724308095C34eFD0dcdA693f515BE7,1750000000000000000000); _transfer(address(this),0xd113f63Fec7F296FFE838939Bfd3775339d79e44,3500000000000000000000); _transfer(address(this),0x83aCbBE5f22841799647De7c4aC9f0fa61691975,87500000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,1750000000000000000000); _transfer(address(this),0xEfFefF8De1C5f15FE6545a32C1Aaa372c6023d77,49000000000000000000000); _transfer(address(this),0x5239249C90D0c31C9F2A861af4da7E3393399Cb9,8750000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,28526399998250000000000); _transfer(address(this),0x55A0B2b1A705dD09F15e7120cC0c39ACb9Ea7978,35000000000000000000000); _transfer(address(this),0x8a501A75eE3d0C808b39dd2bc2760289F9785500,3500000000000000000000); _transfer(address(this),0x752452F7759E58C50A7817F616B5317275924F78,272144811750000000000); _transfer(address(this),0x639631fc10eA37DF5540E3A6FAf1Bd12Ab02A02c,28000000000000000000000); _transfer(address(this),0x8A0Dea5F511b21a58aC9b2E348eB80E19B7126ab,98000000000000000000000); _transfer(address(this),0x231A9614c5726df24BB385F4A1720d6408302fde,42000000000000000000000); _transfer(address(this),0xCE2daE844a2f473Cb10e72eA5B5cd82ce1C86c76,207900000000000000000); _transfer(address(this),0x9829D08FE48a402fF1A3e9faD0407023ffd947e7,1890000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,5670000000000000000000); _transfer(address(this),0x7C31755f9374c238248aD19EABf648c79FF3A5eD,945000000000000000000); _transfer(address(this),0x9Ce1B1B62344ADdca64Aac6338da369f395367DE,5670000000000000000000); _transfer(address(this),0x81a1Ff97AE6DB89f5FD1B0Fb559Bd7C61e4BA960,189000000000000000000); _transfer(address(this),0xd4E6c27B8e5805318295f3586F59c34B60495992,1890000000000000000000); _transfer(address(this),0xc458F28FC72bA8dFEE6021763eCAAF21033839e8,3780000000000000000000); _transfer(address(this),0x2188f6212CE37dCbfeC7e0167D68d9e5E5F07e3a,1890000000000000000000); _transfer(address(this),0xd1EfE47c8610678DE2192F03B8dA49b25Be746fb,5670000000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,473185571040000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,463050000000000000000); _transfer(address(this),0x5BFd06c00CCf7c25984D1Fb4D153Abfdb999984c,189000000000000000000); _transfer(address(this),0xAAA0779B11BC0b03f00F82427f4C14F9C2dBB6aB,2835000000000000000000); _transfer(address(this),0x4DE5BA1869Dfd12eE429eE227EAEa33b295AE7C9,378000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,623700000000000000000); _transfer(address(this),0xbA6F61ca597510E8dc86c7f3e4fe1d251e8C5B89,642600000000000000000); _transfer(address(this),0x1a08bac3FA02C1aC7e12F8b961e3B2ed6CE31E00,18879909300000000000000); _transfer(address(this),0x4745b5130aC32Ed0c541442440C37284d475a166,2627100000000000000000); _transfer(address(this),0xd00266409A2fd099FEcbFd0340F7A965CeeceCF2,378000000000000000000); _transfer(address(this),0x26C0E0772EA9ABd416667ee5FFf978cb1F54720A,1890000000000000000000); _transfer(address(this),0x2874E22Bb3a2E378cabaa1058Aa09a23087829d0,283500000000000000000); _transfer(address(this),0x19682FE3B7BB4D0Baba4c53fa1C697c9Ba2Fce02,75600000000000000000000); _transfer(address(this),0xA4C8ed0dB08a9EfCc502f390E5E75c51851B870A,1341900000000000000000); _transfer(address(this),0x9ED09BD3c7BB325cCb84D793Ad9ce42a068D7Ef1,3780000000000000000000); _transfer(address(this),0x0b72805FFa5CB6E1187223e8EEF97dA6a6a0950c,5670000000000000000000); _transfer(address(this),0xe19938a75140d8e16aF4bf5F08D97B4cd8C62317,3780000000000000000000); _transfer(address(this),0xEf4a2C6b92024E359e107Aa6Acd17F6391855B5a,618030000000000000000); _transfer(address(this),0x7967149ed2FBaA14D1E74D26505573C803c0D698,563846285520000000000); _transfer(address(this),0x446471EAc3Ac288b9bECb3ca814daefEB867Bbc8,472500000000000000000); _transfer(address(this),0xd89F659402245781daC5c11CBaBB86B79484E696,94500000000000000000000); _transfer(address(this),0x8252e834763933124f80177b08e6F60A90DA0919,1890000000000000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,2800000000000000000000); _transfer(address(this),0x664f129b55a6948900577bad77D9b6a792b50743,140000000000000000000); _transfer(address(this),0x8166AD8690A3E7BFb2D6B45006eBB5d111628a59,663452885200000000000); _transfer(address(this),0x4997DF0Ef9f05A5c136f991b5ee088BBF5526f42,423906000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,554483286000000000000); _transfer(address(this),0x7CDE9cD90afaEc5a40480DDA05C8Cf4ec39cF643,140000000000000000000); _transfer(address(this),0x0f929995C0c8a00E212dF802f57b5f63D7640FE7,8400000000000000000000); _transfer(address(this),0x1e7D081e2Bf261F99918d02366ed8F3B524e39EC,840000000000000000000); _transfer(address(this),0x0354dEd5058c5AB4aa42F8260c2Cc08904e7eE09,329000000000000000000); _transfer(address(this),0x73b3166784F4C878E6eea15665F6F35651141984,294000000000000000000); _transfer(address(this),0x6133c06Be78f1D2AB67b4cd8f854C90167dBd066,680000000000000000000000); _transfer(address(this),0xFf342491cC946B8Cd9d7B48484306a0C18B814Dd,416666666666667000000000); _transfer(address(this),0x4fd60c47bf9437954557d0Ec46C68B63858B2862,3900000000000000000000); _transfer(address(this),0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26,3024002711476670000000000); _transfer(address(this),0x820baEBb0f077C746DaF57af4DCD38bEACeE22ed,100000000000000000000); _transfer(address(this),0x13A7b665c91259873dFF9D685811Bc916b5E403c,100000000000000000000); _transfer(address(this),0xBa122378B1b5A5D73B2778Aa6C724c4D43ebf966,100000000000000000000); _transfer(address(this),0xd495826cABB093e7dCA498D1a98e4dc55e0C29Db,100000000000000000000); _transfer(address(this),0x3dC21E7Eca79C7b9890dF4AFbe2E0ba2f17512C3,100000000000000000000); _transfer(address(this),0xA823648A8251B44b09873723A32831f2f206acD5,100000000000000000000); _transfer(address(this),0x68b1951F36e77324924170cAE9Ca2aa03dc1e0AC,100000000000000000000); _transfer(address(this),0x1CE853FC613D900FD9eB004d2D7837E97D40a23C,100000000000000000000); _transfer(address(this),0x0AeEe2337F2Cc88AB7cadc619205b22C7Ee2f05A,100000000000000000000); _transfer(address(this),0x4C844FEf1014bE0862167925842c4835354Dc4B6,100000000000000000000); _transfer(address(this),0x24f56B8e6b0bc478c00a8055600BA076777c5cFa,100000000000000000000); _transfer(address(this),0xDe29bB2E66F1731B187919bB34f4Dd793CebbE86,100000000000000000000); _transfer(address(this),0xE792690B3783c08823049b1DCe5CC916001e92Cd,340000000000000000000000); _transfer(address(this),0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8,340000000000000000000000); _transfer(address(this),0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7,340000000000000000000000); _transfer(address(this),0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4,650000000000000000000000); _transfer(address(this),0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F,750000000000000000000000); _transfer(address(this),0xa537E2887B9887Cb72bDd381C9E21DA4856bb60d,382000000000000000000000); _transfer(address(this),0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c,510500000000000000000000); _transfer(address(this),0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E,397500000000000000000000); _transfer(address(this),0xf2944172b735609b2EcEeadb00179AC88f6aA431,630000000000000000000000); _transfer(address(this),0x3e6330A1a05a170b16Dabfb2ECe7E44453CD5A36,2333333333333320000000000); _transfer(address(this),0x21028AAeb61f39c68380928e7d6297C47d09CdD9,3466666666666660000000000); _transfer(address(this),0x98Dc9E2b1AA2A29D71eec988e45022Ad774f6bF6,2000000000000000000000000); _transfer(address(this),0xdc3603FB59BDb00A527c9D8143Cda58d3A1Ade8d,1866666666666670000000000); _transfer(address(this),0xE85D25FA06b045396C2Ce811F461d3e408DcD267,2666666666666660000000000); _transfer(address(this),0x79A69503eC313cAf56A83Ff05A9C5a7798504eD4,1000000000000000000000000); _transfer(address(this),0x0B4Db8D4e13EeB6aac5D2e7fB770Ac118bDE8dc6,1666666666666670000000000); _transfer(address(this),0xD6d957139941af45B452b69783A19C77a6883ea8,1733333333333330000000000); _transfer(address(this),0x237Abf82405C542A803642DbbbFA9639Df9cA33D,2933333333333320000000000); _transfer(address(this),0x78961633419f69032D874c27D1d789E243c2B8Ed,333333333333332000000000); _transfer(address(this),0xB62FD8775e4938A352cb20E632654CC2f5e76829,564202334630000000000); _transfer(address(this),0x1449dEb2db6dFD95299776E3F77aCe0ffFFD0198,225225225230000000000); _transfer(address(this),0xa77694c0C0d0e81Ca1a21c8A6498bb2c0A1329f2,1922178988330000000000); _transfer(address(this),0xD996263209B2dfbA4Bbba5D7F37705DdE265116E,10000000000000000000000); _transfer(address(this),0xa854fF673bf41Cf79c2E4C799Af94d5f275D8D5e,333333333330000000000); _transfer(address(this),0x3353bfCA0DF0C585E94b2eE2338572f46c8986Dd,1000000000000000000000); _transfer(address(this),0x72417A054Efa81d50252cC5ceCc58716cdD99Ac7,149880000000000000000000); _transfer(address(this),0xB16e325f3458d8A6658b5f69e7986686428Ecf58,1426866000000000000000000); _transfer(address(this),0xd1eFcC88EFBEAe11FF3F2dF5A49B24D519cdBbf2,857144000000000000000000); _transfer(address(this),0x6517f439AD90ecAc307EC543404D998C0Ec965B6,2000000000000000000000000); _transfer(address(this),0x87a4E93f1acCf6dcf536107d9786d3b344D2ec05,1666667000000000000000000); _transfer(address(this),0xbDba9C3E780FB6AF27FD964e2c861b35deE0c318,3000000000000000000000000); _transfer(address(this),0xaBeEa80693B860ae2C47F824A8fDAD402AEbE100,2500000000000000000000000); _transfer(address(this),0xB83dB1E8E14A7A40BB62F2A8EBce5BBD07EA3F62,1666666666666660000000000); _transfer(address(this),0x51f96736Bbc6348cbF33A224C3Cc5231A87a1e43,2000000000000000000000000); _transfer(address(this),0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e,5000000000000000000000000); _transfer(address(this),0xF062193f4f34Ac4A13BAdd1bB8e7E4132637C1E7,3500000907170760000000000); _transfer(address(this),0x4ed9001076B69e19b397aC719D235F4f0786D7C5,4079000000000000000000000); _transfer(address(this),0x7A52a16f34576CBc028c1840825cDa9323DA4890,2268334000000000000000000); _transfer(address(this),0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90,2268334000000000000000000); _transfer(address(this),0x7518d5cB06891C62621871b1aC3bdE500BD533a0,2268334000000000000000000); _transfer(address(this),0xA3f3f84844A67c618DE06441d2970321e70bdCe7,700000000000000000000000); _transfer(address(this),0xBEc13832bb518629501fe7d07caAB099E85e1c50,700000000000000000000000); _transfer(address(this),0xF6F209C6C031b1560D073d5E82b380C40cD02469,300000000000000000000000); _transfer(address(this),0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c,55500000000000000000000); _transfer(address(this),0x9b818b7B401908671CbE2bf677F7F3361653Fdb5,35000000000000000000000); _transfer(address(this),0xd5C56952e1Aad42f20075666b123F42334969297,30000000000000000000000); _transfer(address(this),0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da,45000000000000000000000); _transfer(address(this),0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9,40000000000000000000000); // Locked addresses lockedUntil[0xD384C81eFEF96CB32Ae8Ad52cC85630eABC75E26]=1554508800; lockedUntil[0xE792690B3783c08823049b1DCe5CC916001e92Cd]=1570320000; lockedUntil[0x08a62f6DFd9f4334478B5CC038d0584fEACe9ac8]=1570320000; lockedUntil[0xd987728d110e0A270dc4B6E75e558E0F29E0c2c7]=1570320000; lockedUntil[0x25A8178d085a600Eb535e51D3bCD4Fea773E81e4]=1554508800; lockedUntil[0xE9cB39c9AfCf84C73FB3e8E8a3353d0bfD2Baa0F]=1554508800; lockedUntil[0x1d4Aa2b232Af68599864efE1C0Fbf4F4b5E6112c]=1554508800; lockedUntil[0xCbEde66A699C3a5efF63c5E234D7b8149f353c4E]=1570320000; lockedUntil[0xf2944172b735609b2EcEeadb00179AC88f6aA431]=1554508800; lockedUntil[0x2FBE4cdb2f46dc12d86A1289323a7D0545Fe2b5e]=1554508800; lockedUntil[0x7A52a16f34576CBc028c1840825cDa9323DA4890]=1601942400; lockedUntil[0x5AA37C6176b6E0612151BE56A8a0372C9DB7DE90]=1601942400; lockedUntil[0x7518d5cB06891C62621871b1aC3bdE500BD533a0]=1601942400; lockedUntil[0xA3f3f84844A67c618DE06441d2970321e70bdCe7]=1554508800; lockedUntil[0xBEc13832bb518629501fe7d07caAB099E85e1c50]=1554508800; lockedUntil[0xF6F209C6C031b1560D073d5E82b380C40cD02469]=1570320000; lockedUntil[0xf0586C3e0CAe135E90dDe857b5f53C8B29Ebc77c]=1570320000; lockedUntil[0x9b818b7B401908671CbE2bf677F7F3361653Fdb5]=1554508800; lockedUntil[0xd5C56952e1Aad42f20075666b123F42334969297]=1554508800; lockedUntil[0xB6ceCEAbfBd07ac0440972C0c0c4129249de29Da]=1554508800; lockedUntil[0x0eaa51bef06694e1e0C99f413dcd7d3beE110Fb9]=1554508800; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // assert locked addresses assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
burnFrom
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; }
/** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://5681bef5b7069969382467230c99089b7aa7b48f3d2ef2f28159bfa657aeac40
{ "func_code_index": [ 20010, 20626 ] }
6,166
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
setPresentMoney
function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } }
//for admin user to change present_money
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 1043, 1221 ] }
6,167
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
approve
function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; }
//add new user to contract
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 1260, 1425 ] }
6,168
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
adminSendMoneyToUser
function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } }
//admin account transfer money to users
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 1639, 1844 ] }
6,169
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
burnAccountMoeny
function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; }
//burn account hold money
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 1882, 2143 ] }
6,170
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
transferFrom
function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; }
//transfer action between users
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 2343, 3139 ] }
6,171
Zhoan
Zhoan.sol
0x4efd3bf84f40eda370e52df162eccc394cfc8834
Solidity
Zhoan
contract Zhoan { string public name; string public symbol; //the circulation limit of token uint256 public totalSupply; //decimal setting uint8 public decimals = 18; //contract admin's address address private admin_add; //new user can get money when first register uint private present_money=0; //transfer event event Transfer(address indexed from, address indexed to, uint256 value); //save the msg of contract_users mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowances; // constructor constructor(uint256 limit,string token_name,string token_symbol,uint8 token_decimals) public { admin_add=msg.sender; name=token_name; symbol=token_symbol; totalSupply=limit * 10 ** uint256(decimals); decimals=token_decimals; balanceOf[admin_add]=totalSupply; } //for admin user to change present_money function setPresentMoney (uint money) public{ address opt_user=msg.sender; if(opt_user == admin_add){ present_money = money; } } //add new user to contract function approve(address _spender, uint256 value) public returns (bool success){ allowances[msg.sender][_spender] = value; return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining){ return allowances[_owner][_spender]; } //admin account transfer money to users function adminSendMoneyToUser(address to,uint256 value) public{ address opt_add=msg.sender; if(opt_add == admin_add){ transferFrom(admin_add,to,value); } } //burn account hold money function burnAccountMoeny(address add,uint256 value) public{ address opt_add=msg.sender; require(opt_add == admin_add); require(balanceOf[add]>value); balanceOf[add]-=value; totalSupply -=value; } function transfer(address _to, uint256 _value) public returns (bool success){ transferFrom(msg.sender,_to,_value); return true; } //transfer action between users function transferFrom(address from,address to,uint256 value) public returns (bool success){ require(value <= allowances[from][msg.sender]); // Check allowance allowances[from][msg.sender] -= value; //sure target no be 0x0 require(to != 0x0); //check balance of sender require(balanceOf[from] >= value); //sure the amount of the transfer is greater than 0 require(balanceOf[to] + value >= balanceOf[to]); uint previousBalances = balanceOf[from] + balanceOf[to]; balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from,to,value); assert(balanceOf[from] + balanceOf[to] == previousBalances); return true; } //view balance function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; } }
balanceOf
function balanceOf(address _owner) public view returns(uint256 balance){ return balanceOf[_owner]; }
//view balance
LineComment
v0.4.24+commit.e67f0147
bzzr://d16e317eb63001dc704d184c6cf10eab4e273f25e6b061ab12890bb3858b2658
{ "func_code_index": [ 3166, 3285 ] }
6,172
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
tokensOfOwner
function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } }
/* * Get the tokens owned by _owner */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 1885, 2346 ] }
6,173
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
calculatePrice
function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } }
/* * Calculate price for the immediate next NFT minted */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 2414, 2868 ] }
6,174
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
dropPoops
function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } }
/* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 2992, 3840 ] }
6,175
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
_safeMintWithTraits
function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); }
/* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 3965, 4196 ] }
6,176
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
_assignTraits
function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; }
/* * Performs the random number generation for trait assignment * and stores the result in the contract */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 4316, 4844 ] }
6,177
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
reRollTraits
function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); }
/* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 4941, 5429 ] }
6,178
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
burnToken
function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; }
/* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 5555, 5964 ] }
6,179
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
traitsOf
function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; }
/* * Get traits of an individual token. Might come in handy */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 6037, 6216 ] }
6,180
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
reserveGiveaway
function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } }
/* * Only valid before the sales starts, for giveaways/team thank you's */
Comment
v0.7.6+commit.7338295f
{ "func_code_index": [ 6301, 6777 ] }
6,181
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
supportsInterface
function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); }
/** * @dev See {IERC165-supportsInterface}. */
NatSpecMultiLine
v0.7.6+commit.7338295f
{ "func_code_index": [ 6834, 7060 ] }
6,182
CryptoPoops
/Users/jon/Code/cp-contracts/contracts/CryptoPoops.sol
0xb8a15c37af224c9ae5bccf84bc4cb46707ace3a3
Solidity
CryptoPoops
contract CryptoPoops is CryptoPoopTraits, AccessControl, ReentrancyGuard { using SafeMath for uint8; using SafeMath for uint256; using Strings for string; // Max NFTs total. Due to burning this won't be the max tokenId uint public constant MAX_POOPS = 6006; // Allow for starting/pausing sale bool public hasSaleStarted = false; // Delegation to third party contracts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); bytes32 public constant REROLLER_ROLE = keccak256("REROLLER_ROLE"); // Effectively a UUID. Only increments to avoid collisions // possible if we were reusing token IDs uint internal nextTokenId = 0; // Mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseTokenURI; /* * bytes4(keccak256('setLevelProbabilities(uint8[]')) == 0x63a280a5 * bytes4(keccak256('setCategoryOptions( * uint8[],uint8[],uint8[],uint8[],uint8[],uint8[])')) == 0x60b4911a * bytes4(keccak256('getCategoryOptions(uint8,uint8)')) == 0x5e6c82f7 * bytes4(keccak256('reRollTraits(uint256,uint8)')) == 0x666644d0 * bytes4(keccak256('traitsOf(uint256)')) == 0x5efab6e4 * * => 0x63a280a5 ^ 0x60b4911a ^ 0x5e6c82f7 ^ 0x666644d0 ^ 0x5efab6e4 == 0x65e6617c */ bytes4 private constant _INTERFACE_ID_ENCODED_TRAITS = 0x65e6617c; /* * Set up the basics * * @dev It will NOT be ready to start sale immediately upon deploy */ constructor(string memory baseURI) { _baseTokenURI = baseURI; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Register the supported interfaces to conform to ERC721 // and our own encoded traits interface via ERC165 _registerInterface(_INTERFACE_ID_ENCODED_TRAITS); } /* * Get the tokens owned by _owner */ function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0; index < tokenCount; index++) { result[index] = tokenOfOwnerByIndex(_owner, index); } return result; } } /* * Calculate price for the immediate next NFT minted */ function calculatePrice() public view returns (uint256) { require(hasSaleStarted == true, "Sale hasn't started"); require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); uint currentSupply = totalSupply(); if (currentSupply >= 1338) { return 69000000000000000; // 1338-6006: 0.069 ETH } else { return 42000000000000000; // 0 - 1337: 0.0420 ETH } } /* * Main function for the NFT sale * * Prerequisites * - Not at max supply * - Sale has started */ function dropPoops(uint256 numCryptoPoops, uint8 boost) external payable nonReentrant { require(totalSupply() < MAX_POOPS, "We are at max supply. Burn some in a paper bag...?"); require(numCryptoPoops > 0 && numCryptoPoops <= 20, "You can drop minimum 1, maximum 20 CryptoPoops"); require(totalSupply().add(numCryptoPoops) <= MAX_POOPS, "Exceeds MAX_POOPS"); require(hasRole(MINTER_ROLE, msg.sender) || (msg.value >= calculatePrice().mul(numCryptoPoops)), "Ether value sent is below the price"); require(hasRole(MINTER_ROLE, msg.sender) || (boost == 0), "If you'd like a contract to be whitelisted for minting or boost, say hi in the Discord"); for (uint i = 0; i < numCryptoPoops; i++) { uint mintId = nextTokenId++; _safeMintWithTraits(msg.sender, mintId, boost); } } /* * Combines minting and trait generation in one place, so all CryptoPoops * get assigned traits correctly. */ function _safeMintWithTraits(address _to, uint256 _mintId, uint8 _boost) internal { _safeMint(_to, _mintId); uint64 encodedTraits = _assignTraits(_mintId, _boost); emit TraitAssigned(_to, _mintId, encodedTraits); } /* * Performs the random number generation for trait assignment * and stores the result in the contract */ function _assignTraits(uint256 _tokenId, uint8 _boost) internal returns (uint64) { uint8[NUM_CATEGORIES] memory assignedTraits; uint8 rarityLevel; for (uint8 i = 0; i < NUM_CATEGORIES; i++) { rarityLevel = randomLevel() + _boost; if (rarityLevel >= NUM_LEVELS) { rarityLevel = NUM_LEVELS - 1; } assignedTraits[i] = randomTrait(rarityLevel, i); } uint64 encodedTraits = encodeTraits(assignedTraits); _tokenTraits[_tokenId] = encodedTraits; return encodedTraits; } /* * Allows a smart contract to re-roll traits if it's been approved as a reroller. */ function reRollTraits(uint256 _tokenId, uint8 _boost) public payable nonReentrant { require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can re-roll"); require(hasRole(REROLLER_ROLE, msg.sender), "If you'd like a contract to be whitelisted for re-rolls, say hi in the Discord"); uint64 encodedTraits = _assignTraits(_tokenId, _boost); emit TraitAssigned(msg.sender, _tokenId, encodedTraits); } /* * Allows approved third party smart contracts to burn CryptoPoops * * Emits an ERC-721 {Transfer} event */ function burnToken(uint256 _tokenId) public payable nonReentrant { require(hasRole(BURNER_ROLE, msg.sender), "Not approved for burning"); require(_exists(_tokenId), "Token doesn't exist"); require(msg.sender == ERC721.ownerOf(_tokenId), "Only token owner can burn"); // Burn token via ERC-721 _burn(_tokenId); // Successful burn, clear traits delete _tokenTraits[_tokenId]; } /* * Get traits of an individual token. Might come in handy */ function traitsOf(uint256 _tokenId) external view returns (uint64) { require(_exists(_tokenId), "Traits query for nonexistent token"); return _tokenTraits[_tokenId]; } /* * Only valid before the sales starts, for giveaways/team thank you's */ function reserveGiveaway(uint256 numCryptoPoops) public onlyOwner { uint currentSupply = totalSupply(); require(totalSupply().add(numCryptoPoops) <= 70, "Exceeded giveaway supply"); require(hasSaleStarted == false, "Sale has already started"); uint256 index; // Reserved for people who helped this project and giveaways for (index = 0; index < numCryptoPoops; index++) { nextTokenId++; _safeMint(owner(), currentSupply + index); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool) { return AccessControl.supportsInterface(interfaceId) || ERC165.supportsInterface(interfaceId); } // God Mode function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function baseURI() public view virtual override returns (string memory) { return _baseTokenURI; } function startSale() public onlyOwner { hasSaleStarted = true; } function pauseSale() public onlyOwner { hasSaleStarted = false; } function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "Nonexistent token"); if (bytes(_tokenURIs[tokenId]).length != 0) { return _tokenURIs[tokenId]; } return string(abi.encodePacked(_baseTokenURI, Strings.uint2str(tokenId), "/index.json")); } // Handy while calculating XOR of all function selectors //function calculateSelector() public pure returns (bytes4) { // return type(IAccessControl).interfaceId; //} }
// Inspired/built on top of open source BGANPUNKS V2 // and the lovable justice-filled Chubbies
LineComment
setBaseURI
function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; }
// God Mode
LineComment
v0.7.6+commit.7338295f
{ "func_code_index": [ 7076, 7172 ] }
6,183
KranteriumERC20Token
contracts\ERC20\KranteriumERC20Token.sol
0x64f06d87d7dbfefbc71829a6891bbd18d2f33259
Solidity
KranteriumERC20Token
contract KranteriumERC20Token is ERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable { _name = name; _symbol = symbol; _decimals = decimals; // set tokenOwnerAddress as owner of all tokens _mint(tokenOwnerAddress, totalSupply); // pay the service fee for contract deployment feeReceiver.transfer(msg.value); } // optional functions from ERC20 stardard /** * @return the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns (string memory) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns (uint8) { return _decimals; } }
/** * @title KranteriumERC20Token * @author Kranterium (visit https://Kranterium.me) * * @dev Standard ERC20 token with optional functions implemented. * For full specification of ERC-20 standard see: * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md */
NatSpecMultiLine
name
function name() public view returns (string memory) { return _name; }
/** * @return the name of the token. */
NatSpecMultiLine
v0.5.0+commit.1d4f565a
Unlicense
bzzr://94638546b79aa897381f61a2e6480d87dc8051d2f83c0372437ce94cc83ce7d1
{ "func_code_index": [ 610, 682 ] }
6,184
KranteriumERC20Token
contracts\ERC20\KranteriumERC20Token.sol
0x64f06d87d7dbfefbc71829a6891bbd18d2f33259
Solidity
KranteriumERC20Token
contract KranteriumERC20Token is ERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable { _name = name; _symbol = symbol; _decimals = decimals; // set tokenOwnerAddress as owner of all tokens _mint(tokenOwnerAddress, totalSupply); // pay the service fee for contract deployment feeReceiver.transfer(msg.value); } // optional functions from ERC20 stardard /** * @return the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns (string memory) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns (uint8) { return _decimals; } }
/** * @title KranteriumERC20Token * @author Kranterium (visit https://Kranterium.me) * * @dev Standard ERC20 token with optional functions implemented. * For full specification of ERC-20 standard see: * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md */
NatSpecMultiLine
symbol
function symbol() public view returns (string memory) { return _symbol; }
/** * @return the symbol of the token. */
NatSpecMultiLine
v0.5.0+commit.1d4f565a
Unlicense
bzzr://94638546b79aa897381f61a2e6480d87dc8051d2f83c0372437ce94cc83ce7d1
{ "func_code_index": [ 730, 806 ] }
6,185
KranteriumERC20Token
contracts\ERC20\KranteriumERC20Token.sol
0x64f06d87d7dbfefbc71829a6891bbd18d2f33259
Solidity
KranteriumERC20Token
contract KranteriumERC20Token is ERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable { _name = name; _symbol = symbol; _decimals = decimals; // set tokenOwnerAddress as owner of all tokens _mint(tokenOwnerAddress, totalSupply); // pay the service fee for contract deployment feeReceiver.transfer(msg.value); } // optional functions from ERC20 stardard /** * @return the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns (string memory) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns (uint8) { return _decimals; } }
/** * @title KranteriumERC20Token * @author Kranterium (visit https://Kranterium.me) * * @dev Standard ERC20 token with optional functions implemented. * For full specification of ERC-20 standard see: * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md */
NatSpecMultiLine
decimals
function decimals() public view returns (uint8) { return _decimals; }
/** * @return the number of decimals of the token. */
NatSpecMultiLine
v0.5.0+commit.1d4f565a
Unlicense
bzzr://94638546b79aa897381f61a2e6480d87dc8051d2f83c0372437ce94cc83ce7d1
{ "func_code_index": [ 866, 938 ] }
6,186
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 268, 659 ] }
6,187
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
balanceOf
function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 865, 977 ] }
6,188
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 401, 853 ] }
6,189
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 1485, 1675 ] }
6,190
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
allowance
function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 1999, 2130 ] }
6,191
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
increaseApproval
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 2596, 2860 ] }
6,192
MachineFinanceSystem
MachineFinanceSystem.sol
0xc64f6dfcc4452de6407e12afa9c02123c6796136
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
decreaseApproval
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.20+commit.3155dd80
None
bzzr://27848e3362c93688b20f9abe2aad9fb6b479a51736207217dc4e5c688a87b0a5
{ "func_code_index": [ 3331, 3741 ] }
6,193
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } }
transfer
function transfer(address _to, uint256 _value) returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 268, 507 ] }
6,194
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } }
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 714, 823 ] }
6,195
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 // require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_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 MonolithDAO Token.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 392, 895 ] }
6,196
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 // require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_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 MonolithDAO Token.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
approve
function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 // require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 1131, 1682 ] }
6,197
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 // require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_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 MonolithDAO Token.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 2006, 2144 ] }
6,198
Exploreon
Exploreon.sol
0x3b6fb225e6dcb23452b255ff3101d18328c429d1
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 // require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_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 MonolithDAO Token.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
increaseApproval
function increaseApproval (address _spender, uint _addedValue) returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[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 MonolithDAO Token.sol */
Comment
v0.4.7+commit.822622cf
bzzr://cf24dbb8045744b788e1ceec4563cbd50f88b2341aff57318bed7ab0302bfef5
{ "func_code_index": [ 2393, 2665 ] }
6,199
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; }
// ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 968, 1089 ] }
6,200
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 1309, 1438 ] }
6,201
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 1782, 2064 ] }
6,202
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 2572, 2785 ] }
6,203
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 3316, 3679 ] }
6,204
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 3962, 4118 ] }
6,205
ClutchToken
ClutchToken.sol
0x339c9044b54c0f411e9a7e7b1f09853e723ad9de
Solidity
ClutchToken
contract ClutchToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "CLUTCH"; name = "Clutch Token"; decimals = 4; _totalSupply = 1000000; balances[0x6623A6076923Fea76B95D3C9f19D9C8363e35f64] = _totalSupply; emit Transfer(address(0), 0x6623A6076923Fea76B95D3C9f19D9C8363e35f64, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approveAndCall
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
GNU GPLv3
bzzr://f1375f2d683e0192af4e2868e892b7ef014cc01205379f2e6f514948289acb8a
{ "func_code_index": [ 4473, 4795 ] }
6,206