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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | isOwner | function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
| /**
* @dev Returns true if the caller is the current owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
863,
962
]
} | 13,900 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1308,
1453
]
} | 13,901 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1603,
1717
]
} | 13,902 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | _transferOwnership | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1818,
2052
]
} | 13,903 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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 | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
251,
437
]
} | 13,904 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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 | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
707,
848
]
} | 13,905 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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 | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1180,
1377
]
} | 13,906 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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 | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1623,
2099
]
} | 13,907 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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.16+commit.9c3226ce | {
"func_code_index": [
2562,
2699
]
} | 13,908 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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.16+commit.9c3226ce | {
"func_code_index": [
3224,
3574
]
} | 13,909 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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.16+commit.9c3226ce | {
"func_code_index": [
4026,
4161
]
} | 13,910 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | 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.16+commit.9c3226ce | {
"func_code_index": [
4675,
4846
]
} | 13,911 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | ERC165 | contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
} | /**
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/ | NatSpecMultiLine | supportsInterface | function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
| /**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
711,
851
]
} | 13,912 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | ERC165 | contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
} | /**
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/ | NatSpecMultiLine | _registerInterface | function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
| /**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1253,
1451
]
} | 13,913 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | IERC721 | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
} | /**
* @dev Required interface of an ERC721 compliant contract.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address owner) public view returns (uint256 balance);
| /**
* @dev Returns the number of NFTs in `owner`'s account.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
387,
464
]
} | 13,914 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | IERC721 | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
} | /**
* @dev Required interface of an ERC721 compliant contract.
*/ | NatSpecMultiLine | ownerOf | function ownerOf(uint256 tokenId) public view returns (address owner);
| /**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
551,
626
]
} | 13,915 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | IERC721 | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
} | /**
* @dev Required interface of an ERC721 compliant contract.
*/ | NatSpecMultiLine | safeTransferFrom | function safeTransferFrom(address from, address to, uint256 tokenId) public;
| /**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1017,
1098
]
} | 13,916 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | IERC721 | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
} | /**
* @dev Required interface of an ERC721 compliant contract.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address from, address to, uint256 tokenId) public;
| /**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
1378,
1455
]
} | 13,917 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | add | function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
| /**
* @dev Give an account access to this role.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
156,
339
]
} | 13,918 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | remove | function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
| /**
* @dev Remove an account's access to this role.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
414,
602
]
} | 13,919 |
||
ERC1155Sale | contracts/7_ERC1155Sale/ERC1155Sale.sol | 0x617a2db5474b249f55339bcbf56dd5494076f840 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
} | /**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/ | NatSpecMultiLine | has | function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
| /**
* @dev Check if an account has this role.
* @return bool
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | {
"func_code_index": [
692,
900
]
} | 13,920 |
||
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
89,
266
]
} | 13,921 |
|
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
350,
630
]
} | 13,922 |
|
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
744,
860
]
} | 13,923 |
|
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
924,
1054
]
} | 13,924 |
|
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | Ownable | function Ownable() public {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
261,
321
]
} | 13,925 |
|
SKYFNetworkDevelopmentFund | SKYFNetworkDevelopmentFund.sol | 0x73981535a4c589fdef072d18aabd66bbe0a97be9 | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://123a452c48174dfb963635c891ac3eba15ae7cddef79abd82eb47cea74fa9964 | {
"func_code_index": [
640,
821
]
} | 13,926 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapInterface | interface AirSwapInterface {
/// @dev Mapping of order hash to bool (true = already filled).
function fills(
bytes32 hash
) external view returns (bool);
/// @dev Fills an order by transferring tokens between (maker or escrow) and taker.
/// Maker is given tokenA to taker.
function fill(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
} | /**
* @title AirSwap interface.
*/ | NatSpecMultiLine | fills | function fills(
bytes32 hash
) external view returns (bool);
| /// @dev Mapping of order hash to bool (true = already filled). | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
99,
178
]
} | 13,927 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapInterface | interface AirSwapInterface {
/// @dev Mapping of order hash to bool (true = already filled).
function fills(
bytes32 hash
) external view returns (bool);
/// @dev Fills an order by transferring tokens between (maker or escrow) and taker.
/// Maker is given tokenA to taker.
function fill(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
} | /**
* @title AirSwap interface.
*/ | NatSpecMultiLine | fill | function fill(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
| /// @dev Fills an order by transferring tokens between (maker or escrow) and taker.
/// Maker is given tokenA to taker. | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
311,
639
]
} | 13,928 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | AirSwapHandler | function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
| /// @dev Constructor | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
343,
722
]
} | 13,929 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | getAvailableAmount | function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
| /// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
927,
1158
]
} | 13,930 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | performBuy | function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
| /// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
1608,
1952
]
} | 13,931 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | performSell | function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
| /// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
2403,
2736
]
} | 13,932 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | withdrawToken | function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
| /// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this. | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
3046,
3217
]
} | 13,933 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | withdrawETH | function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
| /// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this. | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
3364,
3495
]
} | 13,934 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | validateOrder | function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
| /** Validates order arguments for fill() and cancel() functions. */ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
3766,
4363
]
} | 13,935 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | fillBuy | function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
| /// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
4679,
5486
]
} | 13,936 |
|
AirSwapHandler | contracts/AirSwapHandler.sol | 0x706b36a1f11457b31652149b77a3fef16575b808 | Solidity | AirSwapHandler | contract AirSwapHandler is ExchangeHandler, Ownable {
/// @dev AirSwap exhange address
AirSwapInterface public airSwap;
WETH9 public weth;
address public totle;
uint256 constant MAX_UINT = 2**256 - 1;
modifier onlyTotle() {
require(msg.sender == totle);
_;
}
/// @dev Constructor
function AirSwapHandler(
address _airSwap,
address _wethAddress,
address _totle
) public {
require(_airSwap != address(0x0));
require(_wethAddress != address(0x0));
require(_totle != address(0x0));
airSwap = AirSwapInterface(_airSwap);
weth = WETH9(_wethAddress);
totle = _totle;
}
/// @dev Get the available amount left to fill for an order
/// @param orderValues Array of uint values needed for this DEX order
/// @return Available amount left to fill for this order
function getAvailableAmount(
address[8],
uint256[6] orderValues,
uint256,
uint8,
bytes32,
bytes32
) external returns (uint256) {
return orderValues[1];
}
/// @dev Perform a buy order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
payable
returns (uint256) {
return fillBuy(orderAddresses, orderValues, v, r, s);
}
/// @dev Perform a sell order at the exchange
/// @param orderAddresses Array of address values needed for each DEX order
/// @param orderValues Array of uint values needed for each DEX order
/// @param amountToFill Amount to fill in this order
/// @param v ECDSA signature parameter v
/// @param r ECDSA signature parameter r
/// @param s ECDSA signature parameter s
/// @return Amount filled in this order
function performSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint256,
uint256 amountToFill,
uint8 v,
bytes32 r,
bytes32 s
)
external
onlyTotle
returns (uint256) {
return fillSell(orderAddresses, orderValues, v, r, s);
}
function setTotle(address _totle)
external
onlyOwner {
require(_totle != address(0));
totle = _totle;
}
/// @dev The contract is not designed to hold and/or manage tokens.
/// Withdraws token in the case of emergency. Only an owner is allowed to call this.
function withdrawToken(address _token, uint _amount)
external
onlyOwner
returns (bool) {
return ERC20(_token).transfer(owner, _amount);
}
/// @dev The contract is not designed to hold ETH.
/// Withdraws ETH in the case of emergency. Only an owner is allowed to call this.
function withdrawETH(uint _amount)
external
onlyOwner
returns (bool) {
owner.transfer(_amount);
}
function approveToken(address _token, uint amount) external onlyOwner {
require(ERC20(_token).approve(address(airSwap), amount));
}
function() public payable {
}
/** Validates order arguments for fill() and cancel() functions. */
function validateOrder(
address makerAddress,
uint makerAmount,
address makerToken,
address takerAddress,
uint takerAmount,
address takerToken,
uint256 expiration,
uint256 nonce)
public
view
returns (bool) {
// Hash arguments to identify the order.
bytes32 hashV = keccak256(makerAddress, makerAmount, makerToken,
takerAddress, takerAmount, takerToken,
expiration, nonce);
return airSwap.fills(hashV);
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillBuy(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private returns (uint) {
airSwap.fill.value(msg.value)(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), orderValues[1], orderAddresses[3],
orderValues[2], orderValues[3]));
require(ERC20(orderAddresses[1]).transfer(orderAddresses[2], orderValues[0]));
return orderValues[0];
}
/// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce
function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
} | /**
* @title AirSwap wrapper contract.
* @dev Assumes makers and takers have approved this contract to access their balances.
*/ | NatSpecMultiLine | fillSell | function fillSell(
address[8] orderAddresses,
uint256[6] orderValues,
uint8 v,
bytes32 r,
bytes32 s
) private
returns (uint)
{
assert(msg.sender == totle);
require(orderAddresses[1] == address(weth));
uint takerAmount = orderValues[1];
if(ERC20(orderAddresses[3]).allowance(address(this), address(airSwap)) == 0) {
require(ERC20(orderAddresses[3]).approve(address(airSwap), MAX_UINT));
}
airSwap.fill(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3], v, r, s);
require(validateOrder(orderAddresses[0], orderValues[0], orderAddresses[1],
address(this), takerAmount, orderAddresses[3],
orderValues[2], orderValues[3]));
weth.withdraw(orderValues[0]);
msg.sender.transfer(orderValues[0]);
return orderValues[0];
}
| /// orderAddresses[0] == makerAddress
/// orderAddresses[1] == makerToken
/// orderAddresses[2] == takerAddress
/// orderAddresses[3] == takerToken
/// orderValues[0] = makerAmount
/// orderValues[1] = takerAmount
/// orderValues[2] = expiration
/// orderValues[3] = nonce | NatSpecSingleLine | v0.4.21+commit.dfe3193c | bzzr://ec6e701cf4915bcdf135a7b153a2cf5d81b6ef3c16f3c84e8fbe509f5697fdfe | {
"func_code_index": [
5802,
6888
]
} | 13,937 |
|
VibeTribe | @openzeppelin/contracts/access/Ownable.sol | 0xf412d02321848ad4da7083ea0c9d864f1f26f8c7 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**to
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | owner | function owner() public view virtual returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.7.0+commit.9e61f92b | None | ipfs://4f2617345f784621e8dce9f0b6ea2ba7edbb126049d3066732b1d18c5181044d | {
"func_code_index": [
506,
598
]
} | 13,938 |
VibeTribe | @openzeppelin/contracts/access/Ownable.sol | 0xf412d02321848ad4da7083ea0c9d864f1f26f8c7 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**to
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.7.0+commit.9e61f92b | None | ipfs://4f2617345f784621e8dce9f0b6ea2ba7edbb126049d3066732b1d18c5181044d | {
"func_code_index": [
1157,
1310
]
} | 13,939 |
VibeTribe | @openzeppelin/contracts/access/Ownable.sol | 0xf412d02321848ad4da7083ea0c9d864f1f26f8c7 | Solidity | Ownable | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**to
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.7.0+commit.9e61f92b | None | ipfs://4f2617345f784621e8dce9f0b6ea2ba7edbb126049d3066732b1d18c5181044d | {
"func_code_index": [
1460,
1709
]
} | 13,940 |
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | vest | function vest(address account, uint256 startDate, uint256 amount) external virtual;
| /// @notice Create or modify a vesting position | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
1060,
1147
]
} | 13,941 |
||
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | claim | function claim(uint256 amount) external virtual;
| /// @notice Claim an amount of tokens | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
1191,
1243
]
} | 13,942 |
||
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | unlockedBalance | function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
| /// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
1377,
1524
]
} | 13,943 |
||
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | globallyUnlocked | function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
| /// @notice How much of the quota is unlocked, vesting and available | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
1599,
2008
]
} | 13,944 |
||
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | totalBalance | function totalBalance(address account) external view virtual returns (uint256 unvested);
| /// @notice Get total size of position, vested + vesting
/// @param account Target account | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
2109,
2201
]
} | 13,945 |
||
GROEmpVesting | ./contracts/governance/GROBaseVester.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROBaseVesting | abstract contract GROBaseVesting is Ownable {
using SafeERC20 for IERC20;
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 5184000; // 2 Months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
VESTING_START_TIME = startTime;
QUOTA = quota;
}
function setDistributer(address _distributer) external onlyOwner {
distributer = IMintable(_distributer);
emit LogNewDistributer(_distributer);
}
/// @notice Create or modify a vesting position
function vest(address account, uint256 startDate, uint256 amount) external virtual;
/// @notice Claim an amount of tokens
function claim(uint256 amount) external virtual;
/// @notice See the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
virtual
returns ( uint256, uint256, uint256, uint256 );
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view virtual returns (uint256 unlocked, uint256 vesting, uint256 available) {
if (block.timestamp > VESTING_START_TIME + VESTING_TIME) {
unlocked = QUOTA;
} else {
unlocked = (QUOTA) * (block.timestamp - VESTING_START_TIME) / (VESTING_TIME);
}
vesting = vestingAssets;
available = unlocked - vesting;
}
/// @notice Get total size of position, vested + vesting
/// @param account Target account
function totalBalance(address account) external view virtual returns (uint256 unvested);
/// @notice Get current vested position
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
} | vestedBalance | function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
(vested, available, , ) = unlockedBalance(account);
}
| /// @notice Get current vested position
/// @param account Target account | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
2285,
2454
]
} | 13,946 |
||
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | name | function name() public view returns (string memory) {
return _name;
}
| /**
* @dev Returns the name of the token.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
866,
951
]
} | 13,947 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | symbol | function symbol() public view returns (string memory) {
return _symbol;
}
| /**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
1060,
1149
]
} | 13,948 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | decimals | function decimals() public view returns (uint8) {
return _decimals;
}
| /**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
1768,
1853
]
} | 13,949 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
| /**
* @dev See {IERC20-totalSupply}.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
1909,
2011
]
} | 13,950 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
| /**
* @dev See {IERC20-balanceOf}.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
2065,
2186
]
} | 13,951 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
| /**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
2385,
2597
]
} | 13,952 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
| /**
* @dev See {IERC20-allowance}.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
2651,
2848
]
} | 13,953 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
| /**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
2982,
3188
]
} | 13,954 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
| /**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
3644,
4087
]
} | 13,955 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | increaseAllowance | function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
| /**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
4478,
4771
]
} | 13,956 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | decreaseAllowance | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
| /**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
5254,
5644
]
} | 13,957 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _transfer | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| /**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
6114,
6712
]
} | 13,958 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _mint | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| /** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
6978,
7352
]
} | 13,959 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _burn | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| /**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
7667,
8115
]
} | 13,960 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _approve | function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| /**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
8534,
8908
]
} | 13,961 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _setupDecimals | function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
| /**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
9227,
9319
]
} | 13,962 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | ERC20 | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/ | NatSpecMultiLine | _beforeTokenTransfer | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
| /**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
9902,
10027
]
} | 13,963 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
501,
582
]
} | 13,964 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
1124,
1273
]
} | 13,965 |
|
SDT | contracts/token/ERC20/ERC20.sol | 0x7d60f21072b585351dfd5e8b17109458d97ec120 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.6.7+commit.b8d736ae | None | {
"func_code_index": [
1418,
1696
]
} | 13,966 |
|
IOCT_Coin | IOCT_Coin.sol | 0x6012ad64342641d261d032758087e21e5737c68e | Solidity | IOCT_Coin | contract IOCT_Coin
{
/* Variables */
string public name; // name of contract
string public symbol; // symbol of contract
uint8 public decimals; // how many decimals to keep , 18 is best
uint256 public totalSupply; // how many tokens to create
uint256 public remaining; // how many tokens has left
uint public ethRate; // current rate of ether
address public owner; // contract creator
uint256 public amountCollected; // how much funds has been collected
uint public icoStatus; // allow / disallow online purchase
uint public icoTokenPrice; // token price, start with 10 cents
address public benAddress; // funds withdraw address
address public bkaddress;
uint public allowTransferToken; // allow / disallow token transfer for members
/* Array */
mapping (address => uint256) public balanceOf; // array of all balances
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
/* Events */
event FrozenFunds(address target, bool frozen);
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
event TransferSell(address indexed from, address indexed to, uint256 value, string typex); // only for ico sales
/* Initializes contract with initial supply tokens to the creator of the contract */
function IOCT_Coin() public
{
totalSupply = 15000000000000000000000000; // as the decimals are 18, we add 18 zero after total supply, as all values are stored in wei
owner = msg.sender; // Set owner of contract
balanceOf[owner] = totalSupply; // Give the creator all initial tokens
name = "IOTA Coin"; // Set the name for display purposes
symbol = "IOTAC"; // Set the symbol for display purposes
decimals = 18; // Amount of decimals for display purposes
remaining = totalSupply; // How many tokens are left
ethRate = 450; // default token price
icoStatus = 1; // default ico status
icoTokenPrice = 75; // values are in cents
benAddress = 0xDB19E35e04D3Ab319b3391755e7978cb6D967DDc; // funds withdraw address
bkaddress = 0x3706eeF0148D9408d89A0E86e09137f8dFEE02E8;
allowTransferToken = 0; // default set to disable, it will be enable after ICO is over
}
modifier onlyOwner()
{
require((msg.sender == owner) || (msg.sender == bkaddress));
_;
}
function () public payable // called when ether is send to contract
{
if (remaining > 0 && icoStatus == 1 )
{
uint finalTokens = (msg.value * ethRate ) / icoTokenPrice;
finalTokens = finalTokens * (10 ** 2) ;
if(finalTokens < remaining)
{
remaining = remaining - finalTokens;
amountCollected = amountCollected + (msg.value / 10 ** 18);
_transfer(owner,msg.sender, finalTokens);
TransferSell(owner, msg.sender, finalTokens,'Online');
}
else
{
revert();
}
}
else
{
revert();
}
}
function sellOffline(address rec_address,uint256 token_amount) public onlyOwner
{
if (remaining > 0)
{
uint finalTokens = (token_amount * (10 ** 18));
if(finalTokens < remaining)
{
remaining = remaining - finalTokens;
_transfer(owner,rec_address, finalTokens);
TransferSell(owner, rec_address, finalTokens,'Offline');
}
else
{
revert();
}
}
else
{
revert();
}
}
function getEthRate() onlyOwner public constant returns (uint) // Get current rate of ether
{
return ethRate;
}
function getConBal() onlyOwner public constant returns (uint) // Get Balance
{
return this.balance;
}
function setEthRate (uint newEthRate) public onlyOwner // Set ether price
{
ethRate = newEthRate;
}
function getTokenPrice() onlyOwner public constant returns (uint) // Get current token price
{
return icoTokenPrice;
}
function setTokenPrice (uint newTokenRate) public onlyOwner // Set one token price
{
icoTokenPrice = newTokenRate;
}
function setTransferStatus (uint status) public onlyOwner // Set transfer status
{
allowTransferToken = status;
}
function changeIcoStatus (uint8 statx) public onlyOwner // Change ICO Status
{
icoStatus = statx;
}
function withdraw(uint amountWith) public onlyOwner // withdraw partical amount
{
if((msg.sender == owner) || (msg.sender == bkaddress))
{
benAddress.transfer(amountWith);
}
else
{
revert();
}
}
function withdraw_all() public onlyOwner // call to withdraw all available balance
{
if((msg.sender == owner) || (msg.sender == bkaddress) )
{
var amountWith = this.balance - 10000000000000000;
benAddress.transfer(amountWith);
}
else
{
revert();
}
}
function mintToken(uint256 tokensToMint) public onlyOwner
{
if(tokensToMint > 0)
{
var totalTokenToMint = tokensToMint * (10 ** 18);
balanceOf[owner] += totalTokenToMint;
totalSupply += totalTokenToMint;
Transfer(0, owner, totalTokenToMint);
}
}
function freezeAccount(address target, bool freeze) private onlyOwner
{
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function getCollectedAmount() onlyOwner public constant returns (uint256 balance)
{
return amountCollected;
}
function balanceOf(address _owner) public constant returns (uint256 balance)
{
return balanceOf[_owner];
}
function totalSupply() private constant returns (uint256 tsupply)
{
tsupply = totalSupply;
}
function transferOwnership(address newOwner) public onlyOwner
{
balanceOf[owner] = 0;
balanceOf[newOwner] = remaining;
owner = newOwner;
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal
{
if(allowTransferToken == 1 || _from == owner )
{
require(!frozenAccount[_from]); // Prevent transfer from frozenfunds
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] > _value); // Check if the sender has enough
require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add to the recipient
Transfer(_from, _to, _value); // raise event
}
else
{
revert();
}
}
function transfer(address _to, uint256 _value) public
{
_transfer(msg.sender, _to, _value);
}
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;
}
function approve(address _spender, uint256 _value) public returns (bool success)
{
allowance[msg.sender][_spender] = _value;
return true;
}
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;
}
}
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;
}
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;
}
} | IOCT_Coin | function IOCT_Coin() public
{
totalSupply = 15000000000000000000000000; // as the decimals are 18, we add 18 zero after total supply, as all values are stored in wei
owner = msg.sender; // Set owner of contract
balanceOf[owner] = totalSupply; // Give the creator all initial tokens
name = "IOTA Coin"; // Set the name for display purposes
symbol = "IOTAC"; // Set the symbol for display purposes
decimals = 18; // Amount of decimals for display purposes
remaining = totalSupply; // How many tokens are left
ethRate = 450; // default token price
icoStatus = 1; // default ico status
icoTokenPrice = 75; // values are in cents
benAddress = 0xDB19E35e04D3Ab319b3391755e7978cb6D967DDc; // funds withdraw address
bkaddress = 0x3706eeF0148D9408d89A0E86e09137f8dFEE02E8;
allowTransferToken = 0; // default set to disable, it will be enable after ICO is over
}
| /* Initializes contract with initial supply tokens to the creator of the contract */ | Comment | v0.4.19+commit.c4cbbb05 | bzzr://5c076699e18dcf5eb1e54fc066184223f14e4b9605a3f51ccb6a65fa67d42963 | {
"func_code_index": [
2157,
3720
]
} | 13,967 |
|||
IOCT_Coin | IOCT_Coin.sol | 0x6012ad64342641d261d032758087e21e5737c68e | Solidity | IOCT_Coin | contract IOCT_Coin
{
/* Variables */
string public name; // name of contract
string public symbol; // symbol of contract
uint8 public decimals; // how many decimals to keep , 18 is best
uint256 public totalSupply; // how many tokens to create
uint256 public remaining; // how many tokens has left
uint public ethRate; // current rate of ether
address public owner; // contract creator
uint256 public amountCollected; // how much funds has been collected
uint public icoStatus; // allow / disallow online purchase
uint public icoTokenPrice; // token price, start with 10 cents
address public benAddress; // funds withdraw address
address public bkaddress;
uint public allowTransferToken; // allow / disallow token transfer for members
/* Array */
mapping (address => uint256) public balanceOf; // array of all balances
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
/* Events */
event FrozenFunds(address target, bool frozen);
event Transfer(address indexed from, address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
event TransferSell(address indexed from, address indexed to, uint256 value, string typex); // only for ico sales
/* Initializes contract with initial supply tokens to the creator of the contract */
function IOCT_Coin() public
{
totalSupply = 15000000000000000000000000; // as the decimals are 18, we add 18 zero after total supply, as all values are stored in wei
owner = msg.sender; // Set owner of contract
balanceOf[owner] = totalSupply; // Give the creator all initial tokens
name = "IOTA Coin"; // Set the name for display purposes
symbol = "IOTAC"; // Set the symbol for display purposes
decimals = 18; // Amount of decimals for display purposes
remaining = totalSupply; // How many tokens are left
ethRate = 450; // default token price
icoStatus = 1; // default ico status
icoTokenPrice = 75; // values are in cents
benAddress = 0xDB19E35e04D3Ab319b3391755e7978cb6D967DDc; // funds withdraw address
bkaddress = 0x3706eeF0148D9408d89A0E86e09137f8dFEE02E8;
allowTransferToken = 0; // default set to disable, it will be enable after ICO is over
}
modifier onlyOwner()
{
require((msg.sender == owner) || (msg.sender == bkaddress));
_;
}
function () public payable // called when ether is send to contract
{
if (remaining > 0 && icoStatus == 1 )
{
uint finalTokens = (msg.value * ethRate ) / icoTokenPrice;
finalTokens = finalTokens * (10 ** 2) ;
if(finalTokens < remaining)
{
remaining = remaining - finalTokens;
amountCollected = amountCollected + (msg.value / 10 ** 18);
_transfer(owner,msg.sender, finalTokens);
TransferSell(owner, msg.sender, finalTokens,'Online');
}
else
{
revert();
}
}
else
{
revert();
}
}
function sellOffline(address rec_address,uint256 token_amount) public onlyOwner
{
if (remaining > 0)
{
uint finalTokens = (token_amount * (10 ** 18));
if(finalTokens < remaining)
{
remaining = remaining - finalTokens;
_transfer(owner,rec_address, finalTokens);
TransferSell(owner, rec_address, finalTokens,'Offline');
}
else
{
revert();
}
}
else
{
revert();
}
}
function getEthRate() onlyOwner public constant returns (uint) // Get current rate of ether
{
return ethRate;
}
function getConBal() onlyOwner public constant returns (uint) // Get Balance
{
return this.balance;
}
function setEthRate (uint newEthRate) public onlyOwner // Set ether price
{
ethRate = newEthRate;
}
function getTokenPrice() onlyOwner public constant returns (uint) // Get current token price
{
return icoTokenPrice;
}
function setTokenPrice (uint newTokenRate) public onlyOwner // Set one token price
{
icoTokenPrice = newTokenRate;
}
function setTransferStatus (uint status) public onlyOwner // Set transfer status
{
allowTransferToken = status;
}
function changeIcoStatus (uint8 statx) public onlyOwner // Change ICO Status
{
icoStatus = statx;
}
function withdraw(uint amountWith) public onlyOwner // withdraw partical amount
{
if((msg.sender == owner) || (msg.sender == bkaddress))
{
benAddress.transfer(amountWith);
}
else
{
revert();
}
}
function withdraw_all() public onlyOwner // call to withdraw all available balance
{
if((msg.sender == owner) || (msg.sender == bkaddress) )
{
var amountWith = this.balance - 10000000000000000;
benAddress.transfer(amountWith);
}
else
{
revert();
}
}
function mintToken(uint256 tokensToMint) public onlyOwner
{
if(tokensToMint > 0)
{
var totalTokenToMint = tokensToMint * (10 ** 18);
balanceOf[owner] += totalTokenToMint;
totalSupply += totalTokenToMint;
Transfer(0, owner, totalTokenToMint);
}
}
function freezeAccount(address target, bool freeze) private onlyOwner
{
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function getCollectedAmount() onlyOwner public constant returns (uint256 balance)
{
return amountCollected;
}
function balanceOf(address _owner) public constant returns (uint256 balance)
{
return balanceOf[_owner];
}
function totalSupply() private constant returns (uint256 tsupply)
{
tsupply = totalSupply;
}
function transferOwnership(address newOwner) public onlyOwner
{
balanceOf[owner] = 0;
balanceOf[newOwner] = remaining;
owner = newOwner;
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal
{
if(allowTransferToken == 1 || _from == owner )
{
require(!frozenAccount[_from]); // Prevent transfer from frozenfunds
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] > _value); // Check if the sender has enough
require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add to the recipient
Transfer(_from, _to, _value); // raise event
}
else
{
revert();
}
}
function transfer(address _to, uint256 _value) public
{
_transfer(msg.sender, _to, _value);
}
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;
}
function approve(address _spender, uint256 _value) public returns (bool success)
{
allowance[msg.sender][_spender] = _value;
return true;
}
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;
}
}
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;
}
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
{
if(allowTransferToken == 1 || _from == owner )
{
require(!frozenAccount[_from]); // Prevent transfer from frozenfunds
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] > _value); // Check if the sender has enough
require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add to the recipient
Transfer(_from, _to, _value); // raise event
}
else
{
revert();
}
}
| /* Internal transfer, only can be called by this contract */ | Comment | v0.4.19+commit.c4cbbb05 | bzzr://5c076699e18dcf5eb1e54fc066184223f14e4b9605a3f51ccb6a65fa67d42963 | {
"func_code_index": [
8604,
9629
]
} | 13,968 |
|||
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | vest | function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
| /// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
984,
1675
]
} | 13,969 |
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | withdraw | function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
| /// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
1772,
2223
]
} | 13,970 |
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | claim | function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
| /// @notice claim an amount of tokens
/// @param amount amount to be claimed | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
2310,
2880
]
} | 13,971 |
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | stopVesting | function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
| /// @notice stops an employees vesting position
/// @param employee employees account | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
2976,
3454
]
} | 13,972 |
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | unlockedBalance | function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
| /// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
3588,
4548
]
} | 13,973 |
GROEmpVesting | ./contracts/governance/EmpVesting.sol | 0xca71e66866eb9ae67bd5f3ab50b06abd188f33c7 | Solidity | GROEmpVesting | contract GROEmpVesting is GROBaseVesting {
struct EmployeePosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
mapping(address => EmployeePosition) public employeePositions;
event LogNewVest(address indexed employee, uint256 amount);
event LogClaimed(address indexed employee, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address account, uint256 amount);
event LogStoppedVesting(address indexed employee, uint256 unlocked, uint256 available);
constructor(uint256 startTime, uint256 quota) GROBaseVesting(startTime, quota) {}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new employees
function vest(address account, uint256 startTime, uint256 amount) external override onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp;
}
EmployeePosition storage ep = employeePositions[account];
require(ep.startTime == 0, 'vest: position already exists');
ep.startTime = startTime;
require((QUOTA - vestingAssets) >= amount, 'vest: not enough assets available');
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
( , , uint256 available ) = globallyUnlocked();
require(amount <= available, 'withdraw: not enough assets available');
// Need to accoount for the withdrawn assets, they are no longer available
// in the employee pool
vestingAssets += amount;
distributer.mint(msg.sender, amount);
emit LogWithdrawal(msg.sender, amount);
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
function claim(uint256 amount) external override {
require(amount > 0, "claim: No amount specified");
(uint256 unlocked, uint256 available, , ) = unlockedBalance(msg.sender);
require(available >= amount, "claim: Not enough user assets available");
uint256 _withdrawn = unlocked - available + amount;
EmployeePosition storage ep = employeePositions[msg.sender];
ep.withdrawn = _withdrawn;
distributer.mint(msg.sender, amount);
emit LogClaimed(msg.sender, amount, _withdrawn, available - amount);
}
/// @notice stops an employees vesting position
/// @param employee employees account
function stopVesting(address employee) external onlyOwner {
(uint256 unlocked, uint256 available, uint256 startTime, ) = unlockedBalance(employee);
require(startTime > 0, 'stopVesting: No position for user');
EmployeePosition storage ep = employeePositions[employee];
vestingAssets -= ep.total - unlocked;
ep.stopTime = block.timestamp;
ep.total = unlocked;
emit LogStoppedVesting(employee, unlocked, available);
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
function unlockedBalance(address account)
internal
view
override
returns ( uint256, uint256, uint256, uint256 )
{
EmployeePosition storage ep = employeePositions[account];
uint256 startTime = ep.startTime;
if (block.timestamp < startTime + VESTING_CLIFF) {
return (0, 0, startTime, startTime + VESTING_TIME);
}
uint256 unlocked;
uint256 available;
uint256 stopTime = ep.stopTime;
uint256 _endTime = startTime + VESTING_TIME;
uint256 total = ep.total;
if (stopTime > 0) {
unlocked = total;
_endTime = stopTime;
} else if (block.timestamp < _endTime) {
unlocked = total * (block.timestamp - startTime) / (VESTING_TIME);
} else {
unlocked = total;
}
available = unlocked - ep.withdrawn;
return (unlocked, available, startTime, _endTime);
}
/// @notice Get total size of position, vested + vesting
/// @param account target account
function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
} | /// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual employees
/// - Stop employees vesting positions, leaving what has already vested as available
/// to be claimed by the employee, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an employees vesting position. | NatSpecSingleLine | totalBalance | function totalBalance(address account) external view override returns (uint256 balance) {
EmployeePosition storage ep = employeePositions[account];
balance = ep.total;
}
| /// @notice Get total size of position, vested + vesting
/// @param account target account | NatSpecSingleLine | v0.8.4+commit.c7e474f2 | Unknown | ipfs://08d61eb36b2db33336810737e21f805022e9d4aeb2ec5f65ace3ab6a939a89ac | {
"func_code_index": [
4649,
4842
]
} | 13,974 |
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
94,
154
]
} | 13,975 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
237,
310
]
} | 13,976 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
535,
617
]
} | 13,977 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
896,
984
]
} | 13,978 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
1650,
1729
]
} | 13,979 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.s
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
2042,
2144
]
} | 13,980 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | 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.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
606,
1230
]
} | 13,981 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | sendValue | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, 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].
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
2160,
2562
]
} | 13,982 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | functionCall | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| /**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
3327,
3505
]
} | 13,983 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | functionCall | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
3730,
3931
]
} | 13,984 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
4301,
4532
]
} | 13,985 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | 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 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].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity functi
* on calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
4783,
5104
]
} | 13,986 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
259,
445
]
} | 13,987 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
723,
864
]
} | 13,988 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
1162,
1359
]
} | 13,989 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
1830,
1967
]
} | 13,990 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
2458,
2741
]
} | 13,991 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
3201,
3336
]
} | 13,992 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
3816,
3987
]
} | 13,993 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return address(0);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | owner | function owner() public view returns (address) {
return address(0);
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
501,
589
]
} | 13,994 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return address(0);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
1147,
1270
]
} | 13,995 |
||
FISHInu | FISHInu.sol | 0x249c2f0dafd23d4511c551be81cfd46e8ef7d6af | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return address(0);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
} | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.6.8+commit.0bbfe453 | None | ipfs://33fc8531fffad0694bb18c40914e7e259796016bf0c3ece70de67620817b7432 | {
"func_code_index": [
1420,
1675
]
} | 13,996 |
||
Token | ERC20Pausable.sol | 0xa328b83cb84e1979179723ed5f17158a7cbe63a3 | Solidity | ERC20Pausable | abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
} | /**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/ | NatSpecMultiLine | _beforeTokenTransfer | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
| /**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | None | ipfs://0c2742d4e7048c7870e37f0bf9830fb6160a93e9e7491c8c62030cde064e4564 | {
"func_code_index": [
200,
443
]
} | 13,997 |
Unipool | Unipool.sol | 0xc4d94b0aa01367ee160c481a70b59bcc23978509 | Solidity | Math | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
} | /**
* @dev Standard math utilities missing in the Solidity language.
*/ | NatSpecMultiLine | max | function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
| /**
* @dev Returns the largest of two numbers.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | MIT | bzzr://515ca46c4194e518df6e11a224cc917e823a084eee210cf8a6cb8ffa80c29568 | {
"func_code_index": [
83,
195
]
} | 13,998 |
Unipool | Unipool.sol | 0xc4d94b0aa01367ee160c481a70b59bcc23978509 | Solidity | Math | library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
} | /**
* @dev Standard math utilities missing in the Solidity language.
*/ | NatSpecMultiLine | min | function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
| /**
* @dev Returns the smallest of two numbers.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | MIT | bzzr://515ca46c4194e518df6e11a224cc917e823a084eee210cf8a6cb8ffa80c29568 | {
"func_code_index": [
266,
377
]
} | 13,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.