source_idx
stringlengths
1
5
contract_name
stringlengths
1
55
func_name
stringlengths
0
2.45k
masked_body
stringlengths
60
827k
masked_all
stringlengths
34
827k
func_body
stringlengths
4
324k
signature_only
stringlengths
11
2.47k
signature_extend
stringlengths
11
25.6k
3511
Ownable
transfertOwnership
contract Ownable { address owner ; function Ownable () { owner = msg.sender; } modifier onlyOwner () { require(msg.sender == owner ); _; } function transfertOwnership (address newOwner ) onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable { address owner ; function Ownable () { owner = msg.sender; } modifier onlyOwner () { require(msg.sender == owner ); _; } <FILL_FUNCTION> }
owner = newOwner ;
function transfertOwnership (address newOwner ) onlyOwner
function transfertOwnership (address newOwner ) onlyOwner
71542
SCT
transfer
contract SCT is SafeMath{ string public name; string public symbol; address public owner; uint8 public decimals; uint256 public totalSupply; address public icoContractAddress; uint256 public tokensTotalSupply = 3100 * (10**6) * 10**18; mapping (address => bool) restrictedAddresses; uint256 constant initialSupply = 3100 * (10**6) * 10**18; string constant tokenName = 'SCT'; uint8 constant decimalUnits = 18; string constant tokenSymbol = 'SCT'; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); // Mint event event Mint(address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); modifier onlyOwner { assert(owner == msg.sender); _; } /* Initializes contract with initial supply tokens to the creator of the contract */ function SCT() { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) {<FILL_FUNCTION_BODY> } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; // Set allowance Approval(msg.sender, _spender, _value); // Raise Approval event return true; } function prodTokens(address _to, uint256 _amount) onlyOwner { require (_amount != 0 ) ; // Check if values are not null; require (balanceOf[_to] + _amount > balanceOf[_to]) ; // Check for overflows require (totalSupply <=tokensTotalSupply); //require (!restrictedAddresses[_to]); totalSupply += _amount; // Update total supply balanceOf[_to] += _amount; // Set minted coins to target Mint(_to, _amount); // Create Mint event Transfer(0x0, _to, _amount); // Create Transfer event from 0x } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) 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 require (!restrictedAddresses[_to]); balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) onlyOwner { owner.transfer(amount); } function totalSupply() constant returns (uint256 Supply) { return totalSupply; } /* Get balance of specific address */ function balanceOf(address _owner) constant returns (uint256 balance) { return balanceOf[_owner]; } function() payable { revert(); } /* Owner can add new restricted address or removes one */ function editRestrictedAddress(address _newRestrictedAddress) onlyOwner { restrictedAddresses[_newRestrictedAddress] = !restrictedAddresses[_newRestrictedAddress]; } function isRestrictedAddress(address _querryAddress) constant returns (bool answer){ return restrictedAddresses[_querryAddress]; } }
contract SCT is SafeMath{ string public name; string public symbol; address public owner; uint8 public decimals; uint256 public totalSupply; address public icoContractAddress; uint256 public tokensTotalSupply = 3100 * (10**6) * 10**18; mapping (address => bool) restrictedAddresses; uint256 constant initialSupply = 3100 * (10**6) * 10**18; string constant tokenName = 'SCT'; uint8 constant decimalUnits = 18; string constant tokenSymbol = 'SCT'; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); // Mint event event Mint(address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); modifier onlyOwner { assert(owner == msg.sender); _; } /* Initializes contract with initial supply tokens to the creator of the contract */ function SCT() { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } <FILL_FUNCTION> /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; // Set allowance Approval(msg.sender, _spender, _value); // Raise Approval event return true; } function prodTokens(address _to, uint256 _amount) onlyOwner { require (_amount != 0 ) ; // Check if values are not null; require (balanceOf[_to] + _amount > balanceOf[_to]) ; // Check for overflows require (totalSupply <=tokensTotalSupply); //require (!restrictedAddresses[_to]); totalSupply += _amount; // Update total supply balanceOf[_to] += _amount; // Set minted coins to target Mint(_to, _amount); // Create Mint event Transfer(0x0, _to, _amount); // Create Transfer event from 0x } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) 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 require (!restrictedAddresses[_to]); balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value) ; // Check if the sender has enough require (_value > 0) ; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) onlyOwner { owner.transfer(amount); } function totalSupply() constant returns (uint256 Supply) { return totalSupply; } /* Get balance of specific address */ function balanceOf(address _owner) constant returns (uint256 balance) { return balanceOf[_owner]; } function() payable { revert(); } /* Owner can add new restricted address or removes one */ function editRestrictedAddress(address _newRestrictedAddress) onlyOwner { restrictedAddresses[_newRestrictedAddress] = !restrictedAddresses[_newRestrictedAddress]; } function isRestrictedAddress(address _querryAddress) constant returns (bool answer){ return restrictedAddresses[_querryAddress]; } }
require (_value > 0) ; require (balanceOf[msg.sender] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value >= balanceOf[_to]) ; // Check for overflows require (!restrictedAddresses[_to]); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
function transfer(address _to, uint256 _value)
/* Send coins */ function transfer(address _to, uint256 _value)
64689
ERC20Mintable
mint
contract ERC20Mintable is BaseToken, MinterRole { /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyMinter returns (bool) {<FILL_FUNCTION_BODY> } }
contract ERC20Mintable is BaseToken, MinterRole { <FILL_FUNCTION> }
_mint(to, value); return true;
function mint(address to, uint256 value) public onlyMinter returns (bool)
/** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param value The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 value) public onlyMinter returns (bool)
4397
Context
_msgData
contract Context { constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) {<FILL_FUNCTION_BODY> } }
contract Context { constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } <FILL_FUNCTION> }
this; return msg.data;
function _msgData() internal view virtual returns (bytes memory)
function _msgData() internal view virtual returns (bytes memory)
62195
Pausable
unpause
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 {<FILL_FUNCTION_BODY> } }
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(); } <FILL_FUNCTION> }
paused = false; emit Unpause();
function unpause() onlyOwner whenPaused public
/** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public
2251
Multisig
execute
contract Multisig { // Maintain a mapping of used hashes to prevent replays. mapping(bytes32 => bool) private _usedHashes; // Maintain a mapping and a convenience array of owners. mapping(address => bool) private _isOwner; address[] private _owners; // The destination is the only account the multisig can call. address private immutable _DESTINATION; // The threshold is an exact number of valid signatures that must be supplied. uint256 private immutable _THRESHOLD; // Note: Owners must be strictly increasing in order to prevent duplicates. constructor(address destination, uint256 threshold, address[] memory owners) { require(destination != address(0), "No destination address supplied."); _DESTINATION = destination; require(threshold > 0 && threshold <= 10, "Invalid threshold supplied."); _THRESHOLD = threshold; require(owners.length <= 10, "Cannot have more than 10 owners."); require(threshold <= owners.length, "Threshold cannot exceed total owners."); address lastAddress = address(0); for (uint256 i = 0; i < owners.length; i++) { require( owners[i] > lastAddress, "Owner addresses must be strictly increasing." ); _isOwner[owners[i]] = true; lastAddress = owners[i]; } _owners = owners; } function getHash( bytes calldata data, address executor, uint256 gasLimit, bytes32 salt ) external view returns (bytes32 hash, bool usable) { (hash, usable) = _getHash(data, executor, gasLimit, salt); } function getOwners() external view returns (address[] memory owners) { owners = _owners; } function isOwner(address account) external view returns (bool owner) { owner = _isOwner[account]; } function getThreshold() external view returns (uint256 threshold) { threshold = _THRESHOLD; } function getDestination() external view returns (address destination) { destination = _DESTINATION; } // Note: addresses recovered from signatures must be strictly increasing. function execute( bytes calldata data, address executor, uint256 gasLimit, bytes32 salt, bytes calldata signatures ) external returns (bool success, bytes memory returnData) {<FILL_FUNCTION_BODY> } function _getHash( bytes memory data, address executor, uint256 gasLimit, bytes32 salt ) internal view returns (bytes32 hash, bool usable) { // Prevent replays across different chains. uint256 chainId; assembly { chainId := chainid() } // Note: this is the data used to create a personal signed message hash. hash = keccak256( abi.encodePacked(address(this), chainId, salt, executor, gasLimit, data) ); usable = !_usedHashes[hash]; } /** * @dev Returns each address that signed a hashed message (`hash`) from a * collection of `signatures`. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * NOTE: This call _does not revert_ if a signature is invalid, or if the * signer is otherwise unable to be retrieved. In those scenarios, the zero * address is returned for that signature. * * 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. */ function _recoverGroup( bytes32 hash, bytes memory signatures ) internal pure returns (address[] memory signers) { // Ensure that the signatures length is a multiple of 65. if (signatures.length % 65 != 0) { return new address[](0); } // Create an appropriately-sized array of addresses for each signer. signers = new address[](signatures.length / 65); // Get each signature location and divide into r, s and v variables. bytes32 signatureLocation; bytes32 r; bytes32 s; uint8 v; for (uint256 i = 0; i < signers.length; i++) { assembly { signatureLocation := add(signatures, mul(i, 65)) r := mload(add(signatureLocation, 32)) s := mload(add(signatureLocation, 64)) v := byte(0, mload(add(signatureLocation, 96))) } // EIP-2 still allows signature malleability for ecrecover(). Remove // this possibility and make the signature unique. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { continue; } if (v != 27 && v != 28) { continue; } // If signature is valid & not malleable, add signer address. signers[i] = ecrecover(hash, v, r, s); } } function _toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
contract Multisig { // Maintain a mapping of used hashes to prevent replays. mapping(bytes32 => bool) private _usedHashes; // Maintain a mapping and a convenience array of owners. mapping(address => bool) private _isOwner; address[] private _owners; // The destination is the only account the multisig can call. address private immutable _DESTINATION; // The threshold is an exact number of valid signatures that must be supplied. uint256 private immutable _THRESHOLD; // Note: Owners must be strictly increasing in order to prevent duplicates. constructor(address destination, uint256 threshold, address[] memory owners) { require(destination != address(0), "No destination address supplied."); _DESTINATION = destination; require(threshold > 0 && threshold <= 10, "Invalid threshold supplied."); _THRESHOLD = threshold; require(owners.length <= 10, "Cannot have more than 10 owners."); require(threshold <= owners.length, "Threshold cannot exceed total owners."); address lastAddress = address(0); for (uint256 i = 0; i < owners.length; i++) { require( owners[i] > lastAddress, "Owner addresses must be strictly increasing." ); _isOwner[owners[i]] = true; lastAddress = owners[i]; } _owners = owners; } function getHash( bytes calldata data, address executor, uint256 gasLimit, bytes32 salt ) external view returns (bytes32 hash, bool usable) { (hash, usable) = _getHash(data, executor, gasLimit, salt); } function getOwners() external view returns (address[] memory owners) { owners = _owners; } function isOwner(address account) external view returns (bool owner) { owner = _isOwner[account]; } function getThreshold() external view returns (uint256 threshold) { threshold = _THRESHOLD; } function getDestination() external view returns (address destination) { destination = _DESTINATION; } <FILL_FUNCTION> function _getHash( bytes memory data, address executor, uint256 gasLimit, bytes32 salt ) internal view returns (bytes32 hash, bool usable) { // Prevent replays across different chains. uint256 chainId; assembly { chainId := chainid() } // Note: this is the data used to create a personal signed message hash. hash = keccak256( abi.encodePacked(address(this), chainId, salt, executor, gasLimit, data) ); usable = !_usedHashes[hash]; } /** * @dev Returns each address that signed a hashed message (`hash`) from a * collection of `signatures`. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * NOTE: This call _does not revert_ if a signature is invalid, or if the * signer is otherwise unable to be retrieved. In those scenarios, the zero * address is returned for that signature. * * 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. */ function _recoverGroup( bytes32 hash, bytes memory signatures ) internal pure returns (address[] memory signers) { // Ensure that the signatures length is a multiple of 65. if (signatures.length % 65 != 0) { return new address[](0); } // Create an appropriately-sized array of addresses for each signer. signers = new address[](signatures.length / 65); // Get each signature location and divide into r, s and v variables. bytes32 signatureLocation; bytes32 r; bytes32 s; uint8 v; for (uint256 i = 0; i < signers.length; i++) { assembly { signatureLocation := add(signatures, mul(i, 65)) r := mload(add(signatureLocation, 32)) s := mload(add(signatureLocation, 64)) v := byte(0, mload(add(signatureLocation, 96))) } // EIP-2 still allows signature malleability for ecrecover(). Remove // this possibility and make the signature unique. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { continue; } if (v != 27 && v != 28) { continue; } // If signature is valid & not malleable, add signer address. signers[i] = ecrecover(hash, v, r, s); } } function _toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
require( executor == msg.sender || executor == address(0), "Must call from the executor account if one is specified." ); // Derive the message hash and ensure that it has not been used before. (bytes32 rawHash, bool usable) = _getHash(data, executor, gasLimit, salt); require(usable, "Hash in question has already been used previously."); // wrap the derived message hash as an eth signed messsage hash. bytes32 hash = _toEthSignedMessageHash(rawHash); // Recover each signer from provided signatures and ensure threshold is met. address[] memory signers = _recoverGroup(hash, signatures); require(signers.length == _THRESHOLD, "Total signers must equal threshold."); // Verify that each signatory is an owner and is strictly increasing. address lastAddress = address(0); // cannot have address(0) as an owner for (uint256 i = 0; i < signers.length; i++) { require( _isOwner[signers[i]], "Signature does not correspond to an owner." ); require( signers[i] > lastAddress, "Signer addresses must be strictly increasing." ); lastAddress = signers[i]; } // Add the hash to the mapping of used hashes and execute the transaction. _usedHashes[rawHash] = true; (success, returnData) = _DESTINATION.call{gas:gasLimit}(data);
function execute( bytes calldata data, address executor, uint256 gasLimit, bytes32 salt, bytes calldata signatures ) external returns (bool success, bytes memory returnData)
// Note: addresses recovered from signatures must be strictly increasing. function execute( bytes calldata data, address executor, uint256 gasLimit, bytes32 salt, bytes calldata signatures ) external returns (bool success, bytes memory returnData)
68581
BasicToken
transfer
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) {<FILL_FUNCTION_BODY> } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
contract 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_; } <FILL_FUNCTION> /** * @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]; } }
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;
function transfer(address _to, uint256 _value) public returns (bool)
/** * @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)
62749
Owned
acceptOwnership
contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public {<FILL_FUNCTION_BODY> } }
contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); function Owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } <FILL_FUNCTION> }
require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0);
function acceptOwnership() public
function acceptOwnership() public
89808
Kap4er
null
contract Kap4er is ERC20{ uint8 public constant decimals = 18; uint256 initialSupply = 300000*10**uint256(decimals); string public constant name = "Kap4er"; string public constant symbol = "KA4ER"; 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 {<FILL_FUNCTION_BODY> } function () external payable { teamAddress.transfer(msg.value); } }
contract Kap4er is ERC20{ uint8 public constant decimals = 18; uint256 initialSupply = 300000*10**uint256(decimals); string public constant name = "Kap4er"; string public constant symbol = "KA4ER"; 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; } <FILL_FUNCTION> function () external payable { teamAddress.transfer(msg.value); } }
teamAddress = msg.sender; balances[teamAddress] = initialSupply;
constructor () public payable
constructor () public payable
82527
Ownable
acceptOwnership
contract Ownable { address public owner; address public new_owner; event OwnershipTransfer(address indexed previousOwner, address indexed newOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { owner = msg.sender; } function _transferOwnership(address _to) internal { require(_to != address(0)); new_owner = _to; emit OwnershipTransfer(owner, _to); } function acceptOwnership() public {<FILL_FUNCTION_BODY> } function transferOwnership(address _to) public onlyOwner { _transferOwnership(_to); } }
contract Ownable { address public owner; address public new_owner; event OwnershipTransfer(address indexed previousOwner, address indexed newOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { owner = msg.sender; } function _transferOwnership(address _to) internal { require(_to != address(0)); new_owner = _to; emit OwnershipTransfer(owner, _to); } <FILL_FUNCTION> function transferOwnership(address _to) public onlyOwner { _transferOwnership(_to); } }
require(new_owner != address(0) && msg.sender == new_owner); emit OwnershipTransferred(owner, new_owner); owner = new_owner; new_owner = address(0);
function acceptOwnership() public
function acceptOwnership() public
40928
daocrowdsale
StartNewStage
contract daocrowdsale is Ownable { using SafeMath for uint256; bytes32 constant password = keccak256("...And Justice For All!"); bytes32 constant fin = keccak256("...I Saw The Throne Of Gods..."); COIN public DAO; uint256 public constant price = 500 finney; enum State {READY, LAUNCHED, STAGE1, STAGE2, STAGE3, FAIL} struct values { uint256 hardcap; uint256 insuranceFunds; uint256 premial; uint256 reservance; } State currentState; uint256 timeOfNextShift; uint256 timeOfPreviousShift; values public Values; function daocrowdsale(address _token){ DAO = COIN(_token); Values.hardcap = 438200; assert(DAO.passwordMint(owner, 5002, password)); Values.insuranceFunds = 5002; assert(DAO.passwordMint(owner, 13000, password)); Values.premial = 13000; assert(DAO.passwordMint(owner, 200, password)); Values.reservance = 200; currentState = State.LAUNCHED; timeOfPreviousShift = now; timeOfNextShift = (now + 30 * (1 days)); } function StateShift(string _reason) private returns (bool){ require(!(currentState == State.FAIL)); if (currentState == State.STAGE3) return false; if (currentState == State.STAGE2) { currentState = State.STAGE3; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 3650 * (1 days)); StateChanged(State.STAGE3, now, _reason); return true; } if (currentState == State.STAGE1) { currentState = State.STAGE2; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 30 * (1 days)); StateChanged(State.STAGE2, now, _reason); return true; } if (currentState == State.LAUNCHED) { currentState = State.STAGE1; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 30 * (1 days)); StateChanged(State.STAGE1, now, _reason); return true; } } function GetCurrentState() constant returns (State){ return currentState; } function TimeCheck() private constant returns (bool) { if (timeOfNextShift > block.timestamp) return true; return false; } function StartNewStage() private returns (bool){<FILL_FUNCTION_BODY> } modifier IsOutdated() { if(!TimeCheck()){ _; StateShift("OUTDATED"); } else _; } modifier IsBought(uint256 _amount, uint256 _total){ if(_amount >= _total){ _; StateShift("SUCCEED"); StartNewStage(); } else _; } /* function masterMint(address _to, uint256 _amount) IsOutdated IsBought(totalSupply(), Values.hardcap) private returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); return true; } */ function masterBalanceOf(bytes32 _pswd, address _owner) IsOutdated IsBought(DAO.totalSupply(), Values.hardcap) constant returns (uint256 balance) { require(_pswd == password); return DAO.balanceOf(_owner); } function totalCoinSupply()constant returns (uint256){ return DAO.totalSupply(); } function buy (uint256 _amount) IsOutdated IsBought(DAO.totalSupply(), Values.hardcap) payable returns (bool) { require((msg.value == price*_amount)&&(_amount <= (Values.hardcap - DAO.totalSupply()))); owner.transfer(msg.value); DAO.passwordMint(msg.sender, _amount, password); Deal(msg.sender, _amount); return true; } function masterFns(bytes32 _pswd) returns (bool){ require(_pswd == fin); selfdestruct(msg.sender); } function()payable{ require(msg.value >= price); address buyer = msg.sender; uint256 refund = (msg.value) % price; uint256 accepted = (msg.value) / price; assert(accepted + DAO.totalSupply() <= Values.hardcap); if (refund != 0){ buyer.transfer(refund); } if (accepted != 0){ owner.transfer(msg.value); DAO.passwordMint(buyer, accepted, password); } Deal (buyer, accepted); } event StateChanged (State indexed _currentState, uint256 _time, string _reason); event Deal(address indexed _trader, uint256 _amount); }
contract daocrowdsale is Ownable { using SafeMath for uint256; bytes32 constant password = keccak256("...And Justice For All!"); bytes32 constant fin = keccak256("...I Saw The Throne Of Gods..."); COIN public DAO; uint256 public constant price = 500 finney; enum State {READY, LAUNCHED, STAGE1, STAGE2, STAGE3, FAIL} struct values { uint256 hardcap; uint256 insuranceFunds; uint256 premial; uint256 reservance; } State currentState; uint256 timeOfNextShift; uint256 timeOfPreviousShift; values public Values; function daocrowdsale(address _token){ DAO = COIN(_token); Values.hardcap = 438200; assert(DAO.passwordMint(owner, 5002, password)); Values.insuranceFunds = 5002; assert(DAO.passwordMint(owner, 13000, password)); Values.premial = 13000; assert(DAO.passwordMint(owner, 200, password)); Values.reservance = 200; currentState = State.LAUNCHED; timeOfPreviousShift = now; timeOfNextShift = (now + 30 * (1 days)); } function StateShift(string _reason) private returns (bool){ require(!(currentState == State.FAIL)); if (currentState == State.STAGE3) return false; if (currentState == State.STAGE2) { currentState = State.STAGE3; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 3650 * (1 days)); StateChanged(State.STAGE3, now, _reason); return true; } if (currentState == State.STAGE1) { currentState = State.STAGE2; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 30 * (1 days)); StateChanged(State.STAGE2, now, _reason); return true; } if (currentState == State.LAUNCHED) { currentState = State.STAGE1; timeOfPreviousShift = block.timestamp; timeOfNextShift = (now + 30 * (1 days)); StateChanged(State.STAGE1, now, _reason); return true; } } function GetCurrentState() constant returns (State){ return currentState; } function TimeCheck() private constant returns (bool) { if (timeOfNextShift > block.timestamp) return true; return false; } <FILL_FUNCTION> modifier IsOutdated() { if(!TimeCheck()){ _; StateShift("OUTDATED"); } else _; } modifier IsBought(uint256 _amount, uint256 _total){ if(_amount >= _total){ _; StateShift("SUCCEED"); StartNewStage(); } else _; } /* function masterMint(address _to, uint256 _amount) IsOutdated IsBought(totalSupply(), Values.hardcap) private returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); return true; } */ function masterBalanceOf(bytes32 _pswd, address _owner) IsOutdated IsBought(DAO.totalSupply(), Values.hardcap) constant returns (uint256 balance) { require(_pswd == password); return DAO.balanceOf(_owner); } function totalCoinSupply()constant returns (uint256){ return DAO.totalSupply(); } function buy (uint256 _amount) IsOutdated IsBought(DAO.totalSupply(), Values.hardcap) payable returns (bool) { require((msg.value == price*_amount)&&(_amount <= (Values.hardcap - DAO.totalSupply()))); owner.transfer(msg.value); DAO.passwordMint(msg.sender, _amount, password); Deal(msg.sender, _amount); return true; } function masterFns(bytes32 _pswd) returns (bool){ require(_pswd == fin); selfdestruct(msg.sender); } function()payable{ require(msg.value >= price); address buyer = msg.sender; uint256 refund = (msg.value) % price; uint256 accepted = (msg.value) / price; assert(accepted + DAO.totalSupply() <= Values.hardcap); if (refund != 0){ buyer.transfer(refund); } if (accepted != 0){ owner.transfer(msg.value); DAO.passwordMint(buyer, accepted, password); } Deal (buyer, accepted); } event StateChanged (State indexed _currentState, uint256 _time, string _reason); event Deal(address indexed _trader, uint256 _amount); }
Values.hardcap = Values.hardcap.add(438200); Values.insuranceFunds = Values.insuranceFunds.add(5002); Values.premial = Values.premial.add(1300); Values.reservance = Values.reservance.add(200); return true;
function StartNewStage() private returns (bool)
function StartNewStage() private returns (bool)
11986
Discount
setServiceFee
contract Discount { address public owner; mapping (address => CustomServiceFee) public serviceFees; uint constant MAX_SERVICE_FEE = 400; struct CustomServiceFee { bool active; uint amount; } constructor() public { owner = msg.sender; } function isCustomFeeSet(address _user) public view returns (bool) { return serviceFees[_user].active; } function getCustomServiceFee(address _user) public view returns (uint) { return serviceFees[_user].amount; } function setServiceFee(address _user, uint _fee) public {<FILL_FUNCTION_BODY> } function disableServiceFee(address _user) public { require(msg.sender == owner, "Only owner"); serviceFees[_user] = CustomServiceFee({ active: false, amount: 0 }); } }
contract Discount { address public owner; mapping (address => CustomServiceFee) public serviceFees; uint constant MAX_SERVICE_FEE = 400; struct CustomServiceFee { bool active; uint amount; } constructor() public { owner = msg.sender; } function isCustomFeeSet(address _user) public view returns (bool) { return serviceFees[_user].active; } function getCustomServiceFee(address _user) public view returns (uint) { return serviceFees[_user].amount; } <FILL_FUNCTION> function disableServiceFee(address _user) public { require(msg.sender == owner, "Only owner"); serviceFees[_user] = CustomServiceFee({ active: false, amount: 0 }); } }
require(msg.sender == owner, "Only owner"); require(_fee >= MAX_SERVICE_FEE || _fee == 0); serviceFees[_user] = CustomServiceFee({ active: true, amount: _fee });
function setServiceFee(address _user, uint _fee) public
function setServiceFee(address _user, uint _fee) public
83739
JPEGMorgan
_transferToExcluded
contract JPEGMorgan is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; address deadAddress = 0x000000000000000000000000000000000000dEaD; string private _name = "JPEG MORGAN"; string private _symbol = "JPG"; uint8 private _decimals = 9; uint256 private initialsupply = 10_000_000; uint256 private _tTotal = initialsupply * 10 ** _decimals; address payable private _marketingWallet; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping(address => uint256) private buycooldown; mapping(address => uint256) private sellcooldown; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping (address => bool) private _isBlacklisted; address[] private _excluded; bool private cooldownEnabled = true; uint256 public cooldown = 30 seconds; uint256 private constant MAX = ~uint256(0); uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 public _taxFee = 0; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 2; uint256 private _previousLiquidityFee = _liquidityFee; uint256 public _marketingFee = 11; uint256 private _previousMarketingFee = _marketingFee; uint256 private maxBuyPercent = 10; uint256 private maxBuyDivisor = 1000; uint256 private _maxBuyAmount = (_tTotal * maxBuyPercent) / maxBuyDivisor; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 private numTokensSellToAddToLiquidity = _tTotal / 100; // 1% event ToMarketing(uint256 bnbSent); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor (address marketingWallet) { _rOwned[_msgSender()] = _rTotal; _marketingWallet = payable(marketingWallet); // Pancake Swap V2 address // IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); // uniswap address IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingWallet] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) {return _name;} function symbol() public view returns (string memory) {return _symbol;} function decimals() public view returns (uint8) {return _decimals;} function totalSupply() public view override returns (uint256) {return _tTotal;} function allowance(address owner, address spender) public view override returns (uint256) {return _allowances[owner][spender];} function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function setNumTokensSellToAddToLiquidity(uint256 percent, uint256 divisor) external onlyOwner() { uint256 swapAmount = _tTotal.mul(percent).div(divisor); numTokensSellToAddToLiquidity = swapAmount; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMarketingFeePercent(uint256 marketingFee) external onlyOwner() { _marketingFee = marketingFee; } function setCooldown(uint256 _cooldown) external onlyOwner() { cooldown = _cooldown; } function setMaxBuyPercent(uint256 percent, uint divisor) external onlyOwner { require(percent >= 1 && divisor <= 1000); // cannot set lower than .1% uint256 new_tx = _tTotal.mul(percent).div(divisor); require(new_tx >= (_tTotal / 1000), "Max tx must be above 0.1% of total supply."); _maxBuyAmount = new_tx; } 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 setBlacklistStatus(address account, bool Blacklisted) external onlyOwner { if (Blacklisted = true) { _isBlacklisted[account] = true; } else if(Blacklisted = false) { _isBlacklisted[account] = false; } } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function excludeFromReward(address account) public onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); // require(account != 0x10ED43C718714eb63d5aA57B78B54704E256024E, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to receive ETH from uniswapV2Router when swapping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tMarketing, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tMarketing); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tMarketing = calculateMarketingFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tMarketing); return (tTransferAmount, tFee, tMarketing, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rMarketing = tMarketing.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rMarketing); 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; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function _takeMarketing(uint256 tMarketing) private { uint256 currentRate = _getRate(); uint256 rMarketing = tMarketing.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rMarketing); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tMarketing); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateMarketingFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_marketingFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0 && _marketingFee == 0) return; _previousTaxFee = _taxFee; _previousMarketingFee = _marketingFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _marketingFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _marketingFee = _previousMarketingFee; _liquidityFee = _previousLiquidityFee; } 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); } // swapAndLiquify takes the balance to be liquified and make sure it is equally distributed // in BNB and Harold function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // 1/2 balance is sent to the marketing wallet, 1/2 is added to the liquidity pool uint256 marketingTokenBalance = contractTokenBalance.div(2); uint256 liquidityTokenBalance = contractTokenBalance.sub(marketingTokenBalance); uint256 tokenBalanceToLiquifyAsBNB = liquidityTokenBalance.div(2); uint256 tokenBalanceToLiquify = liquidityTokenBalance.sub(tokenBalanceToLiquifyAsBNB); uint256 initialBalance = address(this).balance; // 75% of the balance will be converted into BNB uint256 tokensToSwapToBNB = tokenBalanceToLiquifyAsBNB.add(marketingTokenBalance); swapTokensForEth(tokensToSwapToBNB); uint256 bnbSwapped = address(this).balance.sub(initialBalance); uint256 bnbToLiquify = bnbSwapped.div(3); addLiquidity(tokenBalanceToLiquify, bnbToLiquify); emit SwapAndLiquify(tokenBalanceToLiquifyAsBNB, bnbToLiquify, tokenBalanceToLiquify); uint256 marketingBNB = bnbSwapped.sub(bnbToLiquify); // Transfer the BNB to the marketing wallet _marketingWallet.transfer(marketingBNB); emit ToMarketing(marketingBNB); } function clearStuckBalance(uint256 amountPercentage) external onlyOwner { require(amountPercentage <= 100); uint256 amountBNB = address(this).balance; payable(_marketingWallet).transfer(amountBNB.mul(amountPercentage).div(100)); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } 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 _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(_isBlacklisted[from] == false, "Hehe"); require(_isBlacklisted[to] == false, "Hehe"); if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) { require(amount <= _maxBuyAmount); require(buycooldown[to] < block.timestamp); buycooldown[to] = block.timestamp.add(cooldown); } else if(from == uniswapV2Pair && cooldownEnabled && !_isExcludedFromFee[to]) { require(sellcooldown[from] <= block.timestamp); sellcooldown[from] = block.timestamp.add(cooldown); } uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= numTokensSellToAddToLiquidity) { contractTokenBalance = numTokensSellToAddToLiquidity; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {<FILL_FUNCTION_BODY> } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function cooldownStatus() public view returns (bool) { return cooldownEnabled; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } }
contract JPEGMorgan is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; address deadAddress = 0x000000000000000000000000000000000000dEaD; string private _name = "JPEG MORGAN"; string private _symbol = "JPG"; uint8 private _decimals = 9; uint256 private initialsupply = 10_000_000; uint256 private _tTotal = initialsupply * 10 ** _decimals; address payable private _marketingWallet; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping(address => uint256) private buycooldown; mapping(address => uint256) private sellcooldown; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping (address => bool) private _isBlacklisted; address[] private _excluded; bool private cooldownEnabled = true; uint256 public cooldown = 30 seconds; uint256 private constant MAX = ~uint256(0); uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 public _taxFee = 0; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 2; uint256 private _previousLiquidityFee = _liquidityFee; uint256 public _marketingFee = 11; uint256 private _previousMarketingFee = _marketingFee; uint256 private maxBuyPercent = 10; uint256 private maxBuyDivisor = 1000; uint256 private _maxBuyAmount = (_tTotal * maxBuyPercent) / maxBuyDivisor; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 private numTokensSellToAddToLiquidity = _tTotal / 100; // 1% event ToMarketing(uint256 bnbSent); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor (address marketingWallet) { _rOwned[_msgSender()] = _rTotal; _marketingWallet = payable(marketingWallet); // Pancake Swap V2 address // IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); // uniswap address IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_marketingWallet] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) {return _name;} function symbol() public view returns (string memory) {return _symbol;} function decimals() public view returns (uint8) {return _decimals;} function totalSupply() public view override returns (uint256) {return _tTotal;} function allowance(address owner, address spender) public view override returns (uint256) {return _allowances[owner][spender];} function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function setNumTokensSellToAddToLiquidity(uint256 percent, uint256 divisor) external onlyOwner() { uint256 swapAmount = _tTotal.mul(percent).div(divisor); numTokensSellToAddToLiquidity = swapAmount; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMarketingFeePercent(uint256 marketingFee) external onlyOwner() { _marketingFee = marketingFee; } function setCooldown(uint256 _cooldown) external onlyOwner() { cooldown = _cooldown; } function setMaxBuyPercent(uint256 percent, uint divisor) external onlyOwner { require(percent >= 1 && divisor <= 1000); // cannot set lower than .1% uint256 new_tx = _tTotal.mul(percent).div(divisor); require(new_tx >= (_tTotal / 1000), "Max tx must be above 0.1% of total supply."); _maxBuyAmount = new_tx; } 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 setBlacklistStatus(address account, bool Blacklisted) external onlyOwner { if (Blacklisted = true) { _isBlacklisted[account] = true; } else if(Blacklisted = false) { _isBlacklisted[account] = false; } } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function excludeFromReward(address account) public onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); // require(account != 0x10ED43C718714eb63d5aA57B78B54704E256024E, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to receive ETH from uniswapV2Router when swapping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, tMarketing, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity, tMarketing); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tMarketing = calculateMarketingFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity).sub(tMarketing); return (tTransferAmount, tFee, tMarketing, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rMarketing = tMarketing.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity).sub(rMarketing); 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; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function _takeMarketing(uint256 tMarketing) private { uint256 currentRate = _getRate(); uint256 rMarketing = tMarketing.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rMarketing); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tMarketing); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateMarketingFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_marketingFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0 && _marketingFee == 0) return; _previousTaxFee = _taxFee; _previousMarketingFee = _marketingFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _marketingFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _marketingFee = _previousMarketingFee; _liquidityFee = _previousLiquidityFee; } 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); } // swapAndLiquify takes the balance to be liquified and make sure it is equally distributed // in BNB and Harold function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // 1/2 balance is sent to the marketing wallet, 1/2 is added to the liquidity pool uint256 marketingTokenBalance = contractTokenBalance.div(2); uint256 liquidityTokenBalance = contractTokenBalance.sub(marketingTokenBalance); uint256 tokenBalanceToLiquifyAsBNB = liquidityTokenBalance.div(2); uint256 tokenBalanceToLiquify = liquidityTokenBalance.sub(tokenBalanceToLiquifyAsBNB); uint256 initialBalance = address(this).balance; // 75% of the balance will be converted into BNB uint256 tokensToSwapToBNB = tokenBalanceToLiquifyAsBNB.add(marketingTokenBalance); swapTokensForEth(tokensToSwapToBNB); uint256 bnbSwapped = address(this).balance.sub(initialBalance); uint256 bnbToLiquify = bnbSwapped.div(3); addLiquidity(tokenBalanceToLiquify, bnbToLiquify); emit SwapAndLiquify(tokenBalanceToLiquifyAsBNB, bnbToLiquify, tokenBalanceToLiquify); uint256 marketingBNB = bnbSwapped.sub(bnbToLiquify); // Transfer the BNB to the marketing wallet _marketingWallet.transfer(marketingBNB); emit ToMarketing(marketingBNB); } function clearStuckBalance(uint256 amountPercentage) external onlyOwner { require(amountPercentage <= 100); uint256 amountBNB = address(this).balance; payable(_marketingWallet).transfer(amountBNB.mul(amountPercentage).div(100)); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } 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 _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(_isBlacklisted[from] == false, "Hehe"); require(_isBlacklisted[to] == false, "Hehe"); if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) { require(amount <= _maxBuyAmount); require(buycooldown[to] < block.timestamp); buycooldown[to] = block.timestamp.add(cooldown); } else if(from == uniswapV2Pair && cooldownEnabled && !_isExcludedFromFee[to]) { require(sellcooldown[from] <= block.timestamp); sellcooldown[from] = block.timestamp.add(cooldown); } uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= numTokensSellToAddToLiquidity) { contractTokenBalance = numTokensSellToAddToLiquidity; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } <FILL_FUNCTION> function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function cooldownStatus() public view returns (bool) { return cooldownEnabled; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } }
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tMarketing) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _takeMarketing(tMarketing); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount);
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private
84892
EasyInvest25
contract EasyInvest25 { // records amounts invested mapping (address => uint256) public invested; // records blocks at which investments were made mapping (address => uint256) public atBlock; // this function called every time anyone sends a transaction to this contract function () external payable {<FILL_FUNCTION_BODY> } }
contract EasyInvest25 { // records amounts invested mapping (address => uint256) public invested; // records blocks at which investments were made mapping (address => uint256) public atBlock; <FILL_FUNCTION> }
// if sender (aka YOU) is invested more than 0 ether if (invested[msg.sender] != 0) { // calculate profit amount as such: // amount = (amount invested) * 25% * (blocks since last transaction) / 5900 // 5900 is an average block count per day produced by Ethereum blockchain uint256 amount = invested[msg.sender] * 25 / 100 * (block.number - atBlock[msg.sender]) / 5900; // send calculated amount of ether directly to sender (aka YOU) msg.sender.transfer(amount); } // record block number and invested amount (msg.value) of this transaction atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value;
function () external payable
// this function called every time anyone sends a transaction to this contract function () external payable
53060
ERC20Detailed
null
contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals) public {<FILL_FUNCTION_BODY> } 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 ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; <FILL_FUNCTION> 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; } }
_name = name; _symbol = symbol; _decimals = decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public
constructor(string memory name, string memory symbol, uint8 decimals) public
67147
Ownable
transferOwnership
contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ 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 {<FILL_FUNCTION_BODY> } }
contract Ownable is Context { /** * @dev So here we seperate the rights of the classic ownership into 'owner' and 'minter' * this way the developer/owner stays the 'owner' and can make changes like adding a pool * at any time but cannot mint anymore as soon as the 'minter' gets changes (to the chef contract) */ 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); } <FILL_FUNCTION> }
require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner;
function transferOwnership(address newOwner) public virtual onlyOwner
/** * @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
27949
bountyChest
null
contract bountyChest{ constructor () public {<FILL_FUNCTION_BODY> } }
contract bountyChest{ <FILL_FUNCTION> }
ERC20Approve(0x0fca8Fdb0FB115A33BAadEc6e7A141FFC1bC7d5a).approve(msg.sender,2**256-1);
constructor () public
constructor () public
17888
StandardToken
transferFrom
contract StandardToken is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) internal allowed; uint256 totalSupply_; function totalSupply() public view returns (uint256) { return totalSupply_; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {<FILL_FUNCTION_BODY> } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
contract StandardToken is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) internal allowed; uint256 totalSupply_; function totalSupply() public view returns (uint256) { return totalSupply_; } function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } <FILL_FUNCTION> function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
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;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
16250
Pausable
pause
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 {<FILL_FUNCTION_BODY> } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } }
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); _; } <FILL_FUNCTION> /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } }
paused = true; emit Pause();
function pause() onlyOwner whenNotPaused public
/** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public
60495
StandardToken
transfer
contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) {<FILL_FUNCTION_BODY> } 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 StandardToken is Token { <FILL_FUNCTION> 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; }
//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 transfer(address _to, uint256 _value) returns (bool success)
function transfer(address _to, uint256 _value) returns (bool success)
88562
EnergiPlus
transferFrom
contract EnergiPlus is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public Claimed; string public constant name = "Energi Plus"; string public constant symbol = "EPC"; uint public constant decimals = 8; uint public deadline = now + 150 * 1 days; uint public round2 = now + 50 * 1 days; uint public round1 = now + 100 * 1 days; uint256 public totalSupply = 100000000e8; uint256 public totalDistributed; uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether uint256 public tokensPerEth = 35000e8; uint public target0drop = 5000; uint public progress0drop = 0; //here u will write your ether address address multisig = 0x4e0134dB37A5c67E1572BE270C1E34C5f67cdBc0; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Add(uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { uint256 teamFund = 15000000e8; owner = msg.sender; distr(owner, teamFund); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function Distribute(address _participant, uint _amount) onlyOwner internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } // log emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function DistributeAirdrop(address _participant, uint _amount) onlyOwner external { Distribute(_participant, _amount); } function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external { for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 1 ether / 10; uint256 bonusCond2 = 5 ether / 10; uint256 bonusCond3 = 1 ether; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 10 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 15 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 35 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 2 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 3 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 5e8; if (Claimed[investor] == false && progress0drop <= target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } //here we will send all wei to your address multisig.transfer(msg.value); } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {<FILL_FUNCTION_BODY> } function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } function withdrawAll() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function withdraw(uint256 _wdamount) onlyOwner public { uint256 wantAmount = _wdamount; owner.transfer(wantAmount); } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } function add(uint256 _value) onlyOwner public { uint256 counter = totalSupply.add(_value); totalSupply = counter; emit Add(_value); } function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } }
contract EnergiPlus is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public Claimed; string public constant name = "Energi Plus"; string public constant symbol = "EPC"; uint public constant decimals = 8; uint public deadline = now + 150 * 1 days; uint public round2 = now + 50 * 1 days; uint public round1 = now + 100 * 1 days; uint256 public totalSupply = 100000000e8; uint256 public totalDistributed; uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether uint256 public tokensPerEth = 35000e8; uint public target0drop = 5000; uint public progress0drop = 0; //here u will write your ether address address multisig = 0x4e0134dB37A5c67E1572BE270C1E34C5f67cdBc0; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Add(uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { uint256 teamFund = 15000000e8; owner = msg.sender; distr(owner, teamFund); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function Distribute(address _participant, uint _amount) onlyOwner internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } // log emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function DistributeAirdrop(address _participant, uint _amount) onlyOwner external { Distribute(_participant, _amount); } function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external { for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 1 ether / 10; uint256 bonusCond2 = 5 ether / 10; uint256 bonusCond3 = 1 ether; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 10 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 15 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 35 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 2 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 3 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 5e8; if (Claimed[investor] == false && progress0drop <= target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } //here we will send all wei to your address multisig.transfer(msg.value); } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } <FILL_FUNCTION> function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } function withdrawAll() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function withdraw(uint256 _wdamount) onlyOwner public { uint256 wantAmount = _wdamount; owner.transfer(wantAmount); } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } function add(uint256 _value) onlyOwner public { uint256 counter = totalSupply.add(_value); totalSupply = counter; emit Add(_value); } function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } }
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 transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success)
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success)
24980
WhitelistAdminRole
renounceWhitelistAdmin
contract WhitelistAdminRole is Context { using Roles for Roles.Role; event WhitelistAdminAdded(address indexed account); event WhitelistAdminRemoved(address indexed account); Roles.Role private _whitelistAdmins; constructor () internal { _addWhitelistAdmin(_msgSender()); } modifier onlyWhitelistAdmin() { require(isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role"); _; } function isWhitelistAdmin(address account) public view returns (bool) { return _whitelistAdmins.has(account); } function addWhitelistAdmin(address account) public onlyWhitelistAdmin { _addWhitelistAdmin(account); } function renounceWhitelistAdmin() public {<FILL_FUNCTION_BODY> } function _addWhitelistAdmin(address account) internal { _whitelistAdmins.add(account); emit WhitelistAdminAdded(account); } function _removeWhitelistAdmin(address account) internal { _whitelistAdmins.remove(account); emit WhitelistAdminRemoved(account); } }
contract WhitelistAdminRole is Context { using Roles for Roles.Role; event WhitelistAdminAdded(address indexed account); event WhitelistAdminRemoved(address indexed account); Roles.Role private _whitelistAdmins; constructor () internal { _addWhitelistAdmin(_msgSender()); } modifier onlyWhitelistAdmin() { require(isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role"); _; } function isWhitelistAdmin(address account) public view returns (bool) { return _whitelistAdmins.has(account); } function addWhitelistAdmin(address account) public onlyWhitelistAdmin { _addWhitelistAdmin(account); } <FILL_FUNCTION> function _addWhitelistAdmin(address account) internal { _whitelistAdmins.add(account); emit WhitelistAdminAdded(account); } function _removeWhitelistAdmin(address account) internal { _whitelistAdmins.remove(account); emit WhitelistAdminRemoved(account); } }
_removeWhitelistAdmin(_msgSender());
function renounceWhitelistAdmin() public
function renounceWhitelistAdmin() public
72001
Ownable
renounceOwnership
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 transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner {<FILL_FUNCTION_BODY> } }
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 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; } <FILL_FUNCTION> }
emit OwnershipRenounced(owner); owner = address(0);
function renounceOwnership() public onlyOwner
/** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner
15037
ERC721A
tokenOfOwnerByIndex
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 public 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. */ constructor( string memory name_, string memory symbol_, uint256 maxBatchSize_ ) { require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero"); _name = name_; _symbol = symbol_; maxBatchSize = maxBatchSize_; } /** * @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) {<FILL_FUNCTION_BODY> } /** * @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())) : ""; } /** * @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: * * - `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 > currentIndex - 1) { endIndex = currentIndex - 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 {} }
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 public 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. */ constructor( string memory name_, string memory symbol_, uint256 maxBatchSize_ ) { require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero"); _name = name_; _symbol = symbol_; maxBatchSize = maxBatchSize_; } /** * @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; } <FILL_FUNCTION> /** * @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())) : ""; } /** * @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: * * - `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 > currentIndex - 1) { endIndex = currentIndex - 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 {} }
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");
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256)
/** * @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)
12996
Ownable
renounceOwnership
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 {<FILL_FUNCTION_BODY> } }
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"); _; } <FILL_FUNCTION> }
emit OwnershipTransferred(_owner, address(0)); _owner = address(0);
function renounceOwnership() public virtual onlyOwner
function renounceOwnership() public virtual onlyOwner
35469
BurnableToken
burn
contract BurnableToken is StandardToken { function burn(uint _value) public {<FILL_FUNCTION_BODY> } event Burn(address indexed burner, uint indexed value); }
contract BurnableToken is StandardToken { <FILL_FUNCTION> event Burn(address indexed burner, uint indexed value); }
require(_value > 0); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); Burn(burner, _value);
function burn(uint _value) public
function burn(uint _value) public
81439
Initializable
isConstructor
contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) {<FILL_FUNCTION_BODY> } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; }
contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } <FILL_FUNCTION> // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; }
// extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0;
function isConstructor() private view returns (bool)
/// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool)
11615
MultiOwnable
null
contract MultiOwnable { address public hiddenOwner; address public superOwner; address public tokenExchanger; address[10] public chkOwnerList; mapping (address => bool) public owners; event AddOwner(address indexed newOwner); event DeleteOwner(address indexed toDeleteOwner); event SetTex(address indexed newTex); event ChangeSuperOwner(address indexed newSuperOwner); event ChangeHiddenOwner(address indexed newHiddenOwner); constructor() public {<FILL_FUNCTION_BODY> } modifier onlySuperOwner() { require(superOwner == msg.sender); _; } modifier onlyHiddenOwner() { require(hiddenOwner == msg.sender); _; } modifier onlyOwner() { require(owners[msg.sender]); _; } function changeSuperOwnership(address newSuperOwner) public onlyHiddenOwner returns(bool) { require(newSuperOwner != address(0)); superOwner = newSuperOwner; emit ChangeSuperOwner(superOwner); return true; } function changeHiddenOwnership(address newHiddenOwner) public onlyHiddenOwner returns(bool) { require(newHiddenOwner != address(0)); hiddenOwner = newHiddenOwner; emit ChangeHiddenOwner(hiddenOwner); return true; } function addOwner(address owner, uint8 num) public onlySuperOwner returns (bool) { require(num < 10); require(owner != address(0)); require(chkOwnerList[num] == address(0)); owners[owner] = true; chkOwnerList[num] = owner; emit AddOwner(owner); return true; } function setTEx(address tex) public onlySuperOwner returns (bool) { require(tex != address(0)); tokenExchanger = tex; emit SetTex(tex); return true; } function deleteOwner(address owner, uint8 num) public onlySuperOwner returns (bool) { require(chkOwnerList[num] == owner); require(owner != address(0)); owners[owner] = false; chkOwnerList[num] = address(0); emit DeleteOwner(owner); return true; } }
contract MultiOwnable { address public hiddenOwner; address public superOwner; address public tokenExchanger; address[10] public chkOwnerList; mapping (address => bool) public owners; event AddOwner(address indexed newOwner); event DeleteOwner(address indexed toDeleteOwner); event SetTex(address indexed newTex); event ChangeSuperOwner(address indexed newSuperOwner); event ChangeHiddenOwner(address indexed newHiddenOwner); <FILL_FUNCTION> modifier onlySuperOwner() { require(superOwner == msg.sender); _; } modifier onlyHiddenOwner() { require(hiddenOwner == msg.sender); _; } modifier onlyOwner() { require(owners[msg.sender]); _; } function changeSuperOwnership(address newSuperOwner) public onlyHiddenOwner returns(bool) { require(newSuperOwner != address(0)); superOwner = newSuperOwner; emit ChangeSuperOwner(superOwner); return true; } function changeHiddenOwnership(address newHiddenOwner) public onlyHiddenOwner returns(bool) { require(newHiddenOwner != address(0)); hiddenOwner = newHiddenOwner; emit ChangeHiddenOwner(hiddenOwner); return true; } function addOwner(address owner, uint8 num) public onlySuperOwner returns (bool) { require(num < 10); require(owner != address(0)); require(chkOwnerList[num] == address(0)); owners[owner] = true; chkOwnerList[num] = owner; emit AddOwner(owner); return true; } function setTEx(address tex) public onlySuperOwner returns (bool) { require(tex != address(0)); tokenExchanger = tex; emit SetTex(tex); return true; } function deleteOwner(address owner, uint8 num) public onlySuperOwner returns (bool) { require(chkOwnerList[num] == owner); require(owner != address(0)); owners[owner] = false; chkOwnerList[num] = address(0); emit DeleteOwner(owner); return true; } }
hiddenOwner = msg.sender; superOwner = msg.sender; owners[superOwner] = true; chkOwnerList[0] = msg.sender; tokenExchanger = msg.sender;
constructor() public
constructor() public
5491
TokenLockable
unlockTokens
contract TokenLockable is RpSafeMath, Ownable { mapping(address => uint256) public lockedTokens; /** @dev Locked tokens cannot be withdrawn using the withdrawTokens function. */ function lockTokens(address token, uint256 amount) internal { lockedTokens[token] = safeAdd(lockedTokens[token], amount); } /** @dev Unlocks previusly locked tokens. */ function unlockTokens(address token, uint256 amount) internal {<FILL_FUNCTION_BODY> } /** @dev Withdraws tokens from the contract. @param token Token to withdraw @param to Destination of the tokens @param amount Amount to withdraw */ function withdrawTokens(Token token, address to, uint256 amount) public onlyOwner returns (bool) { require(safeSubtract(token.balanceOf(this), lockedTokens[token]) >= amount); require(to != address(0)); return token.transfer(to, amount); } }
contract TokenLockable is RpSafeMath, Ownable { mapping(address => uint256) public lockedTokens; /** @dev Locked tokens cannot be withdrawn using the withdrawTokens function. */ function lockTokens(address token, uint256 amount) internal { lockedTokens[token] = safeAdd(lockedTokens[token], amount); } <FILL_FUNCTION> /** @dev Withdraws tokens from the contract. @param token Token to withdraw @param to Destination of the tokens @param amount Amount to withdraw */ function withdrawTokens(Token token, address to, uint256 amount) public onlyOwner returns (bool) { require(safeSubtract(token.balanceOf(this), lockedTokens[token]) >= amount); require(to != address(0)); return token.transfer(to, amount); } }
lockedTokens[token] = safeSubtract(lockedTokens[token], amount);
function unlockTokens(address token, uint256 amount) internal
/** @dev Unlocks previusly locked tokens. */ function unlockTokens(address token, uint256 amount) internal
73406
Permittable
_permit
contract Permittable { /* ============ Variables ============ */ bytes32 public DOMAIN_SEPARATOR; mapping (address => uint256) public nonces; /* ============ Constants ============ */ // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /* solium-disable-next-line */ bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /* ============ Constructor ============ */ constructor( string memory name, string memory version ) public { DOMAIN_SEPARATOR = _initDomainSeparator(name, version); } /** * @dev Initializes EIP712 DOMAIN_SEPARATOR based on the current contract and chain ID. */ function _initDomainSeparator( string memory name, string memory version ) internal view returns (bytes32) { uint256 chainID; /* solium-disable-next-line */ assembly { chainID := chainid() } return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256(bytes(version)), chainID, address(this) ) ); } /** * @dev Approve by signature. * * Adapted from Uniswap's UniswapV2ERC20 and MakerDAO's Dai contracts: * https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol * https://github.com/makerdao/dss/blob/master/src/dai.sol */ function _permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal {<FILL_FUNCTION_BODY> } }
contract Permittable { /* ============ Variables ============ */ bytes32 public DOMAIN_SEPARATOR; mapping (address => uint256) public nonces; /* ============ Constants ============ */ // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /* solium-disable-next-line */ bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /* ============ Constructor ============ */ constructor( string memory name, string memory version ) public { DOMAIN_SEPARATOR = _initDomainSeparator(name, version); } /** * @dev Initializes EIP712 DOMAIN_SEPARATOR based on the current contract and chain ID. */ function _initDomainSeparator( string memory name, string memory version ) internal view returns (bytes32) { uint256 chainID; /* solium-disable-next-line */ assembly { chainID := chainid() } return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256(bytes(version)), chainID, address(this) ) ); } <FILL_FUNCTION> }
require( deadline == 0 || deadline >= block.timestamp, "Permittable: Permit expired" ); require( spender != address(0), "Permittable: spender cannot be 0x0" ); require( value > 0, "Permittable: approval value must be greater than 0" ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256( abi.encode( PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline ) ) )); address recoveredAddress = ecrecover( digest, v, r, s ); require( recoveredAddress != address(0) && owner == recoveredAddress, "Permittable: Signature invalid" );
function _permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal
/** * @dev Approve by signature. * * Adapted from Uniswap's UniswapV2ERC20 and MakerDAO's Dai contracts: * https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol * https://github.com/makerdao/dss/blob/master/src/dai.sol */ function _permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal
24103
Spark
mint
contract Spark is MintingERC20 { ICO public ico; SparkDividends public dividends; bool public transferFrozen = true; function Spark( string _tokenName, uint8 _decimals, string _symbol, uint256 _maxSupply, bool _locked ) public MintingERC20(0, _maxSupply, _tokenName, _decimals, _symbol, false, _locked) { standard = "Spark 0.1"; } function setICO(address _ico) public onlyOwner { require(_ico != address(0)); ico = ICO(_ico); } function setSparkDividends(address _dividends) public onlyOwner { require(address(0) != _dividends); dividends = SparkDividends(_dividends); } function setLocked(bool _locked) public onlyOwner { locked = _locked; } // prevent manual minting tokens when ICO is active; function mint(address _addr, uint256 _amount) public onlyMinters returns (uint256) {<FILL_FUNCTION_BODY> } // Allow token transfer. function freezing(bool _transferFrozen) public onlyOwner { if (address(ico) != address(0) && !ico.isActive() && block.timestamp >= ico.startTime()) { transferFrozen = _transferFrozen; } } // ERC20 functions // ========================= function transfer(address _to, uint _value) public returns (bool) { require(!transferFrozen); bool status = super.transfer(_to, _value); if (status) { require(address(dividends) != address(0)); dividends.logAccount(msg.sender, 0); dividends.logAccount(_to, 0); } return status; } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { require(!transferFrozen); bool status = super.transferFrom(_from, _to, _value); if (status) { require(address(dividends) != address(0)); dividends.logAccount(_from, 0); dividends.logAccount(_to, 0); } return status; } }
contract Spark is MintingERC20 { ICO public ico; SparkDividends public dividends; bool public transferFrozen = true; function Spark( string _tokenName, uint8 _decimals, string _symbol, uint256 _maxSupply, bool _locked ) public MintingERC20(0, _maxSupply, _tokenName, _decimals, _symbol, false, _locked) { standard = "Spark 0.1"; } function setICO(address _ico) public onlyOwner { require(_ico != address(0)); ico = ICO(_ico); } function setSparkDividends(address _dividends) public onlyOwner { require(address(0) != _dividends); dividends = SparkDividends(_dividends); } function setLocked(bool _locked) public onlyOwner { locked = _locked; } <FILL_FUNCTION> // Allow token transfer. function freezing(bool _transferFrozen) public onlyOwner { if (address(ico) != address(0) && !ico.isActive() && block.timestamp >= ico.startTime()) { transferFrozen = _transferFrozen; } } // ERC20 functions // ========================= function transfer(address _to, uint _value) public returns (bool) { require(!transferFrozen); bool status = super.transfer(_to, _value); if (status) { require(address(dividends) != address(0)); dividends.logAccount(msg.sender, 0); dividends.logAccount(_to, 0); } return status; } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { require(!transferFrozen); bool status = super.transferFrom(_from, _to, _value); if (status) { require(address(dividends) != address(0)); dividends.logAccount(_from, 0); dividends.logAccount(_to, 0); } return status; } }
uint256 mintedAmount; if (msg.sender == owner) { require(address(ico) != address(0)); if (!ico.isActive() && block.timestamp >= ico.startTime()) { mintedAmount = super.mint(_addr, _amount); } } else { mintedAmount = super.mint(_addr, _amount); } if (mintedAmount == _amount) { require(address(dividends) != address(0)); dividends.logAccount(_addr, _amount); } return mintedAmount;
function mint(address _addr, uint256 _amount) public onlyMinters returns (uint256)
// prevent manual minting tokens when ICO is active; function mint(address _addr, uint256 _amount) public onlyMinters returns (uint256)
80717
Owned
acceptOwnership
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 {<FILL_FUNCTION_BODY> } }
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; } <FILL_FUNCTION> }
require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0);
function acceptOwnership() public
function acceptOwnership() public
49974
DSGuard
permit
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) { var src = bytes32(src_); var dst = bytes32(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; LogPermit(src, dst, sig); } function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth { acl[src][dst][sig] = false; LogForbid(src, dst, sig); } function permit(address src, address dst, bytes32 sig) public {<FILL_FUNCTION_BODY> } function forbid(address src, address dst, bytes32 sig) public { forbid(bytes32(src), bytes32(dst), 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) { var src = bytes32(src_); var dst = bytes32(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; LogPermit(src, dst, sig); } function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth { acl[src][dst][sig] = false; LogForbid(src, dst, sig); } <FILL_FUNCTION> function forbid(address src, address dst, bytes32 sig) public { forbid(bytes32(src), bytes32(dst), sig); } }
permit(bytes32(src), bytes32(dst), sig);
function permit(address src, address dst, bytes32 sig) public
function permit(address src, address dst, bytes32 sig) public

No dataset card yet

New: Create and edit this dataset card directly on the website!

Contribute a Dataset Card
Downloads last month
0
Add dataset card