contract_name
stringlengths 1
61
| file_path
stringlengths 5
50.4k
| contract_address
stringlengths 42
42
| language
stringclasses 1
value | class_name
stringlengths 1
61
| class_code
stringlengths 4
330k
| class_documentation
stringlengths 0
29.1k
| class_documentation_type
stringclasses 6
values | func_name
stringlengths 0
62
| func_code
stringlengths 1
303k
| func_documentation
stringlengths 2
14.9k
| func_documentation_type
stringclasses 4
values | compiler_version
stringlengths 15
42
| license_type
stringclasses 14
values | swarm_source
stringlengths 0
71
| meta
dict | __index_level_0__
int64 0
60.4k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
237,
310
]
} | 1,600 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
534,
616
]
} | 1,601 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
895,
983
]
} | 1,602 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1647,
1726
]
} | 1,603 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burn(uint256 amount) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
2039,
2141
]
} | 1,604 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Initializable | 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) {
// 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;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
} | /**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/ | NatSpecMultiLine | isConstructor | function isConstructor() private view returns (bool) {
// 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;
}
| /// @dev Returns true if and only if the function is running in the constructor | NatSpecSingleLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
782,
1293
]
} | 1,605 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | ContextUpgradeSafe | contract ContextUpgradeSafe is Initializable {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
uint256[50] private __gap;
} | /*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/ | Comment | __Context_init | function __Context_init() internal initializer {
__Context_init_unchained();
}
| // Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance. | LineComment | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
206,
303
]
} | 1,606 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | __Ownable_init | function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
| /**
* @dev Initializes the contract setting the deployer as the initial owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
292,
426
]
} | 1,607 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
714,
798
]
} | 1,608 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1356,
1509
]
} | 1,609 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | OwnableUpgradeSafe | contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
} | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1659,
1908
]
} | 1,610 |
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Unbonded | contract Unbonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public communityAddress;
uint public constant PRIVATE_POOL = 10000000 * decMul;
uint public constant COMMUNITY_POOL = 12000000 * decMul;
uint public currentPrivatePool = PRIVATE_POOL;
uint public currentCommunityPool = COMMUNITY_POOL;
IERC20 public token;
mapping(address => uint) public privateWhitelist;
constructor(address _communityAddress) public {
__Ownable_init_unchained();
communityAddress = _communityAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
/**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/
function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
} | setTokenContract | function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
| /**
* @dev Sets the Plutus ERC-20 token contract address
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
843,
962
]
} | 1,611 |
||
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Unbonded | contract Unbonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public communityAddress;
uint public constant PRIVATE_POOL = 10000000 * decMul;
uint public constant COMMUNITY_POOL = 12000000 * decMul;
uint public currentPrivatePool = PRIVATE_POOL;
uint public currentCommunityPool = COMMUNITY_POOL;
IERC20 public token;
mapping(address => uint) public privateWhitelist;
constructor(address _communityAddress) public {
__Ownable_init_unchained();
communityAddress = _communityAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
/**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/
function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
} | setTGE | function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
| /**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1097,
1221
]
} | 1,612 |
||
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Unbonded | contract Unbonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public communityAddress;
uint public constant PRIVATE_POOL = 10000000 * decMul;
uint public constant COMMUNITY_POOL = 12000000 * decMul;
uint public currentPrivatePool = PRIVATE_POOL;
uint public currentCommunityPool = COMMUNITY_POOL;
IERC20 public token;
mapping(address => uint) public privateWhitelist;
constructor(address _communityAddress) public {
__Ownable_init_unchained();
communityAddress = _communityAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
/**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/
function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
} | addToWhitelist | function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
| /**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1401,
1722
]
} | 1,613 |
||
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Unbonded | contract Unbonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public communityAddress;
uint public constant PRIVATE_POOL = 10000000 * decMul;
uint public constant COMMUNITY_POOL = 12000000 * decMul;
uint public currentPrivatePool = PRIVATE_POOL;
uint public currentCommunityPool = COMMUNITY_POOL;
IERC20 public token;
mapping(address => uint) public privateWhitelist;
constructor(address _communityAddress) public {
__Ownable_init_unchained();
communityAddress = _communityAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
/**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/
function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
} | claimPrivateTokens | function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
| /**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
1930,
2437
]
} | 1,614 |
||
Unbonded | Unbonded.sol | 0x833bed908817dad9c93a52ca21040afa33da9a56 | Solidity | Unbonded | contract Unbonded is OwnableUpgradeSafe {
using SafeMath for uint256;
uint public TGE;
uint public constant month = 30 days;
uint constant decimals = 18;
uint constant decMul = uint(10) ** decimals;
address public communityAddress;
uint public constant PRIVATE_POOL = 10000000 * decMul;
uint public constant COMMUNITY_POOL = 12000000 * decMul;
uint public currentPrivatePool = PRIVATE_POOL;
uint public currentCommunityPool = COMMUNITY_POOL;
IERC20 public token;
mapping(address => uint) public privateWhitelist;
constructor(address _communityAddress) public {
__Ownable_init_unchained();
communityAddress = _communityAddress;
}
/**
* @dev Sets the Plutus ERC-20 token contract address
*/
function setTokenContract(address _tokenAddress) public onlyOwner {
token = IERC20(_tokenAddress);
}
/**
* @dev Sets the current TGE from where the vesting period will be counted. Can be used only if TGE is zero.
*/
function setTGE() public onlyOwner {
require(TGE == 0, "TGE has already been set");
TGE = now;
}
/**
* @dev Sets each address from `addresses` as the key and each balance
* from `balances` to the privateWhitelist. Can be used only by an owner.
*/
function addToWhitelist(address[] memory addresses, uint[] memory balances) public onlyOwner {
require(addresses.length == balances.length, "Invalid request length");
for(uint i = 0; i < addresses.length; i++) {
privateWhitelist[addresses[i]] = balances[i];
}
}
/**
* @dev claim private tokens from the contract balance.
* `amount` means how many tokens must be claimed.
* Can be used only by an owner or by any whitelisted person
*/
function claimPrivateTokens(uint amount) public {
require(privateWhitelist[msg.sender] > 0, "Sender is not whitelisted");
require(privateWhitelist[msg.sender] >= amount, "Exceeded token amount");
require(currentPrivatePool >= amount, "Exceeded private pool");
currentPrivatePool = currentPrivatePool.sub(amount);
privateWhitelist[msg.sender] = privateWhitelist[msg.sender].sub(amount);
token.transfer(msg.sender, amount);
}
/**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/
function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
} | claimCommunityTokens | function claimCommunityTokens() public {
require(msg.sender == communityAddress || msg.sender == owner(), "Unauthorised sender");
require(TGE > 0, "TGE must be set");
// No vesting period
uint amount = 0;
if (now >= TGE && currentCommunityPool == COMMUNITY_POOL) {
currentCommunityPool -= 4800000*decMul;
amount += 4800000*decMul;
}
if (now >= TGE + 1*month && currentCommunityPool == COMMUNITY_POOL - 4800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 2*month && currentCommunityPool == COMMUNITY_POOL - 6000000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 3*month && currentCommunityPool == COMMUNITY_POOL - 7200000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 4*month && currentCommunityPool == COMMUNITY_POOL - 8400000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 5*month && currentCommunityPool == COMMUNITY_POOL - 9600000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
if (now >= TGE + 6*month && currentCommunityPool == COMMUNITY_POOL - 10800000*decMul) {
currentCommunityPool -= 1200000*decMul;
amount += 1200000*decMul;
}
// 25% each 6 months
require(amount > 0, "nothing to claim");
token.transfer(communityAddress, amount);
}
| /**
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress
*/ | NatSpecMultiLine | v0.6.11+commit.5ef660b1 | None | ipfs://c271b942d941496cfa53d8ea0c4fc9079e4e7144ff292e1bc898ad6e3434b201 | {
"func_code_index": [
2587,
4422
]
} | 1,615 |
||
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
268,
659
]
} | 1,616 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
865,
977
]
} | 1,617 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | Ico | function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
| /**
* ICO constructor
* Define ICO details and contribution period
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
1873,
2499
]
} | 1,618 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | participate | function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
| /**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
3067,
3802
]
} | 1,619 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | function () external payable {
participate(msg.sender);
}
| /**
*
* We fallback to the partcipate function
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
3870,
3939
]
} | 1,620 |
||
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | freeze | function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
| /**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
4068,
4614
]
} | 1,621 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | reportProfit | function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
| /**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
4772,
5439
]
} | 1,622 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | addNewDividends | function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
| /**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
5996,
6837
]
} | 1,623 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | liquidate | function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
| /**
* Withdraw all funds and kill fund smart contract
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
6908,
6995
]
} | 1,624 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | getOwedDividend | function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
| // getter to retrieve divident owed | LineComment | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
7039,
8528
]
} | 1,625 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | balanceOf | function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
| // monkey patches | LineComment | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
8552,
8754
]
} | 1,626 |
|
Ico | Ico.sol | 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 | Solidity | Ico | contract Ico is BasicToken {
address owner;
uint256 public teamNum;
mapping(address => bool) team;
// expose these for ERC20 tools
string public constant name = "LUNA";
string public constant symbol = "LUNA";
uint8 public constant decimals = 18;
// Significant digits tokenPrecision
uint256 private constant tokenPrecision = 10e17;
// TODO: set this final, this equates to an amount
// in dollars.
uint256 public constant hardCap = 32000 * tokenPrecision;
// Tokens frozen supply
uint256 public tokensFrozen = 0;
uint256 public tokenValue = 1 * tokenPrecision;
// struct representing a dividends snapshot
struct DividendSnapshot {
uint256 totalSupply;
uint256 dividendsIssued;
uint256 managementDividends;
}
// An array of all the DividendSnapshot so far
DividendSnapshot[] dividendSnapshots;
// Mapping of user to the index of the last dividend that was awarded to zhie
mapping(address => uint256) lastDividend;
// Management fees share express as 100/%: eg. 20% => 100/20 = 5
uint256 public constant managementFees = 10;
// Assets under management in USD
uint256 public aum = 0;
// number of tokens investors will receive per eth invested
uint256 public tokensPerEth;
// Ico start/end timestamps, between which (inclusively) investments are accepted
uint public icoStart;
uint public icoEnd;
// drip percent in 100 / percentage
uint256 public dripRate = 50;
// current registred change address
address public currentSaleAddress;
// custom events
event Freeze(address indexed from, uint256 value);
event Participate(address indexed from, uint256 value);
event Reconcile(address indexed from, uint256 period, uint256 value);
/**
* ICO constructor
* Define ICO details and contribution period
*/
function Ico(uint256 _icoStart, uint256 _icoEnd, address[] _team, uint256 _tokensPerEth) public {
// require (_icoStart >= now);
require (_icoEnd >= _icoStart);
require (_tokensPerEth > 0);
owner = msg.sender;
icoStart = _icoStart;
icoEnd = _icoEnd;
tokensPerEth = _tokensPerEth;
// initialize the team mapping with true when part of the team
teamNum = _team.length;
for (uint256 i = 0; i < teamNum; i++) {
team[_team[i]] = true;
}
// as a safety measure tempory set the sale address to something else than 0x0
currentSaleAddress = owner;
}
/**
* Modifiers
*/
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
modifier onlyTeam() {
require (team[msg.sender] == true);
_;
}
modifier onlySaleAddress() {
require (msg.sender == currentSaleAddress);
_;
}
/**
*
* Function allowing investors to participate in the ICO.
* Specifying the beneficiary will change who will receive the tokens.
* Fund tokens will be distributed based on amount of ETH sent by investor, and calculated
* using tokensPerEth value.
*/
function participate(address beneficiary) public payable {
require (beneficiary != address(0));
require (now >= icoStart && now <= icoEnd);
require (msg.value > 0);
uint256 ethAmount = msg.value;
uint256 numTokens = ethAmount.mul(tokensPerEth);
require(totalSupply.add(numTokens) <= hardCap);
balances[beneficiary] = balances[beneficiary].add(numTokens);
totalSupply = totalSupply.add(numTokens);
tokensFrozen = totalSupply * 2;
aum = totalSupply;
owner.transfer(ethAmount);
// Our own custom event to monitor ICO participation
Participate(beneficiary, numTokens);
// Let ERC20 tools know of token hodlers
Transfer(0x0, beneficiary, numTokens);
}
/**
*
* We fallback to the partcipate function
*/
function () external payable {
participate(msg.sender);
}
/**
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn.
*/
function freeze(uint256 _amount) public onlySaleAddress returns (bool) {
reconcileDividend(msg.sender);
require(_amount <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
tokensFrozen = tokensFrozen.add(_amount);
aum = aum.sub(tokenValue.mul(_amount).div(tokenPrecision));
Freeze(msg.sender, _amount);
Transfer(msg.sender, 0x0, _amount);
return true;
}
/**
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD.
*/
function reportProfit(int256 totalProfit, address saleAddress) public onlyTeam returns (bool) {
// first we new dividends if this period was profitable
if (totalProfit > 0) {
// We only care about 50% of this, as the rest is reinvested right away
uint256 profit = uint256(totalProfit).mul(tokenPrecision).div(2);
// this will throw if there are not enough tokens
addNewDividends(profit);
}
// then we drip
drip(saleAddress);
// adjust AUM
aum = aum.add(uint256(totalProfit).mul(tokenPrecision));
// register the sale address
currentSaleAddress = saleAddress;
return true;
}
function drip(address saleAddress) internal {
uint256 dripTokens = tokensFrozen.div(dripRate);
tokensFrozen = tokensFrozen.sub(dripTokens);
totalSupply = totalSupply.add(dripTokens);
aum = aum.add(tokenValue.mul(dripTokens).div(tokenPrecision));
reconcileDividend(saleAddress);
balances[saleAddress] = balances[saleAddress].add(dripTokens);
Transfer(0x0, saleAddress, dripTokens);
}
/**
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision).
*/
function addNewDividends(uint256 profit) internal {
uint256 newAum = aum.add(profit); // 18 sig digits
tokenValue = newAum.mul(tokenPrecision).div(totalSupply); // 18 sig digits
uint256 totalDividends = profit.mul(tokenPrecision).div(tokenValue); // 18 sig digits
uint256 managementDividends = totalDividends.div(managementFees); // 17 sig digits
uint256 dividendsIssued = totalDividends.sub(managementDividends); // 18 sig digits
// make sure we have enough in the frozen fund
require(tokensFrozen >= totalDividends);
dividendSnapshots.push(DividendSnapshot(totalSupply, dividendsIssued, managementDividends));
// add the previous amount of given dividends to the totalSupply
totalSupply = totalSupply.add(totalDividends);
tokensFrozen = tokensFrozen.sub(totalDividends);
}
/**
* Withdraw all funds and kill fund smart contract
*/
function liquidate() public onlyTeam returns (bool) {
selfdestruct(owner);
}
// getter to retrieve divident owed
function getOwedDividend(address _owner) public view returns (uint256 total, uint256[]) {
uint256[] memory noDividends = new uint256[](0);
// And the address' current balance
uint256 balance = BasicToken.balanceOf(_owner);
// retrieve index of last dividend this address received
// NOTE: the default return value of a mapping is 0 in this case
uint idx = lastDividend[_owner];
if (idx == dividendSnapshots.length) return (total, noDividends);
if (balance == 0 && team[_owner] != true) return (total, noDividends);
uint256[] memory dividends = new uint256[](dividendSnapshots.length - idx - i);
uint256 currBalance = balance;
for (uint i = idx; i < dividendSnapshots.length; i++) {
// We should be able to remove the .mul(tokenPrecision) and .div(tokenPrecision) and apply them once
// at the beginning and once at the end, but we need to math it out
uint256 dividend = currBalance.mul(tokenPrecision).div(dividendSnapshots[i].totalSupply).mul(dividendSnapshots[i].dividendsIssued).div(tokenPrecision);
// Add the management dividends in equal parts if the current address is part of the team
if (team[_owner] == true) {
dividend = dividend.add(dividendSnapshots[i].managementDividends.div(teamNum));
}
total = total.add(dividend);
dividends[i - idx] = dividend;
currBalance = currBalance.add(dividend);
}
return (total, dividends);
}
// monkey patches
function balanceOf(address _owner) public view returns (uint256) {
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
}
// Reconcile all outstanding dividends for an address
// into its balance.
function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
reconcileDividend(msg.sender);
reconcileDividend(_to);
return BasicToken.transfer(_to, _amount);
}
} | // NOTE: BasicToken only has partial ERC20 support | LineComment | reconcileDividend | function reconcileDividend(address _owner) internal {
var (owedDividend, dividends) = getOwedDividend(_owner);
for (uint i = 0; i < dividends.length; i++) {
if (dividends[i] > 0) {
Reconcile(_owner, lastDividend[_owner] + i, dividends[i]);
Transfer(0x0, _owner, dividends[i]);
}
}
if(owedDividend > 0) {
balances[_owner] = balances[_owner].add(owedDividend);
}
// register this user as being owed no further dividends
lastDividend[_owner] = dividendSnapshots.length;
}
| // Reconcile all outstanding dividends for an address
// into its balance. | LineComment | v0.4.18+commit.9cf6e910 | bzzr://9905724fd342af9bbc20f69fca2672221cfa2033abdc7644988980bd8a5fea65 | {
"func_code_index": [
8840,
9394
]
} | 1,627 |
|
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | freeSale | function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
| // free for gutter cats | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
3151,
3692
]
} | 1,628 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | adminMint | function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
| //admin mint | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
4666,
4846
]
} | 1,629 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | burn | function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
| //burn | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
5259,
5518
]
} | 1,630 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setGutterAddresses | function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
| //sets the gang addresses | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
6288,
6773
]
} | 1,631 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setPresaleLive | function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
| //sets presale live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
6799,
6892
]
} | 1,632 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setSaleLive | function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
| //sets sale live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
6915,
7002
]
} | 1,633 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setFreeMintLive | function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
| //sets free mint live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
7030,
7125
]
} | 1,634 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setBurnLive | function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
| //sets burn live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
7148,
7235
]
} | 1,635 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setUpgradeLive | function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
| //sets upgrade live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
7261,
7354
]
} | 1,636 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setSaleStopID | function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
| //sets upgrade live | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
7380,
7559
]
} | 1,637 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | isApprovedForAll | function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
| /**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/ | NatSpecMultiLine | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
8343,
8778
]
} | 1,638 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setProxyRegistry | function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
| //sets the opensea proxy | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
8809,
8932
]
} | 1,639 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | lockMetadata | function lockMetadata() external onlyOwner {
locked = true;
}
| // and for the eternity! | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
8963,
9040
]
} | 1,640 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | setSignerAddress | function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
| //sets signer address | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
9068,
9178
]
} | 1,641 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | decreaseMaxNormalSupplyID | function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
| // decreases max supply | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
9208,
9473
]
} | 1,642 |
||
GutterComics | ./contracts/GutterComics.sol | 0xe909c4a1275e8fd21accda5d4332d2306d2812ad | Solidity | GutterComics | contract GutterComics is ERC721, Ownable, ReentrancyGuard {
using Address for address;
using Strings for uint256;
using ECDSA for bytes32;
//gasless approvals on opensea
address proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1;
string public _baseURIextended =
"https://comicsapi.guttercatgang.com/metadata/comics/";
string public _contractURI =
"ipfs://Qmf6iFDeNGFcEAdympLTpNZhGyTjtQtTeJ9bbde3f9tKyZ";
uint256 public maxNormalSupplyID = 12000;
uint256 public saleStopID = 9000;
uint256 public pricePerComic = 0.04 ether;
bool public locked; //metadata lock
uint256 public _currentIndex;
uint256 private _tokensBurned;
bool public presaleLive;
bool public saleLive;
bool public freeMintLive;
bool public burnLive;
address public gutterCatNFTAddress =
0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452;
address public gutterRatNFTAddress =
0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C;
address public gutterPigeonNFTAddress =
0x950b9476a4de757BB134483029AC4Ec17E739e3A;
address public gutterDogNFTAddress =
0x6E9DA81ce622fB65ABf6a8d8040e460fF2543Add;
// upgrade-related settings
address private signerAddress;
bool public upgradeLive;
mapping(uint256 => bool) public usedCatIDs; //used cat IDs for free claiming
mapping(address => uint256) public purchases;
event TokenUpgraded(uint256 id, uint256 coverType);
constructor() ERC721("Gutter Comics", "GCOM") {}
function presale(uint256 qty, uint256 gutterCatorRatID)
external
payable
nonReentrant
{
require(tx.origin == msg.sender, "no...");
require(presaleLive, "presale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
require(
(IERC1155(gutterCatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC1155(gutterRatNFTAddress).balanceOf(
msg.sender,
gutterCatorRatID
) > 0) ||
(IERC721(gutterPigeonNFTAddress).balanceOf(msg.sender) > 0) ||
(IERC721(gutterDogNFTAddress).balanceOf(msg.sender) > 0),
"you have to own a gutter species"
);
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
function publicSale(uint256 qty) external payable nonReentrant {
require(tx.origin == msg.sender, "no...");
require(saleLive, "sale not live");
require(qty <= 5, "max 5 per tx");
require(purchases[msg.sender] + qty <= 10, "limit exceded");
require(_currentIndex + qty <= saleStopID, "out of stock");
require(pricePerComic * qty == msg.value, "exact amount needed");
purchases[msg.sender] += qty;
mintMultiple(msg.sender, qty);
}
// free for gutter cats
function freeSale(uint256 catID) external nonReentrant {
require(tx.origin == msg.sender, "no...");
require(freeMintLive, "free mint not live");
require(_currentIndex + 1 <= maxNormalSupplyID, "out of stock");
require(!usedCatIDs[catID], "you can only mint once with this id");
require(
IERC1155(gutterCatNFTAddress).balanceOf(msg.sender, catID) > 0,
"you have to own a cat with this id"
);
usedCatIDs[catID] = true;
mintToken(msg.sender);
}
function upgradeComic(
bytes32 hash,
bytes memory sig,
uint256 firstId,
uint256 secondId,
uint256 coverType
) external nonReentrant {
require(
_currentIndex >= maxNormalSupplyID,
"wrong max supply settings"
);
require(upgradeLive, "upgrade not live");
require(matchAddresSigner(hash, sig), "no direct mint");
require(
hashTransaction(firstId, secondId, coverType) == hash,
"hash check failed"
);
require(_exists(firstId) && _exists(secondId), "tokens don't exist");
require(
ownerOf(firstId) == msg.sender && ownerOf(secondId) == msg.sender,
"not the owner"
);
require(firstId != secondId, "same ids");
burnToken(firstId);
burnToken(secondId);
mintToken(msg.sender);
emit TokenUpgraded(_currentIndex, coverType);
}
//admin mint
function adminMint(address to, uint256 qty) external onlyOwner {
require(_currentIndex + qty <= maxNormalSupplyID, "out of stock");
mintMultiple(to, qty);
}
function mintMultiple(address receiver, uint256 qty) private {
for (uint256 i = 0; i < qty; i++) {
mintToken(receiver);
}
}
function mintToken(address receiver) private {
_currentIndex += 1;
_safeMint(receiver, _currentIndex);
}
function burnToken(uint256 tokenId) private {
_tokensBurned += 1;
_burn(tokenId);
}
//burn
function burn(uint256 tokenId) public virtual {
require(burnLive, "burn not live");
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"caller is not owner nor approved"
);
burnToken(tokenId);
}
function setBaseURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_baseURIextended = newuri;
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(_baseURIextended, _tokenId.toString()));
}
function setContractURI(string memory newuri) public onlyOwner {
require(!locked, "locked functions");
_contractURI = newuri;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
//sets the gang addresses
function setGutterAddresses(
address cats,
address rats,
address pigeons,
address dogs
) external onlyOwner {
gutterCatNFTAddress = cats; //0xEdB61f74B0d09B2558F1eeb79B247c1F363Ae452
gutterRatNFTAddress = rats; //0xD7B397eDad16ca8111CA4A3B832d0a5E3ae2438C
gutterPigeonNFTAddress = pigeons; //0x950b9476a4de757BB134483029AC4Ec17E739e3A
gutterDogNFTAddress = dogs; //0x6e9da81ce622fb65abf6a8d8040e460ff2543add
}
//sets presale live
function setPresaleLive(bool live) external onlyOwner {
presaleLive = live;
}
//sets sale live
function setSaleLive(bool live) external onlyOwner {
saleLive = live;
}
//sets free mint live
function setFreeMintLive(bool live) external onlyOwner {
freeMintLive = live;
}
//sets burn live
function setBurnLive(bool live) external onlyOwner {
burnLive = live;
}
//sets upgrade live
function setUpgradeLive(bool live) external onlyOwner {
upgradeLive = live;
}
//sets upgrade live
function setSaleStopID(uint256 newSaleStopID) external onlyOwner {
require(newSaleStopID <= maxNormalSupplyID, "invalid id");
saleStopID = newSaleStopID;
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
function reclaimERC20(IERC20 erc20Token) public onlyOwner {
erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
}
function reclaimERC721(IERC721 erc721Token, uint256 id) public onlyOwner {
erc721Token.safeTransferFrom(address(this), msg.sender, id);
}
function reclaimERC1155(
IERC1155 erc1155Token,
uint256 id,
uint256 qty
) public onlyOwner {
erc1155Token.safeTransferFrom(address(this), msg.sender, id, qty, "");
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
//sets the opensea proxy
function setProxyRegistry(address _newRegistry) external onlyOwner {
proxyRegistryAddress = _newRegistry;
}
// and for the eternity!
function lockMetadata() external onlyOwner {
locked = true;
}
//sets signer address
function setSignerAddress(address newSigner) external onlyOwner {
signerAddress = newSigner;
}
// decreases max supply
function decreaseMaxNormalSupplyID(uint256 newSupplyID) external onlyOwner {
require(
maxNormalSupplyID > newSupplyID && newSupplyID >= _currentIndex,
"invalid new supply"
);
maxNormalSupplyID = newSupplyID;
}
function totalSupply() public view returns (uint256) {
return _currentIndex - _tokensBurned;
}
// utils
function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
function matchAddresSigner(bytes32 hash, bytes memory signature)
private
view
returns (bool)
{
return signerAddress == hash.recover(signature);
}
function exists(uint256 id) external view returns (bool) {
return _exists(id);
}
} | hashTransaction | function hashTransaction(
uint256 firstId,
uint256 secondId,
uint256 coverType
) private pure returns (bytes32) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(firstId, secondId, coverType))
)
);
return hash;
}
| // utils | LineComment | v0.8.11+commit.d7f03943 | MIT | ipfs://09537da6493379832f866f8a43cb9875b7a49daef35d0822429531446fd8ab39 | {
"func_code_index": [
9600,
9987
]
} | 1,643 |
||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SaferMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
} | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
265,
610
]
} | 1,644 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SaferMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
} | balanceOf | function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
816,
932
]
} | 1,645 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) returns (bool success) {
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) returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
392,
941
]
} | 1,646 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) returns (bool success) {
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) returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | approve | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
1573,
1763
]
} | 1,647 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) returns (bool success) {
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) returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | allowance | function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
2087,
2232
]
} | 1,648 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) returns (bool success) {
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) returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
} | increaseApproval | function increaseApproval (address _spender, uint _addedValue) returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
2477,
2743
]
} | 1,649 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | Ownable | function Ownable() {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
261,
314
]
} | 1,650 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | transferOwnership | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
637,
813
]
} | 1,651 |
|||
ChillCoin | ChillCoin.sol | 0xcc7242f18453025bb8088c98104362a2a86020ac | Solidity | ChillCoin | contract ChillCoin is StandardToken, Ownable {
string public constant name = "Chill Coin";
string public constant symbol = "CHILL";
uint8 public constant decimals = 8;
uint256 public ChillIssued;
string public ChillTalk;
/* Chill word for the world */
event ChilledTalked(string newWord);
function talkToWorld(string talk_) public onlyOwner {
ChillTalk = talk_;
ChilledTalked(ChillTalk);
}
/* Issue gorgeous Chills to the world */
event ChillsDroped(uint256 count, uint256 kit);
function dropCoins(address[] dests, uint256 Chills) public onlyOwner {
uint256 amount = Chills * (10 ** uint256(decimals));
require((ChillIssued + (dests.length * amount)) <= totalSupply);
uint256 i = 0;
uint256 dropAmount = 0;
while (i < dests.length) {
/* Don't mess with Chills, receiver address has to own more than 0.05 ETH */
if(dests[i].balance > 50 finney) {
balances[dests[i]] += amount;
dropAmount += amount;
Transfer(this, dests[i], amount);
}
i += 1;
}
ChillIssued += dropAmount;
ChillsDroped(i, dropAmount);
}
/* Constructor function - initialize Chill Coins */
function ChillCoin() {
totalSupply = 100000000 * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply / 10; //
ChillIssued = totalSupply / 10;
ChillTalk = "Chill";
}
} | ChillCoin | function ChillCoin() {
totalSupply = 100000000 * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply / 10; //
ChillIssued = totalSupply / 10;
ChillTalk = "Chill";
}
| /* Constructor function - initialize Chill Coins */ | Comment | v0.4.21+commit.dfe3193c | bzzr://c289e35f233c7e71f735d21122f2bf7d785becb7b96bf44c86c14781fabe7c99 | {
"func_code_index": [
1295,
1497
]
} | 1,652 |
|||
Ccc | Ccc.sol | 0x94cb815f4b601b00b363b3177b4d8ed8e0eb7cf2 | Solidity | SafeMath | contract SafeMath {
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
} // assert no longer needed once solidity is on 0.4.10
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) internal returns(uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
}
function safeMult(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
} | /////////////// | NatSpecSingleLine | safeAdd | function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
| // assert no longer needed once solidity is on 0.4.10 | LineComment | v0.4.20-nightly.2018.1.6+commit.2548228b | bzzr://7ae2d1d44629744e7c9b34a5fb94bbe5e5c536aaab50ef782944c07f3754aecd | {
"func_code_index": [
197,
355
]
} | 1,653 |
|
Ccc | Ccc.sol | 0x94cb815f4b601b00b363b3177b4d8ed8e0eb7cf2 | Solidity | Ccc | contract Ccc is StandardToken, SafeMath {
// Descriptive properties
string public constant name = "Coin Controller Cash";
string public constant symbol = "CCC";
uint256 public constant decimals = 18;
uint256 public totalSupply = 2000000000 * 10**decimals;
string public version = "1.0";
// Account for ether proceed.
address public etherProceedsAccount;
uint256 public constant CAP = 2000000000 * 10**decimals;
// constructor
function Ccc(address _etherProceedsAccount) {
etherProceedsAccount = _etherProceedsAccount;
balances[etherProceedsAccount] += CAP;
Transfer(this, etherProceedsAccount, CAP);
}
function () payable public {
require(msg.value == 0);
}
} | ///////////////////// | NatSpecSingleLine | Ccc | function Ccc(address _etherProceedsAccount) {
etherProceedsAccount = _etherProceedsAccount;
balances[etherProceedsAccount] += CAP;
Transfer(this, etherProceedsAccount, CAP);
}
| // constructor | LineComment | v0.4.20-nightly.2018.1.6+commit.2548228b | bzzr://7ae2d1d44629744e7c9b34a5fb94bbe5e5c536aaab50ef782944c07f3754aecd | {
"func_code_index": [
485,
691
]
} | 1,654 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | totalSupply | function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
| // ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
930,
1049
]
} | 1,655 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | balanceOf | function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
| // ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
1269,
1394
]
} | 1,656 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | transfer | function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
| // ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
1738,
2010
]
} | 1,657 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | approve | function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| // ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
2518,
2731
]
} | 1,658 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | transferFrom | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
| // ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
3262,
3610
]
} | 1,659 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | allowance | function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
| // ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
3893,
4045
]
} | 1,660 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | approveAndCall | function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
| // ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
4400,
4722
]
} | 1,661 |
|
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | function () public payable {
revert();
}
| // ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
4914,
4973
]
} | 1,662 |
||
BETTER | BETTER.sol | 0xf576b4207e69d21cf976b93fed705f1ba9e02111 | Solidity | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ---------------------------------------------------------------------------- | LineComment | transferAnyERC20Token | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| // ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------ | LineComment | v0.4.24+commit.e67f0147 | bzzr://e2ef60c65332077602494fd4a053e56cccdc9cc206240cf72c803be763234826 | {
"func_code_index": [
5206,
5395
]
} | 1,663 |
|
PresaleAllocation | contracts/ExitQueue.sol | 0x6cf2a119f98a4b4a7fa4fd08a1e72d7af3ba72fe | Solidity | ExitQueue | contract ExitQueue is Ownable {
struct User {
// Total currently in queue
uint256 Amount;
// First epoch for which the user is in the unstake queue
uint256 FirstExitEpoch;
// Last epoch for which the user has a pending unstake
uint256 LastExitEpoch;
// All epochs where the user has an exit allocation
mapping(uint256 => uint256) Exits;
}
// total queued to be exited in a given epoch
mapping(uint256 => uint256) public totalPerEpoch;
// The first unwithdrawn epoch for the user
mapping(address => User) public userData;
IERC20 public TEMPLE; // TEMPLE
// Limit of how much temple can exit per epoch
uint256 public maxPerEpoch;
// Limit of how much temple can exit per address per epoch
uint256 public maxPerAddress;
// epoch size, in blocks
uint256 public epochSize;
// the block we use to work out what epoch we are in
uint256 public firstBlock;
// The next free block on which a user can commence their unstake
uint256 public nextUnallocatedEpoch;
event JoinQueue(address exiter, uint256 amount);
event Withdrawal(address exiter, uint256 amount);
constructor(
address _TEMPLE,
uint256 _maxPerEpoch,
uint256 _maxPerAddress,
uint256 _epochSize) {
TEMPLE = IERC20(_TEMPLE);
maxPerEpoch = _maxPerEpoch;
maxPerAddress = _maxPerAddress;
epochSize = _epochSize;
firstBlock = block.number;
nextUnallocatedEpoch = 0;
}
function setMaxPerEpoch(uint256 _maxPerEpoch) external onlyOwner {
maxPerEpoch = _maxPerEpoch;
}
function setMaxPerAddress(uint256 _maxPerAddress) external onlyOwner {
maxPerAddress = _maxPerAddress;
}
function setEpochSize(uint256 _epochSize) external onlyOwner {
epochSize = _epochSize;
}
function setStartingBlock(uint256 _firstBlock) external onlyOwner {
require(_firstBlock < firstBlock, "Can only move start block back, not forward");
firstBlock = _firstBlock;
}
function currentEpoch() public view returns (uint256) {
return (block.number - firstBlock) / epochSize;
}
function currentEpochAllocation(address _exiter, uint256 _epoch) external view returns (uint256) {
return userData[_exiter].Exits[_epoch];
}
function join(address _exiter, uint256 _amount) external {
// require(_amount > 0, "Amount must be > 0");
// if (nextUnallocatedEpoch < currentEpoch()) {
// nextUnallocatedEpoch = currentEpoch();
// }
// User storage user = userData[_exiter];
// uint256 unallocatedAmount = _amount;
// uint256 _nextUnallocatedEpoch = nextUnallocatedEpoch;
// uint256 nextAvailableEpochForUser = _nextUnallocatedEpoch;
// if (user.LastExitEpoch > nextAvailableEpochForUser) {
// nextAvailableEpochForUser = user.LastExitEpoch;
// }
// while (unallocatedAmount > 0) {
// // work out allocation for the next available epoch
// uint256 allocationForEpoch = unallocatedAmount;
// if (user.Exits[nextAvailableEpochForUser] + allocationForEpoch > maxPerAddress) {
// allocationForEpoch = maxPerAddress - user.Exits[nextAvailableEpochForUser];
// }
// if (totalPerEpoch[nextAvailableEpochForUser] + allocationForEpoch > maxPerEpoch) {
// allocationForEpoch = maxPerEpoch - totalPerEpoch[nextAvailableEpochForUser];
// }
// // Bookkeeping
// if (allocationForEpoch > 0) {
// if (user.Amount == 0) {
// user.FirstExitEpoch = nextAvailableEpochForUser;
// }
// user.Amount += allocationForEpoch;
// user.Exits[nextAvailableEpochForUser] += allocationForEpoch;
// totalPerEpoch[nextAvailableEpochForUser] += allocationForEpoch;
// user.LastExitEpoch = nextAvailableEpochForUser;
// if (totalPerEpoch[nextAvailableEpochForUser] >= maxPerEpoch) {
// _nextUnallocatedEpoch = nextAvailableEpochForUser;
// }
// unallocatedAmount -= allocationForEpoch;
// }
// nextAvailableEpochForUser += 1;
// }
// // update outside of main loop, so we spend gas once
// nextUnallocatedEpoch = _nextUnallocatedEpoch;
// SafeERC20.safeTransferFrom(TEMPLE, msg.sender, address(this), _amount);
// emit JoinQueue(_exiter, _amount);
}
/**
* Withdraw processed allowance from a specific epoch
*/
function withdraw(uint256 epoch) external {
require(epoch < currentEpoch(), "Can only withdraw from past epochs");
User storage user = userData[msg.sender];
uint256 amount = user.Exits[epoch];
delete user.Exits[epoch];
totalPerEpoch[epoch] -= amount; // TODO: WHen this goes to 0, is it the same as the data being removed?
user.Amount -= amount;
// Once all allocations on queue have been claimed, reset user state
if (user.Amount == 0) {
// NOTE: triggers ExitQueue.withdraw(uint256) (contracts/ExitQueue.sol #150-167) deletes ExitQueue.User (contracts/ExitQueue.sol#15-27) which contains a mapping
// This is okay as if Amount is 0, we'd expect user.Exits to be empty as well
// TODO: Confirm this via tests
delete userData[msg.sender];
}
SafeERC20.safeTransfer(TEMPLE, msg.sender, amount);
emit Withdrawal(msg.sender, amount);
}
} | /**
* How all exit of TEMPLE rewards are managed.
*/ | NatSpecMultiLine | withdraw | function withdraw(uint256 epoch) external {
require(epoch < currentEpoch(), "Can only withdraw from past epochs");
User storage user = userData[msg.sender];
uint256 amount = user.Exits[epoch];
delete user.Exits[epoch];
totalPerEpoch[epoch] -= amount; // TODO: WHen this goes to 0, is it the same as the data being removed?
user.Amount -= amount;
// Once all allocations on queue have been claimed, reset user state
if (user.Amount == 0) {
// NOTE: triggers ExitQueue.withdraw(uint256) (contracts/ExitQueue.sol #150-167) deletes ExitQueue.User (contracts/ExitQueue.sol#15-27) which contains a mapping
// This is okay as if Amount is 0, we'd expect user.Exits to be empty as well
// TODO: Confirm this via tests
delete userData[msg.sender];
}
SafeERC20.safeTransfer(TEMPLE, msg.sender, amount);
emit Withdrawal(msg.sender, amount);
}
| /**
* Withdraw processed allowance from a specific epoch
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
4759,
5756
]
} | 1,664 |
||
LTStandardCreateToken | LTStandardCreateToken.sol | 0xfb1d53bccdc61d6a039397293a96d3a3f85ded02 | Solidity | LTStandardCreateToken | contract LTStandardCreateToken is LTStandardToken {
string public name;
uint8 public decimals;
string public symbol;
string public version = 'H0.1';
constructor(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol)public {
balances[msg.sender] = _initialAmount; // 初始token数量给予消息发送者
totalSupply = _initialAmount; // 设置初始总量
name = _tokenName; // token名称
decimals = _decimalUnits; // 小数位数
symbol = _tokenSymbol; // token简称
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value)public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value)public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| /* Approves and then calls the receiving contract */ | Comment | v0.4.24+commit.e67f0147 | bzzr://2c989e17db5b0ade75c0549e41b69a09b7824425c39c96b77230517878956ac5 | {
"func_code_index": [
702,
927
]
} | 1,665 |
|||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | LPS_balanceOf | function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
| // Expose balanceOf(). | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
1155,
1278
]
} | 1,666 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | LPS_transfer | function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
| // Expose internal transfer function. | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
1321,
1452
]
} | 1,667 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | protectionChecker | function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
| // All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled. | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
1584,
1995
]
} | 1,668 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | counterToken | function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
| // This token will be pooled in pair with: | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
2044,
2186
]
} | 1,669 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | FirstBlockTrap_skip | function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
| // Disable/Enable FirstBlockTrap | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
2225,
2326
]
} | 1,670 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | LiquidityAmountTrap_skip | function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
| // Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks. | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
2440,
2546
]
} | 1,671 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | LiquidityPercentTrap_skip | function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
| // Disable/Enable percent of remaining liquidity bought trap.
// Per address per block. | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
2912,
3019
]
} | 1,672 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | LiquidityActivityTrap_skip | function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
| // Disable/Enable number of trades trap.
// Per block. | LineComment | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
3325,
3433
]
} | 1,673 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | pause | function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
| /**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
3847,
3999
]
} | 1,674 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | unpause | function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
| /**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
4202,
4360
]
} | 1,675 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | burn | function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
| /**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
4550,
4732
]
} | 1,676 |
||
Standard | contracts/Standard.sol | 0x9040e237c3bf18347bb00957dc22167d0f2b999d | Solidity | Standard | contract Standard is ERC20Pausable, AccessControlEnumerable, UsingLiquidityProtectionService {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
constructor()
ERC20("Standard", "STND") {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_mint(msg.sender, 100000000 * 1e18);
}
function _beforeTokenTransfer(address _from, address _to, uint _amount) internal override {
super._beforeTokenTransfer(_from, _to, _amount);
LPS_beforeTokenTransfer(_from, _to, _amount);
}
function LPS_isAdmin() internal view override returns(bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function liquidityProtectionService() internal pure override returns(address) {
return 0xaabAe39230233d4FaFf04111EF08665880BD6dFb; // Replace with the correct address.
}
// Expose balanceOf().
function LPS_balanceOf(address _holder) internal view override returns(uint) {
return balanceOf(_holder);
}
// Expose internal transfer function.
function LPS_transfer(address _from, address _to, uint _value) internal override {
_transfer(_from, _to, _value);
}
// All the following overrides are optional, if you want to modify default behavior.
// How the protection gets disabled.
function protectionChecker() internal view override returns(bool) {
return ProtectionSwitch_timestamp(1620086399); // Switch off protection on Monday, May 3, 2021 11:59:59 PM.
// return ProtectionSwitch_block(13000000); // Switch off protection on block 13000000.
//return ProtectionSwitch_manual(); // Switch off protection by calling disableProtection(); from owner. Default.
}
// This token will be pooled in pair with:
function counterToken() internal pure override returns(address) {
return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH
}
// Disable/Enable FirstBlockTrap
function FirstBlockTrap_skip() internal pure override returns(bool) {
return false;
}
// Disable/Enable absolute amount of tokens bought trap.
// Per address per LiquidityAmountTrap_blocks.
function LiquidityAmountTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityAmountTrap_blocks() internal pure override returns(uint8) {
return 4;
}
function LiquidityAmountTrap_amount() internal pure override returns(uint128) {
return 20000 * 1e18; // Only valid for tokens with 18 decimals.
}
// Disable/Enable percent of remaining liquidity bought trap.
// Per address per block.
function LiquidityPercentTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityPercentTrap_blocks() internal pure override returns(uint8) {
return 6;
}
function LiquidityPercentTrap_percent() internal pure override returns(uint64) {
return HUNDRED_PERCENT / 20; // 5%
}
// Disable/Enable number of trades trap.
// Per block.
function LiquidityActivityTrap_skip() internal pure override returns(bool) {
return false;
}
function LiquidityActivityTrap_blocks() internal pure override returns(uint8) {
return 3;
}
function LiquidityActivityTrap_count() internal pure override returns(uint8) {
return 8;
}
/**
* @dev Pauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC20Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "Standard: must have pauser role to unpause");
_unpause();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*
* Requirements:
*
* - the caller must have the `BURNER_ROLE`.
*/
function burn(uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/
function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
} | /**
* @dev {ERC20} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - the liquidity protection
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* The contract will mint 100M with 1 decimals tokens on deploy as a total supply.
*/ | NatSpecMultiLine | burnFrom | function burnFrom(address account, uint256 amount) public {
require(hasRole(BURNER_ROLE, _msgSender()), "Standard: must have burner role to burn");
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount);
_burn(account, amount);
}
| /**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
* - the caller must have the `BURNER_ROLE`.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | {
"func_code_index": [
5083,
5503
]
} | 1,677 |
||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | BCBCOIN | function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
| /**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
838,
1380
]
} | 1,678 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | _transfer | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| /**
* Internal transfer, only can be called by this contract
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
1464,
2312
]
} | 1,679 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | transfer | function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
| /**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
2518,
2630
]
} | 1,680 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| /**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
2905,
3206
]
} | 1,681 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | approve | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| /**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
3470,
3646
]
} | 1,682 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
| /**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
4040,
4392
]
} | 1,683 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | burn | function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| /**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
4562,
4941
]
} | 1,684 |
|||
BCBCOIN | BCBCOIN.sol | 0x61c0e30b2c8c93cd0970c1d64029037bfffa5954 | Solidity | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function BCBCOIN(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | burnFrom | function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
| /**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://049cf70abde3d522158979df588e554785e17643b6a2b029a147551a15365710 | {
"func_code_index": [
5199,
5815
]
} | 1,685 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | totalSupply | function totalSupply() constant returns (uint256 supply) {}
| /// @return total amount of tokens | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
60,
124
]
} | 1,686 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | balanceOf | function balanceOf(address _owner) constant returns (uint256 balance) {}
| /// @param _owner The address from which the balance will be retrieved
/// @return The balance | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
232,
309
]
} | 1,687 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | transfer | function transfer(address _to, uint256 _value) returns (bool success) {}
| /// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
546,
623
]
} | 1,688 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
| /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
946,
1042
]
} | 1,689 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | approve | function approve(address _spender, uint256 _value) returns (bool success) {}
| /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
1326,
1407
]
} | 1,690 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | Token | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
} | allowance | function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
| /// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
1615,
1712
]
} | 1,691 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | KOALAPROJECT | contract KOALAPROJECT is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; // Token Name
uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18
string public symbol; // An identifier: eg SBX, XPR etc..
string public version = 'H1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH?
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.
address public fundsWallet; // Where should the raised ETH go?
// which means the following function name has to match the contract name declared above
function KOALAPROJECT() {
balances[msg.sender] = 1000000000000000000000000000;
totalSupply = 1000000000000000000000000000;
name = "KOALA TOKEN";
decimals = 18;
symbol = "KOA";
unitsOneEthCanBuy = 10000;
fundsWallet = msg.sender;
}
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
//Transfer ether to fundsWallet
fundsWallet.transfer(msg.value);
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
return true;
}
} | KOALAPROJECT | function KOALAPROJECT() {
balances[msg.sender] = 1000000000000000000000000000;
totalSupply = 1000000000000000000000000000;
name = "KOALA TOKEN";
decimals = 18;
symbol = "KOA";
unitsOneEthCanBuy = 10000;
fundsWallet = msg.sender;
}
| // Where should the raised ETH go?
// which means the following function name has to match the contract name declared above | LineComment | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
1121,
1424
]
} | 1,692 |
|||
KOALAPROJECT | KOALAPROJECT.sol | 0x73d6f153a6e36a15faa8d447aae7cee8b3d7072e | Solidity | KOALAPROJECT | contract KOALAPROJECT is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; // Token Name
uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18
string public symbol; // An identifier: eg SBX, XPR etc..
string public version = 'H1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH?
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.
address public fundsWallet; // Where should the raised ETH go?
// which means the following function name has to match the contract name declared above
function KOALAPROJECT() {
balances[msg.sender] = 1000000000000000000000000000;
totalSupply = 1000000000000000000000000000;
name = "KOALA TOKEN";
decimals = 18;
symbol = "KOA";
unitsOneEthCanBuy = 10000;
fundsWallet = msg.sender;
}
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
//Transfer ether to fundsWallet
fundsWallet.transfer(msg.value);
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
return true;
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
return true;
}
| /* Approves and then calls the receiving contract */ | Comment | v0.4.24+commit.e67f0147 | bzzr://0adb49a30b41b809cf840de3d077ca99567ce1929b78d1cf1a68ef76b0a19089 | {
"func_code_index": [
2020,
2825
]
} | 1,693 |
|||
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | isContract | function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
| /**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
609,
1233
]
} | 1,694 |
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | sendValue | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
| /**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
2166,
2568
]
} | 1,695 |
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCall | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| /**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
3324,
3502
]
} | 1,696 |
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCall | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
3727,
3928
]
} | 1,697 |
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| /**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
4298,
4529
]
} | 1,698 |
StreamingFeeModule | StreamingFeeModule.sol | 0x3d8d14b7efb8e342189ee14c3d40dce005eb901b | Solidity | Address | library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* // importANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
} | /**
* @dev Collection of functions related to the address type
*/ | NatSpecMultiLine | functionCallWithValue | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
| /**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/ | NatSpecMultiLine | v0.6.10+commit.00c0fcaf | Apache-2.0 | ipfs://ba7667045a62821576f45f97bfd8b1cc568441fd88b75e911a09cd56a86503c4 | {
"func_code_index": [
4780,
5101
]
} | 1,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.