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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
4546,
4717
]
} | 57,361 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | isContract | function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
| /**
* @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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
606,
1033
]
} | 57,362 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | sendValue | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1963,
2365
]
} | 57,363 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | 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 function 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
3121,
3299
]
} | 57,364 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
3524,
3725
]
} | 57,365 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
4095,
4326
]
} | 57,366 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
4577,
4898
]
} | 57,367 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | SafeERC20 | library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
} | safeApprove | function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| /**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
747,
1374
]
} | 57,368 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | SafeERC20 | library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
} | _callOptionalReturn | function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
| /**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
2393,
3159
]
} | 57,369 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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;
}
} | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
497,
581
]
} | 57,370 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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;
}
} | 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1139,
1292
]
} | 57,371 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | 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;
}
} | 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.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1442,
1691
]
} | 57,372 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | IToken | interface IToken is IERC20 {
/** @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) external;
} | mint | function mint(address account, uint256 amount) external;
| /** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
305,
366
]
} | 57,373 |
||
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | Lender | contract Lender is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
// Contract address of the Token contract accepts
IERC20 public inToken;
// Contract address of the Token contract mints and sends out for In Token transfers
IToken public outToken;
// Contract address where contract will send inTokens
address public workerAddress;
// Coefficient in ppm (parts per million)
uint256 public coefficient;
/**
* @dev Lender constructor
* @param _outToken Out Token contract address
* @param _inToken In Token contract address
* @param _workerAddress Worker contract address
* @param _coefficient Coefficient ratio
*/
constructor (
address _outToken,
address _inToken,
address _workerAddress,
uint256 _coefficient
)
public
{
outToken = IToken(_outToken);
setInToken(_inToken);
setWorker(_workerAddress);
setCoefficient(_coefficient);
}
/***************************************
ADMIN
****************************************/
/**
* @dev Sets In Token contract address, in case if proxy contract address changes
* @param _tokenAddress - New In Token contract address
*/
function setInToken (
address _tokenAddress
)
public
onlyOwner
{
require(_tokenAddress.isContract(), "address must be a contract");
inToken = IERC20(_tokenAddress);
}
/**
* @dev Sets Worker contract address
* @param _workerAddress - New worker contract address
*/
function setWorker (
address _workerAddress
)
public
onlyOwner
{
require(_workerAddress.isContract(), "address must be a contract");
workerAddress = _workerAddress;
}
/**
* @dev Sets Coefficient
* @param _coefficient - New coefficient
*/
function setCoefficient (
uint256 _coefficient
)
public
onlyOwner
{
coefficient = _coefficient;
}
/***************************************
ACTIONS
****************************************/
/**
* @dev Transfers In Tokens preapproved by sender to worker contract,
* mints Out Tokens amount*coefficient and transfers them to sender
* @param _inAmount of In Tokens
*/
function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "In Amount is 0");
address _user = msg.sender;
inToken.safeTransferFrom(_user, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
outToken.mint(_user, _outAmount);
}
} | //
// Libs
// Used contracts
// Internal | LineComment | setInToken | function setInToken (
address _tokenAddress
)
public
onlyOwner
{
require(_tokenAddress.isContract(), "address must be a contract");
inToken = IERC20(_tokenAddress);
}
| /**
* @dev Sets In Token contract address, in case if proxy contract address changes
* @param _tokenAddress - New In Token contract address
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1344,
1560
]
} | 57,374 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | Lender | contract Lender is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
// Contract address of the Token contract accepts
IERC20 public inToken;
// Contract address of the Token contract mints and sends out for In Token transfers
IToken public outToken;
// Contract address where contract will send inTokens
address public workerAddress;
// Coefficient in ppm (parts per million)
uint256 public coefficient;
/**
* @dev Lender constructor
* @param _outToken Out Token contract address
* @param _inToken In Token contract address
* @param _workerAddress Worker contract address
* @param _coefficient Coefficient ratio
*/
constructor (
address _outToken,
address _inToken,
address _workerAddress,
uint256 _coefficient
)
public
{
outToken = IToken(_outToken);
setInToken(_inToken);
setWorker(_workerAddress);
setCoefficient(_coefficient);
}
/***************************************
ADMIN
****************************************/
/**
* @dev Sets In Token contract address, in case if proxy contract address changes
* @param _tokenAddress - New In Token contract address
*/
function setInToken (
address _tokenAddress
)
public
onlyOwner
{
require(_tokenAddress.isContract(), "address must be a contract");
inToken = IERC20(_tokenAddress);
}
/**
* @dev Sets Worker contract address
* @param _workerAddress - New worker contract address
*/
function setWorker (
address _workerAddress
)
public
onlyOwner
{
require(_workerAddress.isContract(), "address must be a contract");
workerAddress = _workerAddress;
}
/**
* @dev Sets Coefficient
* @param _coefficient - New coefficient
*/
function setCoefficient (
uint256 _coefficient
)
public
onlyOwner
{
coefficient = _coefficient;
}
/***************************************
ACTIONS
****************************************/
/**
* @dev Transfers In Tokens preapproved by sender to worker contract,
* mints Out Tokens amount*coefficient and transfers them to sender
* @param _inAmount of In Tokens
*/
function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "In Amount is 0");
address _user = msg.sender;
inToken.safeTransferFrom(_user, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
outToken.mint(_user, _outAmount);
}
} | //
// Libs
// Used contracts
// Internal | LineComment | setWorker | function setWorker (
address _workerAddress
)
public
onlyOwner
{
require(_workerAddress.isContract(), "address must be a contract");
workerAddress = _workerAddress;
}
| /**
* @dev Sets Worker contract address
* @param _workerAddress - New worker contract address
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1675,
1891
]
} | 57,375 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | Lender | contract Lender is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
// Contract address of the Token contract accepts
IERC20 public inToken;
// Contract address of the Token contract mints and sends out for In Token transfers
IToken public outToken;
// Contract address where contract will send inTokens
address public workerAddress;
// Coefficient in ppm (parts per million)
uint256 public coefficient;
/**
* @dev Lender constructor
* @param _outToken Out Token contract address
* @param _inToken In Token contract address
* @param _workerAddress Worker contract address
* @param _coefficient Coefficient ratio
*/
constructor (
address _outToken,
address _inToken,
address _workerAddress,
uint256 _coefficient
)
public
{
outToken = IToken(_outToken);
setInToken(_inToken);
setWorker(_workerAddress);
setCoefficient(_coefficient);
}
/***************************************
ADMIN
****************************************/
/**
* @dev Sets In Token contract address, in case if proxy contract address changes
* @param _tokenAddress - New In Token contract address
*/
function setInToken (
address _tokenAddress
)
public
onlyOwner
{
require(_tokenAddress.isContract(), "address must be a contract");
inToken = IERC20(_tokenAddress);
}
/**
* @dev Sets Worker contract address
* @param _workerAddress - New worker contract address
*/
function setWorker (
address _workerAddress
)
public
onlyOwner
{
require(_workerAddress.isContract(), "address must be a contract");
workerAddress = _workerAddress;
}
/**
* @dev Sets Coefficient
* @param _coefficient - New coefficient
*/
function setCoefficient (
uint256 _coefficient
)
public
onlyOwner
{
coefficient = _coefficient;
}
/***************************************
ACTIONS
****************************************/
/**
* @dev Transfers In Tokens preapproved by sender to worker contract,
* mints Out Tokens amount*coefficient and transfers them to sender
* @param _inAmount of In Tokens
*/
function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "In Amount is 0");
address _user = msg.sender;
inToken.safeTransferFrom(_user, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
outToken.mint(_user, _outAmount);
}
} | //
// Libs
// Used contracts
// Internal | LineComment | setCoefficient | function setCoefficient (
uint256 _coefficient
)
public
onlyOwner
{
coefficient = _coefficient;
}
| /**
* @dev Sets Coefficient
* @param _coefficient - New coefficient
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
1980,
2121
]
} | 57,376 |
Lender | Lender.sol | 0x55dbe7df69e9385b9be0f4bdcc9f1505cd139791 | Solidity | Lender | contract Lender is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
// Contract address of the Token contract accepts
IERC20 public inToken;
// Contract address of the Token contract mints and sends out for In Token transfers
IToken public outToken;
// Contract address where contract will send inTokens
address public workerAddress;
// Coefficient in ppm (parts per million)
uint256 public coefficient;
/**
* @dev Lender constructor
* @param _outToken Out Token contract address
* @param _inToken In Token contract address
* @param _workerAddress Worker contract address
* @param _coefficient Coefficient ratio
*/
constructor (
address _outToken,
address _inToken,
address _workerAddress,
uint256 _coefficient
)
public
{
outToken = IToken(_outToken);
setInToken(_inToken);
setWorker(_workerAddress);
setCoefficient(_coefficient);
}
/***************************************
ADMIN
****************************************/
/**
* @dev Sets In Token contract address, in case if proxy contract address changes
* @param _tokenAddress - New In Token contract address
*/
function setInToken (
address _tokenAddress
)
public
onlyOwner
{
require(_tokenAddress.isContract(), "address must be a contract");
inToken = IERC20(_tokenAddress);
}
/**
* @dev Sets Worker contract address
* @param _workerAddress - New worker contract address
*/
function setWorker (
address _workerAddress
)
public
onlyOwner
{
require(_workerAddress.isContract(), "address must be a contract");
workerAddress = _workerAddress;
}
/**
* @dev Sets Coefficient
* @param _coefficient - New coefficient
*/
function setCoefficient (
uint256 _coefficient
)
public
onlyOwner
{
coefficient = _coefficient;
}
/***************************************
ACTIONS
****************************************/
/**
* @dev Transfers In Tokens preapproved by sender to worker contract,
* mints Out Tokens amount*coefficient and transfers them to sender
* @param _inAmount of In Tokens
*/
function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "In Amount is 0");
address _user = msg.sender;
inToken.safeTransferFrom(_user, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
outToken.mint(_user, _outAmount);
}
} | //
// Libs
// Used contracts
// Internal | LineComment | receiveInToken | function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "In Amount is 0");
address _user = msg.sender;
inToken.safeTransferFrom(_user, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
outToken.mint(_user, _outAmount);
}
| /**
* @dev Transfers In Tokens preapproved by sender to worker contract,
* mints Out Tokens amount*coefficient and transfers them to sender
* @param _inAmount of In Tokens
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://cc07295a027ff4b350dad10d12d3f3ca9eb724ea5b3c2240dc1f8ee2bec1603b | {
"func_code_index": [
2457,
2811
]
} | 57,377 |
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | totalSupply | function totalSupply() public constant returns (uint supply) {}
| /// @return total amount of tokens | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
60,
128
]
} | 57,378 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | balanceOf | function balanceOf(address _owner) public constant returns (uint balance) {}
| /// @param _owner The address from which the balance will be retrieved
/// @return The balance | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
236,
317
]
} | 57,379 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | transfer | function transfer(address _to, uint _value) returns (bool success) {}
| /// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
554,
628
]
} | 57,380 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | transferFrom | function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
| /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
951,
1044
]
} | 57,381 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | approve | function approve(address _spender, uint _value) returns (bool success) {}
| /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
1328,
1406
]
} | 57,382 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
} | allowance | function allowance(address _owner, address _spender) constant returns (uint remaining) {}
| /// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
1614,
1708
]
} | 57,383 |
||
Xfg | Xfg.sol | 0x76b9d2dbbf2b020f6912a1cd3e4cd748b5204c88 | Solidity | UnboundedRegularToken | contract UnboundedRegularToken is RegularToken {
uint constant MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount.
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _value Amount to transfer.
/// @return Success of transfer.
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
uint allowance = allowed[_from][msg.sender];
if (balances[_from] >= _value
&& allowance >= _value
&& balances[_to] + _value >= balances[_to]
) {
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT) {
allowed[_from][msg.sender] -= _value;
}
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
} | transferFrom | function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
uint allowance = allowed[_from][msg.sender];
if (balances[_from] >= _value
&& allowance >= _value
&& balances[_to] + _value >= balances[_to]
) {
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT) {
allowed[_from][msg.sender] -= _value;
}
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
| /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount.
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _value Amount to transfer.
/// @return Success of transfer. | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | None | bzzr://ce07bacf1113cefcd8f1341c8612cd906562bb95bb841a18ceb488a5305bb1e6 | {
"func_code_index": [
383,
1016
]
} | 57,384 |
||
WIZCSTL | WIZCSTL.sol | 0xddddafc19264f23d45ab64604eb4f18d474303f3 | Solidity | WIZCSTL | contract WIZCSTL {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor() public {
totalSupply = 50 * 10 ** uint256(18); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "WIZARD CASTLE"; // Set the name for display purposes
symbol = "CSTL"; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
// require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
} | _transfer | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
// require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| /**
* Internal transfer, only can be called by this contract
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | None | bzzr://58d7b9a92086f18918a9f9d85c4e97cdb2bf9da79561c140f41f25c9f6f219ca | {
"func_code_index": [
1239,
2090
]
} | 57,385 |
||
WIZCSTL | WIZCSTL.sol | 0xddddafc19264f23d45ab64604eb4f18d474303f3 | Solidity | WIZCSTL | contract WIZCSTL {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor() public {
totalSupply = 50 * 10 ** uint256(18); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "WIZARD CASTLE"; // Set the name for display purposes
symbol = "CSTL"; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
// require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
} | transfer | function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
| /**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | None | bzzr://58d7b9a92086f18918a9f9d85c4e97cdb2bf9da79561c140f41f25c9f6f219ca | {
"func_code_index": [
2296,
2408
]
} | 57,386 |
||
WIZCSTL | WIZCSTL.sol | 0xddddafc19264f23d45ab64604eb4f18d474303f3 | Solidity | WIZCSTL | contract WIZCSTL {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor() public {
totalSupply = 50 * 10 ** uint256(18); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "WIZARD CASTLE"; // Set the name for display purposes
symbol = "CSTL"; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
// require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| /**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | None | bzzr://58d7b9a92086f18918a9f9d85c4e97cdb2bf9da79561c140f41f25c9f6f219ca | {
"func_code_index": [
2683,
2984
]
} | 57,387 |
||
WIZCSTL | WIZCSTL.sol | 0xddddafc19264f23d45ab64604eb4f18d474303f3 | Solidity | WIZCSTL | contract WIZCSTL {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor() public {
totalSupply = 50 * 10 ** uint256(18); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "WIZARD CASTLE"; // Set the name for display purposes
symbol = "CSTL"; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
// require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
} | approve | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| /**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | None | bzzr://58d7b9a92086f18918a9f9d85c4e97cdb2bf9da79561c140f41f25c9f6f219ca | {
"func_code_index": [
3254,
3430
]
} | 57,388 |
||
DINSURE | DINSURE.sol | 0x20fc67d530ea96f7fa0483200645a6bb51ee94e3 | Solidity | DINSURE | contract DINSURE is SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public owner;
/* This creates an array with all balances */
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public freezeOf;
mapping(address => mapping(address => uint256)) public allowance;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
/* This notifies clients about the amount frozen */
event Freeze(address indexed from, uint256 value);
/* This notifies clients about the amount unfrozen */
event Unfreeze(address indexed from, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor() public{
balanceOf[msg.sender] = 1000000000000; // Give the creator all initial tokens
totalSupply = 1000000000000; // Update total supply
name = 'yinsure.finance'; // Set the name for display purposes
symbol = 'YIN'; // Set the symbol for display purposes
decimals = 8; // Amount of decimals for display purposes
owner = msg.sender;
}
/* Send tokens */
function transfer(address _to, uint256 _value) public returns(bool){
if (_to == 0x0) return false; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) return false;
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
/* Allow another contract to spend some tokens in your behalf */
function approve(address _spender, uint256 _value) public returns(bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/* Transfer tokens */
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) revert();
if (balanceOf[_from] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
if (_value > allowance[_from][msg.sender]) revert(); // Check allowance
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
/* Destruction of the token */
function burn(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
totalSupply = SafeMath.safeSub(totalSupply, _value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function freeze(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates frozen tokens
emit Freeze(msg.sender, _value);
return true;
}
function unfreeze(uint256 _value) public returns(bool success) {
if (freezeOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Updates frozen tokens
balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); // Add to the sender
emit Unfreeze(msg.sender, _value);
return true;
}
function () public{
revert();
}
} | transfer | function transfer(address _to, uint256 _value) public returns(bool){
if (_to == 0x0) return false; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) return false;
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
eturn true;
}
| /* Send tokens */ | Comment | v0.4.26+commit.4563c3fc | None | bzzr://eb018e3cad08d14b541547928a4a7b886938b8ddff4282d3fd05887837eb8fdd | {
"func_code_index": [
1555,
2347
]
} | 57,389 |
||
DINSURE | DINSURE.sol | 0x20fc67d530ea96f7fa0483200645a6bb51ee94e3 | Solidity | DINSURE | contract DINSURE is SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public owner;
/* This creates an array with all balances */
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public freezeOf;
mapping(address => mapping(address => uint256)) public allowance;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
/* This notifies clients about the amount frozen */
event Freeze(address indexed from, uint256 value);
/* This notifies clients about the amount unfrozen */
event Unfreeze(address indexed from, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor() public{
balanceOf[msg.sender] = 1000000000000; // Give the creator all initial tokens
totalSupply = 1000000000000; // Update total supply
name = 'yinsure.finance'; // Set the name for display purposes
symbol = 'YIN'; // Set the symbol for display purposes
decimals = 8; // Amount of decimals for display purposes
owner = msg.sender;
}
/* Send tokens */
function transfer(address _to, uint256 _value) public returns(bool){
if (_to == 0x0) return false; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) return false;
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
/* Allow another contract to spend some tokens in your behalf */
function approve(address _spender, uint256 _value) public returns(bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/* Transfer tokens */
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) revert();
if (balanceOf[_from] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
if (_value > allowance[_from][msg.sender]) revert(); // Check allowance
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
/* Destruction of the token */
function burn(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
totalSupply = SafeMath.safeSub(totalSupply, _value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function freeze(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates frozen tokens
emit Freeze(msg.sender, _value);
return true;
}
function unfreeze(uint256 _value) public returns(bool success) {
if (freezeOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Updates frozen tokens
balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); // Add to the sender
emit Unfreeze(msg.sender, _value);
return true;
}
function () public{
revert();
}
} | approve | function approve(address _spender, uint256 _value) public returns(bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
mit Approval(msg.sender, _spender, _value);
return true;
}
| /* Allow another contract to spend some tokens in your behalf */ | Comment | v0.4.26+commit.4563c3fc | None | bzzr://eb018e3cad08d14b541547928a4a7b886938b8ddff4282d3fd05887837eb8fdd | {
"func_code_index": [
2418,
2690
]
} | 57,390 |
||
DINSURE | DINSURE.sol | 0x20fc67d530ea96f7fa0483200645a6bb51ee94e3 | Solidity | DINSURE | contract DINSURE is SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public owner;
/* This creates an array with all balances */
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public freezeOf;
mapping(address => mapping(address => uint256)) public allowance;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
/* This notifies clients about the amount frozen */
event Freeze(address indexed from, uint256 value);
/* This notifies clients about the amount unfrozen */
event Unfreeze(address indexed from, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor() public{
balanceOf[msg.sender] = 1000000000000; // Give the creator all initial tokens
totalSupply = 1000000000000; // Update total supply
name = 'yinsure.finance'; // Set the name for display purposes
symbol = 'YIN'; // Set the symbol for display purposes
decimals = 8; // Amount of decimals for display purposes
owner = msg.sender;
}
/* Send tokens */
function transfer(address _to, uint256 _value) public returns(bool){
if (_to == 0x0) return false; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) return false;
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
/* Allow another contract to spend some tokens in your behalf */
function approve(address _spender, uint256 _value) public returns(bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/* Transfer tokens */
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) revert();
if (balanceOf[_from] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
if (_value > allowance[_from][msg.sender]) revert(); // Check allowance
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
/* Destruction of the token */
function burn(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
totalSupply = SafeMath.safeSub(totalSupply, _value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function freeze(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates frozen tokens
emit Freeze(msg.sender, _value);
return true;
}
function unfreeze(uint256 _value) public returns(bool success) {
if (freezeOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Updates frozen tokens
balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); // Add to the sender
emit Unfreeze(msg.sender, _value);
return true;
}
function () public{
revert();
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) revert();
if (balanceOf[_from] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
if (_value > allowance[_from][msg.sender]) revert(); // Check allowance
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
| /* Transfer tokens */ | Comment | v0.4.26+commit.4563c3fc | None | bzzr://eb018e3cad08d14b541547928a4a7b886938b8ddff4282d3fd05887837eb8fdd | {
"func_code_index": [
2718,
3628
]
} | 57,391 |
||
DINSURE | DINSURE.sol | 0x20fc67d530ea96f7fa0483200645a6bb51ee94e3 | Solidity | DINSURE | contract DINSURE is SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public owner;
/* This creates an array with all balances */
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public freezeOf;
mapping(address => mapping(address => uint256)) public allowance;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
/* This notifies clients about the amount frozen */
event Freeze(address indexed from, uint256 value);
/* This notifies clients about the amount unfrozen */
event Unfreeze(address indexed from, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor() public{
balanceOf[msg.sender] = 1000000000000; // Give the creator all initial tokens
totalSupply = 1000000000000; // Update total supply
name = 'yinsure.finance'; // Set the name for display purposes
symbol = 'YIN'; // Set the symbol for display purposes
decimals = 8; // Amount of decimals for display purposes
owner = msg.sender;
}
/* Send tokens */
function transfer(address _to, uint256 _value) public returns(bool){
if (_to == 0x0) return false; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) return false;
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
/* Allow another contract to spend some tokens in your behalf */
function approve(address _spender, uint256 _value) public returns(bool success) {
require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/* Transfer tokens */
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {
if (_to == 0x0) revert(); // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) revert();
if (balanceOf[_from] < _value) revert(); // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) revert(); // Check for overflows
if (_value > allowance[_from][msg.sender]) revert(); // Check allowance
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
/* Destruction of the token */
function burn(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
totalSupply = SafeMath.safeSub(totalSupply, _value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function freeze(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates frozen tokens
emit Freeze(msg.sender, _value);
return true;
}
function unfreeze(uint256 _value) public returns(bool success) {
if (freezeOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Updates frozen tokens
balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); // Add to the sender
emit Unfreeze(msg.sender, _value);
return true;
}
function () public{
revert();
}
} | burn | function burn(uint256 _value) public returns(bool success) {
if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough
if (_value <= 0) revert();
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender
totalSupply = SafeMath.safeSub(totalSupply, _value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| /* Destruction of the token */ | Comment | v0.4.26+commit.4563c3fc | None | bzzr://eb018e3cad08d14b541547928a4a7b886938b8ddff4282d3fd05887837eb8fdd | {
"func_code_index": [
3665,
4143
]
} | 57,392 |
||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @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) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
100,
342
]
} | 57,393 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @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) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
432,
587
]
} | 57,394 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @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) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
707,
871
]
} | 57,395 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @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) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @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;
require(c >= a, "SafeMath: Addition exception");
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
941,
1120
]
} | 57,396 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @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;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @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) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
| /**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1263,
1422
]
} | 57,397 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
98,
334
]
} | 57,398 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
424,
573
]
} | 57,399 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
693,
851
]
} | 57,400 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
921,
1094
]
} | 57,401 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mod | function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
| /**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1237,
1390
]
} | 57,402 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | BasicToken | contract BasicToken is ERC20Basic, Controllable {
using SafeMathUint256 for uint256;
mapping(address => uint256) balances;
uint256 public totalSupply;
constructor(uint256 _initialSupply) public
{
totalSupply = _initialSupply;
if (0 < _initialSupply) {
balances[msg.sender] = _initialSupply;
emit Transfer(address(0), msg.sender, _initialSupply);
}
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view
returns (uint256 balance)
{
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
609,
1196
]
} | 57,403 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | BasicToken | contract BasicToken is ERC20Basic, Controllable {
using SafeMathUint256 for uint256;
mapping(address => uint256) balances;
uint256 public totalSupply;
constructor(uint256 _initialSupply) public
{
totalSupply = _initialSupply;
if (0 < _initialSupply) {
balances[msg.sender] = _initialSupply;
emit Transfer(address(0), msg.sender, _initialSupply);
}
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view
returns (uint256 balance)
{
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view
returns (uint256 balance)
{
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1412,
1546
]
} | 57,404 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
408,
1155
]
} | 57,405 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1798,
2172
]
} | 57,406 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
2503,
2656
]
} | 57,407 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
3133,
3598
]
} | 57,408 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | decreaseApproval | function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue)
allowed[msg.sender][_spender] = 0;
else
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
4080,
4710
]
} | 57,409 |
|
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | increaseSupply | function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
| /**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1204,
1596
]
} | 57,410 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | increaseSupplyWithDeposit | function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
| /**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
1850,
2475
]
} | 57,411 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | decreaseSupply | function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
| /**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
2690,
3372
]
} | 57,412 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freeze | function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
| /**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
3542,
4082
]
} | 57,413 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freezeWithPurpose | function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
| /**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
4315,
4528
]
} | 57,414 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freezeWithPurposeCode | function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
| /**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
4770,
5339
]
} | 57,415 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreeze | function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
| /**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
5515,
6083
]
} | 57,416 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreezeWithPurpose | function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
| /**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
6323,
6559
]
} | 57,417 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreezeWithPurposeCode | function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
| /**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
6808,
7398
]
} | 57,418 |
|||
USDA | USDA.sol | 0x5d81a1ddb8e51d3f7f68c0698cee1193fc2b07e2 | Solidity | USDA | contract USDA is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
| /**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | bzzr://23f4106daff7dea932097c3373fbddf46f30696cc0631f87b6f184207ee1286e | {
"func_code_index": [
7620,
8017
]
} | 57,419 |
|||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Ownable | contract Ownable {
address public owner;
/**
* @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 {
if (newOwner != address(0)) {
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 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
180,
248
]
} | 57,420 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Ownable | contract Ownable {
address public owner;
/**
* @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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
592,
748
]
} | 57,421 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | BasicToken | contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
626,
1204
]
} | 57,422 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | BasicToken | contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
1417,
1538
]
} | 57,423 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | StandardToken | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
451,
1357
]
} | 57,424 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | StandardToken | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
1599,
2177
]
} | 57,425 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | StandardToken | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
2505,
2655
]
} | 57,426 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Pausable | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
} | /**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/ | NatSpecMultiLine | pause | function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
| /**
* @dev called by the owner to pause, triggers stopped state
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
513,
604
]
} | 57,427 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Pausable | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
} | /**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/ | NatSpecMultiLine | unpause | function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
| /**
* @dev called by the owner to unpause, returns to normal state
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
688,
781
]
} | 57,428 |
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | BlackList | contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded ) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
} | getBlackListStatus | function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
| /////// Getters to allow the same blacklist to be used also by other contracts (including upgraded ) /////// | NatSpecSingleLine | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
161,
290
]
} | 57,429 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | UpgradedStandardToken | contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
} | transferByLegacy | function transferByLegacy(address from, address to, uint value) public;
| // those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
173,
249
]
} | 57,430 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | Kai | function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
| // The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
498,
791
]
} | 57,431 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | transfer | function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
| // Forward ERC20 methods to upgraded contract if this one is deprecated | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
871,
1202
]
} | 57,432 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | transferFrom | function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
| // Forward ERC20 methods to upgraded contract if this one is deprecated | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
1282,
1649
]
} | 57,433 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | balanceOf | function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
| // Forward ERC20 methods to upgraded contract if this one is deprecated | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
1729,
1978
]
} | 57,434 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | approve | function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
| // Forward ERC20 methods to upgraded contract if this one is deprecated | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
2058,
2365
]
} | 57,435 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | allowance | function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
| // Forward ERC20 methods to upgraded contract if this one is deprecated | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
2445,
2743
]
} | 57,436 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | deprecate | function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
| // deprecate current contract in favour of a new one | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
2804,
2990
]
} | 57,437 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | totalSupply | function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
| // deprecate current contract if favour of a new one | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
3051,
3274
]
} | 57,438 |
||
Kai | Kai.sol | 0x9310c60a0e9f1790d77304e7cfc219c394116e12 | Solidity | Kai | contract Kai is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function Kai(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | redeem | function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
| // Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued | LineComment | v0.4.24+commit.e67f0147 | None | bzzr://51fd690a36c4cc087bcc587103e4611be5cec03aefc70f5634cd5390bbd064e4 | {
"func_code_index": [
3507,
3749
]
} | 57,439 |
||
BatchExchange | openzeppelin-solidity/contracts/utils/SafeCast.sol | 0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5 | Solidity | SafeCast | library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
} | /**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/ | NatSpecMultiLine | toUint128 | function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
| /**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/ | NatSpecMultiLine | v0.5.6+commit.b259423e | GNU GPLv3 | bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb | {
"func_code_index": [
317,
506
]
} | 57,440 |
BatchExchange | openzeppelin-solidity/contracts/utils/SafeCast.sol | 0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5 | Solidity | SafeCast | library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
} | /**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/ | NatSpecMultiLine | toUint64 | function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
| /**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/ | NatSpecMultiLine | v0.5.6+commit.b259423e | GNU GPLv3 | bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb | {
"func_code_index": [
800,
984
]
} | 57,441 |
BatchExchange | openzeppelin-solidity/contracts/utils/SafeCast.sol | 0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5 | Solidity | SafeCast | library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
} | /**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/ | NatSpecMultiLine | toUint32 | function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
| /**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/ | NatSpecMultiLine | v0.5.6+commit.b259423e | GNU GPLv3 | bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb | {
"func_code_index": [
1278,
1462
]
} | 57,442 |
BatchExchange | openzeppelin-solidity/contracts/utils/SafeCast.sol | 0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5 | Solidity | SafeCast | library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
} | /**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/ | NatSpecMultiLine | toUint16 | function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
| /**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/ | NatSpecMultiLine | v0.5.6+commit.b259423e | GNU GPLv3 | bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb | {
"func_code_index": [
1756,
1940
]
} | 57,443 |
BatchExchange | openzeppelin-solidity/contracts/utils/SafeCast.sol | 0x46f3f2f9662f66a6ddd6a8d1ddec3cd9ae5e87b5 | Solidity | SafeCast | library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
} | /**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such 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.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/ | NatSpecMultiLine | toUint8 | function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
| /**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/ | NatSpecMultiLine | v0.5.6+commit.b259423e | GNU GPLv3 | bzzr://d75d8f06b335b5c4398c51039c6bbb9a0b7d2e34f3a8a69428935ad3326899cb | {
"func_code_index": [
2231,
2410
]
} | 57,444 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
165,
238
]
} | 57,445 |
||
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
462,
544
]
} | 57,446 |
||
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
823,
911
]
} | 57,447 |
||
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
1575,
1654
]
} | 57,448 |
||
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | IERC20 | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
1967,
2069
]
} | 57,449 |
||
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
259,
445
]
} | 57,450 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
723,
864
]
} | 57,451 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
1162,
1359
]
} | 57,452 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
1613,
2089
]
} | 57,453 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
2560,
2697
]
} | 57,454 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
3188,
3471
]
} | 57,455 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
3931,
4066
]
} | 57,456 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
4546,
4717
]
} | 57,457 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | 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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | isContract | function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
| /**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
606,
1230
]
} | 57,458 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | 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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | sendValue | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-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.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
2160,
2562
]
} | 57,459 |
Burner | Burner.sol | 0x0bf09916957f3eadc1be240c6f145fd7a34bf7f2 | 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 function 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);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | 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 function 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.12+commit.27d51765 | MIT | ipfs://a6415090acf70603bf5af800aa8c4494001140989736ae14d9b1eacb4a5a1d41 | {
"func_code_index": [
3318,
3496
]
} | 57,460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.