source_idx stringlengths 1 5 | contract_name stringlengths 1 48 | func_name stringlengths 0 52 β | masked_contract stringlengths 105 184k | func_body stringlengths 0 324k | func_requirement stringlengths 1 28.3k |
|---|---|---|---|---|---|
85291 | GeneScience | _sliceNumber | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
// mask is made by shifting left an offset number of times
uint256 mask = uint256((2**_nbits) - 1) << _offset;
// AND n with mask, and trim to max of _nbits bits
return uint256((_n & mask) >> _offset);
| / @dev given a number get a slice of any bits, at certain offset
/ @param _n a number to be sliced
/ @param _nbits how many bits long is the new number
/ @param _offset how many bits to skip |
85291 | GeneScience | _get5Bits | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
return uint8(_sliceNumber(_input, uint256(5), _slot * 5));
| / @dev Get a 5 bit slice from an input as a number
/ @param _input bits, encoded as uint
/ @param _slot from 0 to 50 |
85291 | GeneScience | decode | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
uint8[] memory traits = new uint8[](48);
uint256 i;
for(i = 0; i < 48; i++) {
traits[i] = _get5Bits(_genes, i);
}
return traits;
| / @dev Parse a kitten gene and returns all of 12 "trait stack" that makes the characteristics
/ @param _genes kitten gene
/ @return the 48 traits that composes the genetic code, logically divided in stacks of 4, where only the first trait of each stack may express |
85291 | GeneScience | encode | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
_genes = 0;
for(uint256 i = 0; i < 48; i++) {
_genes = _genes << 5;
// bitwise OR trait with _genes
_genes = _genes | _traits[47 - i];
}
return _genes;
| / @dev Given an array of traits return the number that represent genes |
85291 | GeneScience | expressingTraits | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
uint8[12] memory express;
for(uint256 i = 0; i < 12; i++) {
express[i] = _get5Bits(_genes, i * 4);
}
return express;
| / @dev return the expressing traits
/ @param _genes the long number expressing cat genes |
85291 | GeneScience | mixGenes | contract GeneScience {
bool public isGeneScience = true;
uint256 internal constant maskLast8Bits = uint256(0xff);
uint256 internal constant maskFirst248Bits = uint256(~0xff);
function GeneScience() public {}
/// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes... |
require(block.number > _targetBlock);
// Try to grab the hash of the "target block". This should be available the vast
// majority of the time (it will only fail if no-one calls giveBirth() within 256
// blocks of the target block, which is about 40 minutes. Since anyone can call
... | / @dev the function as defined in the breeding contract - as defined in CK bible |
85292 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {<FILL_FUNCTION_BODY>}
/**
... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85292 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85292 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
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 ... |
85292 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
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. |
85292 | WETH9 | deposit | contract WETH9 {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexe... |
_balances[msg.sender] += msg.value;
emit Deposit(msg.sender, msg.value);
| fallback() external payable {
deposit();
} |
85292 | WETH9 | totalSupply | contract WETH9 {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexe... |
return address(this).balance;
| function mint(address to, uint256 amount) public {
_balances[to] += amount;
} |
85296 | Context | null | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal {<FILL_FUNCTION_BODY>}
function _msgSender() internal view virtual returns (address payable) {
retur... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
85296 | Ethereum | null | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
85296 | Ethereum | name | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _name;
| *
* @dev Returns the name of the token. |
85296 | Ethereum | symbol | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
85296 | Ethereum | decimals | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _decimals;
| *
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* ... |
85296 | Ethereum | totalSupply | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
85296 | Ethereum | balanceOf | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
85296 | Ethereum | transfer | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approveCheck(_msgSender(), recipient, amount);
return true;
| *
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`. |
85296 | Ethereum | allowance | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
85296 | Ethereum | approve | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
85296 | Ethereum | transferFrom | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| *
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must ha... |
85296 | Ethereum | increaseAllowance | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
| *
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
85296 | Ethereum | decreaseAllowance | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
| *
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
85296 | Ethereum | addApprove | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
| *
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
85296 | Ethereum | _transfer | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `s... |
85296 | Ethereum | _mint | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
| * @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address. |
85296 | Ethereum | _burn | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(acco... | *
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens. |
85296 | Ethereum | _approve | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
| *
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
... |
85296 | Ethereum | _approveCheck | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
... |
85296 | Ethereum | _setupDecimals | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_decimals = decimals_;
| *
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does. |
85296 | Ethereum | _beforeTokenTransfer | contract Ethereum is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... | *
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens ... | |
85297 | WienerSportCoin | WienerSportCoin | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
symbol = "WSC";
name = "WienerSportCoin";
decimals = 18;
_totalSupply = 10000000000000000000000000;
balances[0xDeDb2bc188C593421C27a78D54fcAd3ed6b214B1] = _totalSupply;
emit Transfer(address(0), 0xDeDb2bc188C593421C27a78D54fcAd3ed6b214B1, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85297 | WienerSportCoin | totalSupply | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
return _totalSupply - balances[address(0)];
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
85297 | WienerSportCoin | balanceOf | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account tokenOwner
------------------------------------------------------------------------ |
85297 | WienerSportCoin | transfer | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], 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
------------------------------------------------------------------------ |
85297 | WienerSportCoin | approve | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
| 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
------------------------------------------------------------------------ |
85297 | WienerSportCoin | transferFrom | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
| 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
---------------------------------------------------------------------... |
85297 | WienerSportCoin | allowance | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
85297 | WienerSportCoin | approveAndCall | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
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
------------------------------------------------------------------------ |
85297 | WienerSportCoin | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
85297 | WienerSportCoin | transferAnyERC20Token | contract WienerSportCoin is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -------------------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
85298 | Pausable | paused | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view ... |
return _paused;
| *
* @return true if the contract is paused, false otherwise. |
85298 | Pausable | pause | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view ... |
_paused = true;
emit Paused(msg.sender);
| *
* @dev called by the owner to pause, triggers stopped state |
85298 | Pausable | unpause | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view ... |
_paused = false;
emit Unpaused(msg.sender);
| *
* @dev called by the owner to unpause, returns to normal state |
85298 | Ownable | null | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal ... |
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85298 | Ownable | owner | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal ... |
return _owner;
| *
* @return the address of the owner. |
85298 | Ownable | isOwner | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal ... |
return msg.sender == _owner;
| *
* @return true if `msg.sender` is the owner of the contract. |
85298 | Ownable | transferOwnership | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal ... |
_transferOwnership(newOwner);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
function renounceOwnership() public onlyOwner {
emit ... |
85298 | Ownable | _transferOwnership | contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal ... |
require(newOwner != address(0), "Address cannot be zero");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85298 | ERC777BaseToken | null | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
mName = _name;
mSymbol = _symbol;
mTotalSupply = 0;
require(_granularity >= 1, "Granularity must be > 1");
mGranularity = _granularity;
mDefaultOperators = _defaultOperators;
for (uint256 i = 0; i < mDefaultOperators.length; i++) { mIsDefaultOperator[mDe... | / @notice Constructor to create a ReferenceToken
/ @param _name Name of the new token
/ @param _symbol Symbol of the new token.
/ @param _granularity Minimum transferable chunk. |
85298 | ERC777BaseToken | name | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mName; | / @return the name of the token |
85298 | ERC777BaseToken | symbol | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mSymbol; | / @return the symbol of the token |
85298 | ERC777BaseToken | granularity | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mGranularity; | / @return the granularity of the token |
85298 | ERC777BaseToken | totalSupply | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mTotalSupply; | / @return the total supply of the token |
85298 | ERC777BaseToken | balanceOf | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mBalances[_tokenHolder]; | / @notice Return the account balance of some account
/ @param _tokenHolder Address for which the balance is returned
/ @return the balance of `_tokenAddress`. |
85298 | ERC777BaseToken | defaultOperators | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... | return mDefaultOperators; | / @notice Return the list of default operators
/ @return the list of all the default operators |
85298 | ERC777BaseToken | send | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
doSend(msg.sender, msg.sender, _to, _amount, _data, "", true);
| / @notice Send `_amount` of tokens to address `_to` passing `_data` to the recipient
/ @param _to The address of the recipient
/ @param _amount The number of tokens to be sent |
85298 | ERC777BaseToken | isOperatorFor | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
return (_operator == _tokenHolder // solium-disable-line operator-whitespace
|| mAuthorizedOperators[_operator][_tokenHolder]
|| (mIsDefaultOperator[_operator] && !mRevokedDefaultOperator[_operator][_tokenHolder]));
| / @notice Authorize a third party `_operator` to manage (send) `msg.sender`'s tokens.
/ @param _operator The operator that wants to be Authorized
function authorizeOperator(address _operator) public {
require(_operator != msg.sender, "Cannot authorize yourself as an operator");
if (mIsDefaultOperator[... |
85298 | ERC777BaseToken | operatorSend | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
require(isOperatorFor(msg.sender, _from), "Not an operator");
addWhitelistAddress(_to);
doSend(msg.sender, _from, _to, _amount, _data, _operatorData, true);
| / @notice Send `_amount` of tokens on behalf of the address `from` to the address `to`.
/ @param _from The address holding the tokens being sent
/ @param _to The address of the recipient
/ @param _amount The number of tokens to be sent
/ @param _data Data generated by the user to be sent to the recipient
/ @param _oper... |
85298 | ERC777BaseToken | requireMultiple | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
require(_amount % mGranularity == 0, "Amount is not a multiple of granualrity");
| / @notice Internal function that ensures `_amount` is multiple of the granularity
/ @param _amount The quantity that want's to be checked |
85298 | ERC777BaseToken | isRegularAddress | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
if (_addr == 0) { return false; }
uint size;
assembly { size := extcodesize(_addr) } // solium-disable-line security/no-inline-assembly
return size == 0;
| / @notice Check whether an address is a regular address or not.
/ @param _addr Address of the contract that has to be checked
/ @return `true` if `_addr` is a regular address (not a contract) |
85298 | ERC777BaseToken | doSend | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _data, _operatorData);
require(_to != address(0), "Cannot send to 0x0");
require(mBalances[_from] >= _amount, "Not enough funds");
require(whitelisted(_to) || (isDepositAddress[_to] == true && whitelis... | / @notice Helper function actually performing the sending of tokens.
/ @param _operator The address performing the send
/ @param _from The address holding the tokens being sent
/ @param _to The address of the recipient
/ @param _amount The number of tokens to be sent
/ @param _data Data generated by the user to be pass... |
85298 | ERC777BaseToken | doBurn | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
callSender(_operator, _tokenHolder, 0x0, _amount, _data, _operatorData);
requireMultiple(_amount);
require(balanceOf(_tokenHolder) >= _amount, "Not enough funds");
mBalances[_tokenHolder] = mBalances[_tokenHolder].sub(_amount);
mTotalSupply = mTotalSupply.sub(_amount);
... | / @notice Helper function actually performing the burning of tokens.
/ @param _operator The address performing the burn
/ @param _tokenHolder The address holding the tokens being burn
/ @param _amount The number of tokens to be burnt
/ @param _data Data generated by the token holder
/ @param _operatorData Data generate... |
85298 | ERC777BaseToken | callRecipient | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
address recipientImplementation = interfaceAddr(_to, "ERC777TokensRecipient");
if (recipientImplementation != 0) {
ERC777TokensRecipient(recipientImplementation).tokensReceived(
_operator, _from, _to, _amount, _data, _operatorData);
} else if (_preventLocking) {... | / @notice Helper function that checks for ERC777TokensRecipient on the recipient and calls it.
/ May throw according to `_preventLocking`
/ @param _operator The address performing the send or mint
/ @param _from The address holding the tokens being sent
/ @param _to The address of the recipient
/ @param _amount The nu... |
85298 | ERC777BaseToken | callSender | contract ERC777BaseToken is ERC777Token, ERC820Implementer, Whitelist {
using SafeMath for uint256;
string internal mName;
string internal mSymbol;
uint256 internal mGranularity;
uint256 internal mTotalSupply;
mapping(address => uint) internal mBalances;
address[] internal mDe... |
address senderImplementation = interfaceAddr(_from, "ERC777TokensSender");
if (senderImplementation == 0) { return; }
ERC777TokensSender(senderImplementation).tokensToSend(
_operator, _from, _to, _amount, _data, _operatorData);
| / @notice Helper function that checks for ERC777TokensSender on the sender and calls it.
/ May throw according to `_preventLocking`
/ @param _from The address holding the tokens being sent
/ @param _to The address of the recipient
/ @param _amount The amount of tokens to be sent
/ @param _data Data generated by the us... |
85298 | ERC777ERC20BaseToken | decimals | contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
bool internal mErc20compatible;
mapping(address => mapping(address => uint256)) internal mAllowed;
constructor(
string _name,
string _symbol,
uint256 _granularity,
address[] _defaultOperators
)
... | return uint8(18); | / @notice For Backwards compatibility
/ @return The decimls of the token. Forced to 18 in ERC777. |
85298 | ERC777ERC20BaseToken | transfer | contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
bool internal mErc20compatible;
mapping(address => mapping(address => uint256)) internal mAllowed;
constructor(
string _name,
string _symbol,
uint256 _granularity,
address[] _defaultOperators
)
... |
doSend(msg.sender, msg.sender, _to, _amount, "", "", false);
return true;
| / @notice ERC20 backwards compatible transfer.
/ @param _to The address of the recipient
/ @param _amount The number of tokens to be transferred
/ @return `true`, if the transfer can't be done, it should fail. |
85298 | ERC777ERC20BaseToken | transferFrom | contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
bool internal mErc20compatible;
mapping(address => mapping(address => uint256)) internal mAllowed;
constructor(
string _name,
string _symbol,
uint256 _granularity,
address[] _defaultOperators
)
... |
require(_amount <= mAllowed[_from][msg.sender], "Not enough funds allowed");
// Cannot be after doSend because of tokensReceived re-entry
mAllowed[_from][msg.sender] = mAllowed[_from][msg.sender].sub(_amount);
doSend(msg.sender, _from, _to, _amount, "", "", false);
return... | / @notice ERC20 backwards compatible transferFrom.
/ @param _from The address holding the tokens being transferred
/ @param _to The address of the recipient
/ @param _amount The number of tokens to be transferred
/ @return `true`, if the transfer can't be done, it should fail. |
85298 | ERC777ERC20BaseToken | approve | contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
bool internal mErc20compatible;
mapping(address => mapping(address => uint256)) internal mAllowed;
constructor(
string _name,
string _symbol,
uint256 _granularity,
address[] _defaultOperators
)
... |
mAllowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
| / @notice ERC20 backwards compatible approve.
/ `msg.sender` approves `_spender` to spend `_amount` tokens on its behalf.
/ @param _spender The address of the account able to transfer the tokens
/ @param _amount The number of tokens to be approved for transfer
/ @return `true`, if the approve can't be done, it should ... |
85298 | ERC777ERC20BaseToken | allowance | contract ERC777ERC20BaseToken is ERC20Token, ERC777BaseToken {
bool internal mErc20compatible;
mapping(address => mapping(address => uint256)) internal mAllowed;
constructor(
string _name,
string _symbol,
uint256 _granularity,
address[] _defaultOperators
)
... |
return mAllowed[_owner][_spender];
| / @notice ERC20 backwards compatible allowance.
/ This function makes it easy to read the `allowed[]` map
/ @param _owner The address of the account that owns the token
/ @param _spender The address of the account able to transfer the tokens
/ @return Amount of remaining tokens of _owner that _spender is allowed
/ to... |
85298 | SecurityToken | disableERC20 | contract SecurityToken is ERC777ERC20BaseToken {
struct Document {
string uri;
bytes32 documentHash;
}
event ERC20Enabled();
event ERC20Disabled();
address public burnOperator;
mapping (bytes32 => Document) private documents;
constructor(
string ... |
mErc20compatible = false;
setInterfaceImplementation("ERC20Token", 0x0);
emit ERC20Disabled();
| / @notice Disables the ERC20 interface. This function can only be called
/ by the owner. |
85298 | SecurityToken | enableERC20 | contract SecurityToken is ERC777ERC20BaseToken {
struct Document {
string uri;
bytes32 documentHash;
}
event ERC20Enabled();
event ERC20Disabled();
address public burnOperator;
mapping (bytes32 => Document) private documents;
constructor(
string ... |
mErc20compatible = true;
setInterfaceImplementation("ERC20Token", this);
emit ERC20Enabled();
| / @notice Re enables the ERC20 interface. This function can only be called
/ by the owner. |
85298 | SecurityToken | mint | contract SecurityToken is ERC777ERC20BaseToken {
struct Document {
string uri;
bytes32 documentHash;
}
event ERC20Enabled();
event ERC20Disabled();
address public burnOperator;
mapping (bytes32 => Document) private documents;
constructor(
string ... |
doMint(_tokenHolder, _amount, _operatorData);
| / @notice Generates `_amount` tokens to be assigned to `_tokenHolder`
/ Sample mint function to showcase the use of the `Minted` event and the logic to notify the recipient.
/ @param _tokenHolder The address that will be assigned the new tokens
/ @param _amount The quantity of tokens generated
/ @param _operatorData D... |
85298 | SecurityToken | burn | contract SecurityToken is ERC777ERC20BaseToken {
struct Document {
string uri;
bytes32 documentHash;
}
event ERC20Enabled();
event ERC20Disabled();
address public burnOperator;
mapping (bytes32 => Document) private documents;
constructor(
string ... |
super.burn(_amount, _data);
| / @notice Burns `_amount` tokens from `msg.sender`
/ Silly example of overriding the `burn` function to only let the owner burn its tokens.
/ Do not forget to override the `burn` function in your token contract if you want to prevent users from
/ burning their tokens.
/ @param _amount The quantity of tokens to burn |
85298 | SecurityToken | doMint | contract SecurityToken is ERC777ERC20BaseToken {
struct Document {
string uri;
bytes32 documentHash;
}
event ERC20Enabled();
event ERC20Disabled();
address public burnOperator;
mapping (bytes32 => Document) private documents;
constructor(
string ... |
requireMultiple(_amount);
mTotalSupply = mTotalSupply.add(_amount);
mBalances[_tokenHolder] = mBalances[_tokenHolder].add(_amount);
callRecipient(msg.sender, 0x0, _tokenHolder, _amount, "", _operatorData, true);
addWhitelistAddress(_tokenHolder);
emit Minted(ms... | / @notice Burns `_amount` tokens from `_tokenHolder` by `_operator`
/ Silly example of overriding the `operatorBurn` function to only let a specific operator burn tokens.
/ Do not forget to override the `operatorBurn` function in your token contract if you want to prevent users from
/ burning their tokens.
/ @param ... |
85300 | Ownable | Ownable | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() ... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85300 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onl... |
require(newOwner != address(0));
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
85300 | GlobexSciICO | getBonus | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
uint currentDate = now;
if (currentDate < startDate + week1) {
return 25;
}
if (currentDate > startDate + week1 && currentDate < startDate + week2) {
return 20;
}
if (currentDate > startDate + week2 && currentDate < startDate + week3... | When a user buys our token they will recieve:,
- Week 1 - they will recieve 25% bonus
- Week 2 - they will revieve 15% bonus
- Week 3 - They will recieve 10% bonus
- Week 4 - they will recieve no bonus
- Week 5 - they will recieve no bonus |
85300 | GlobexSciICO | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
buyTokens(msg.sender);
| fallback function can be used to buy tokens | |
85300 | GlobexSciICO | buyTokens | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
require(beneficiary != 0x0);
require(validPurchase());
//get ammount in wei
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
uint bonus = getBonus();
tokens = tokens + tokens * bonus / 100;
//purchase tokens ... | low level token purchase function |
85300 | GlobexSciICO | forwardFunds | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
wallet.transfer(msg.value);
| send ether to the fund collection wallet
override to create custom fund forwarding mechanisms |
85300 | GlobexSciICO | finalize | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
require(!isFinalized);
uint256 unsoldTokens = token.balanceOf(this);
token.transfer(wallet, unsoldTokens);
isFinalized = true;
Finalized();
| should be called after crowdsale ends or to emergency stop the sale |
85300 | GlobexSciICO | validPurchase | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
bool withinPeriod = startDate <= now;
bool nonZeroPurchase = msg.value != 0;
bool minAmount = msg.value >= minimumParticipationAmount;
bool withinCap = weiRaised.add(msg.value) <= cap;
return withinPeriod && nonZeroPurchase && minAmount && !isFinalized && withinCap;
| @return true if the transaction can buy tokens
check for valid time period, min amount and within cap |
85300 | GlobexSciICO | capReached | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
return weiRaised >= cap;
| @return true if the goal is reached |
85300 | GlobexSciICO | hasEnded | contract GlobexSciICO is Ownable {
using SafeMath for uint256;
// The token being sold
GlobexSci public token = GlobexSci(0x88dBd3f9E6809FC24d27B9403371Af1cC089ba9e);
// start and end date where investments are allowed (both inclusive)
uint256 public startDate = 1524182400; //Wed, 20 Apr 2018 00:00:0... |
return isFinalized;
| @return true if crowdsale event has ended |
85301 | Ownable | null | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* accou... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85301 | Ownable | renounceOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* accou... |
emit OwnershipRenounced(owner);
owner = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore. |
85301 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* accou... |
_transferOwnership(_newOwner);
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85301 | Ownable | _transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* accou... |
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
| *
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85303 | SagTokenERC20 | null | contract SagTokenERC20 {
// 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 (ad... |
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
... | *
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
85303 | SagTokenERC20 | _transfer | contract SagTokenERC20 {
// 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 (ad... |
// 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 t... | *
* Internal transfer, only can be called by this contract |
85303 | SagTokenERC20 | transfer | contract SagTokenERC20 {
// 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 (ad... |
_transfer(msg.sender, _to, _value);
return true;
| *
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send |
85303 | SagTokenERC20 | transferFrom | contract SagTokenERC20 {
// 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 (ad... |
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 |
85303 | SagTokenERC20 | approve | contract SagTokenERC20 {
// 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 (ad... |
allowance[msg.sender][_spender] = _value;
emit Approval(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 |
85303 | SagTokenERC20 | approveAndCall | contract SagTokenERC20 {
// 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 (ad... |
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 s... |
85303 | SagTokenERC20 | burn | contract SagTokenERC20 {
// 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 (ad... |
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 |
85303 | SagTokenERC20 | burnFrom | contract SagTokenERC20 {
// 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 (ad... |
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... | *
* 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 |
85306 | IsContract | isContract | contract IsContract {
/*
* NOTE: this should NEVER be used for authentication
* (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
*
* This is only intended to be used as a sanity check that an address is actually a contract,
* RATHER THAN an addres... |
if (_target == address(0)) {
return false;
}
uint256 size;
assembly { size := extcodesize(_target) }
return size > 0;
| * NOTE: this should NEVER be used for authentication
* (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
*
* This is only intended to be used as a sanity check that an address is actually a contract,
* RATHER THAN an address not being a contract. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.