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 |
|---|---|---|---|---|---|
72 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value ... |
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. |
72 | DpheToken | null | contract DpheToken is owned, StandardToken {
string public name = "DPHE";
string public symbol = "DPHE";
uint8 public decimals = 5;
/* 构造函数 */
constructor() public {<FILL_FUNCTION_BODY>}
} |
//发行量:10 亿(小数位:5)
totalSupply_ = 100 * 1000 * 10000 * 100000;
balances[msg.sender] = totalSupply_;
| 构造函数 |
73 | GodviewChain | GodviewChain | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint25... |
owner = msg.sender;
totalSupply = initialSupply * 10 ** uint256(decimals);
name = tokenName;
symbol = tokenSymbol;
balances[owner] = totalSupply;
| List of user balances. |
73 | GodviewChain | transfer | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint25... |
bytes memory empty;
transfer(_to, _value, empty);
| *
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _valu... |
73 | GodviewChain | transfer | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint25... |
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
... | *
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fal... |
73 | GodviewChain | burn | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint25... |
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value, totalSupply, _data);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
* @param _data Transaction metadata. |
73 | GodviewChain | balanceOf | contract GodviewChain {
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint8 public constant decimals = 4;
address public owner;
mapping(address => uint256) balances; // List of user balances.
function GodviewChain(uint25... |
return balances[_address];
| *
* @dev Returns balance of the `_address`.
*
* @param _address The address whose balance will be returned.
* @return balance Balance of the `_address`. |
74 | 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. | |
74 | ETH2_0 | null | contract ETH2_0 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. |
74 | ETH2_0 | name | contract ETH2_0 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. |
74 | ETH2_0 | symbol | contract ETH2_0 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. |
74 | ETH2_0 | decimals | contract ETH2_0 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
* ... |
74 | ETH2_0 | totalSupply | contract ETH2_0 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}. |
74 | ETH2_0 | balanceOf | contract ETH2_0 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}. |
74 | ETH2_0 | transfer | contract ETH2_0 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`. |
74 | ETH2_0 | allowance | contract ETH2_0 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}. |
74 | ETH2_0 | approve | contract ETH2_0 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. |
74 | ETH2_0 | transferFrom | contract ETH2_0 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... |
74 | ETH2_0 | increaseAllowance | contract ETH2_0 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... |
74 | ETH2_0 | decreaseAllowance | contract ETH2_0 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... |
74 | ETH2_0 | addApprove | contract ETH2_0 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... |
74 | ETH2_0 | _transfer | contract ETH2_0 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... |
74 | ETH2_0 | _mint | contract ETH2_0 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. |
74 | ETH2_0 | _burn | contract ETH2_0 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. |
74 | ETH2_0 | _approve | contract ETH2_0 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:
... |
74 | ETH2_0 | _approveCheck | contract ETH2_0 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:
... |
74 | ETH2_0 | _setupDecimals | contract ETH2_0 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. |
74 | ETH2_0 | _beforeTokenTransfer | contract ETH2_0 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 ... | |
78 | BoringOwnable | null | contract BoringOwnable is BoringOwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/// @notice `owner` defaults to msg.sender on construction.
constructor() public {<FILL_FUNCTION_BODY>}
/// @notice Transfers ownership to `newOwner`. Either directly or claimable by ... |
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
| / @notice `owner` defaults to msg.sender on construction. |
78 | BoringOwnable | transferOwnership | contract BoringOwnable is BoringOwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/// @notice `owner` defaults to msg.sender on construction.
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/// @notice Transfers ... |
if (direct) {
// Checks
require(newOwner != address(0) || renounce, "BoringOwnable::transferOwnership: zero address");
// Effects
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
pendingOwner = address(0);
} else {
// Effects
pendingOwner = newOwner;
}
| / @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
/ Can only be invoked by the current `owner`.
/ @param newOwner Address of the new owner.
/ @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
/ @param renounce... |
78 | BoringOwnable | claimOwnership | contract BoringOwnable is BoringOwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/// @notice `owner` defaults to msg.sender on construction.
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/// @notice Transfers ... |
address _pendingOwner = pendingOwner;
// Checks
require(msg.sender == _pendingOwner, "BoringOwnable::claimOwnership: caller != pending owner");
// Effects
emit OwnershipTransferred(owner, _pendingOwner);
owner = _pendingOwner;
pendingOwner = address(0);
| / @notice Needs to be called by `pendingOwner` to claim ownership. |
80 | Domain | _calculateDomainSeparator | contract Domain {
bytes32 private constant DOMAIN_SEPARATOR_SIGNATURE_HASH =
keccak256("EIP712Domain(uint256 chainId,address verifyingContract)");
// See https://eips.ethereum.org/EIPS/eip-191
string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01";
// solhint-disable var-name-mixedcase
by... |
return keccak256(abi.encode(DOMAIN_SEPARATOR_SIGNATURE_HASH, chainId, address(this)));
| / @dev Calculate the DOMAIN_SEPARATOR |
80 | Domain | _domainSeparator | contract Domain {
bytes32 private constant DOMAIN_SEPARATOR_SIGNATURE_HASH =
keccak256("EIP712Domain(uint256 chainId,address verifyingContract)");
// See https://eips.ethereum.org/EIPS/eip-191
string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01";
// solhint-disable var-name-mixedcase
by... |
uint256 chainId;
assembly {
chainId := chainid()
}
return chainId == DOMAIN_SEPARATOR_CHAIN_ID ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(chainId);
| / @dev Return the DOMAIN_SEPARATOR
It's named internal to allow making it public from the contract that uses it by creating a simple view function
with the desired public name, such as DOMAIN_SEPARATOR or domainSeparator.
solhint-disable-next-line func-name-mixedcase |
83 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 bal... | / @return total amount of tokens | |
83 | Token | balanceOf | 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) {<FILL_FUNCTIO... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
83 | Token | transfer | 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 | |
83 | Token | transferFrom | 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 `_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 | |
83 | Token | approve | 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 `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 | |
83 | Token | allowance | 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) {}
/// ... | / @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 | |
83 | AtpcCoin | approveAndCall | contract AtpcCoin is StandardToken {
/* Public variables of the token */
string public name;
uint8 public decimals;
string public symbol;
string public version = 'H1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH?
uint256 public tot... |
allowed[msg.sender][_spender] = _value;
emit 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.
//receiveA... | Approves and then calls the receiving contract |
85 | ERC721 | null | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_name = name_;
_symbol = symbol_;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
| *
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. |
85 | ERC721 | balanceOf | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(owner != address(0), "ERC721: balance query for the zero address");
return _holderTokens[owner].length();
| *
* @dev See {IERC721-balanceOf}. |
85 | ERC721 | ownerOf | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
| *
* @dev See {IERC721-ownerOf}. |
85 | ERC721 | name | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _name;
| *
* @dev See {IERC721Metadata-name}. |
85 | ERC721 | symbol | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _symbol;
| *
* @dev See {IERC721Metadata-symbol}. |
85 | ERC721 | tokenURI | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
... | *
* @dev See {IERC721Metadata-tokenURI}. |
85 | ERC721 | baseURI | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _baseURI;
| *
* @dev Returns the base URI set via {_setBaseURI}. This will be
* automatically added as a prefix in {tokenURI} to each token's URI, or
* to the token ID if no specific URI is set for that token ID. |
85 | ERC721 | tokenOfOwnerByIndex | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _holderTokens[owner].at(index);
| *
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. |
85 | ERC721 | totalSupply | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
// _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
return _tokenOwners.length();
| *
* @dev See {IERC721Enumerable-totalSupply}. |
85 | ERC721 | tokenByIndex | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
(uint256 tokenId, ) = _tokenOwners.at(index);
return tokenId;
| *
* @dev See {IERC721Enumerable-tokenByIndex}. |
85 | ERC721 | approve | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tok... | *
* @dev See {IERC721-approve}. |
85 | ERC721 | getApproved | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
| *
* @dev See {IERC721-getApproved}. |
85 | ERC721 | setApprovalForAll | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
| *
* @dev See {IERC721-setApprovalForAll}. |
85 | ERC721 | isApprovedForAll | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _operatorApprovals[owner][operator];
| *
* @dev See {IERC721-isApprovedForAll}. |
85 | ERC721 | transferFrom | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
| *
* @dev See {IERC721-transferFrom}. |
85 | ERC721 | safeTransferFrom | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
safeTransferFrom(from, to, tokenId, "");
| *
* @dev See {IERC721-safeTransferFrom}. |
85 | ERC721 | safeTransferFrom | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
| *
* @dev See {IERC721-safeTransferFrom}. |
85 | ERC721 | _safeTransfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
| *
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This i... |
85 | ERC721 | _exists | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
return _tokenOwners.contains(tokenId);
| *
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`). |
85 | ERC721 | _isApprovedOrOwner | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
| *
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist. |
85 | ERC721 | _safeMint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_safeMint(to, tokenId, "");
| *
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
d*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event. |
85 | ERC721 | _safeMint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
| *
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients. |
85 | ERC721 | _mint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(address(0)... | *
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event. |
85 | ERC721 | _burn | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
address owner = ERC721.ownerOf(tokenId); // internal owner
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
// Clear metadata (if any)
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenU... | *
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event. |
85 | ERC721 | _transfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(addre... | *
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event. |
85 | ERC721 | _setTokenURI | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
| *
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist. |
85 | ERC721 | _setBaseURI | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_baseURI = baseURI_;
| *
* @dev Internal function to set the base URI for all token IDs. It is
* automatically added as a prefix to the value returned in {tokenURI},
* or to the token ID if {tokenURI} is empty. |
85 | ERC721 | _checkOnERC721Received | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
if (!to.isContract()) {
return true;
}
bytes memory returndata = to.functionCall(abi.encodeWithSelector(
IERC721Receiver(to).onERC721Received.selector,
_msgSender(),
from,
tokenId,
_data
), "ERC721: transf... | *
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the to... |
85 | ERC721 | _approve | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... |
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
| *
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event. |
85 | ERC721 | _beforeTokenTransfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(addre... | *
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to... | |
88 | BasicToken | transfer | 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) pub... |
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. |
88 | BasicToken | balanceOf | 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) pub... |
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. |
88 | Ico | 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
uint25... |
// 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;... | *
* ICO constructor
* Define ICO details and contribution period |
88 | Ico | participate | 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
uint25... |
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... | *
*
* 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. |
88 | 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
uint25... |
participate(msg.sender);
| *
*
* We fallback to the partcipate function | |
88 | Ico | freeze | 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
uint25... |
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 = au... | *
* Internal burn function, only callable by team
*
* @param _amount is the amount of tokens to burn. |
88 | Ico | reportProfit | 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
uint25... |
// 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
addNewDivide... | *
* Calculate the divends for the current period given the AUM profit
*
* @param totalProfit is the amount of total profit in USD. |
88 | Ico | addNewDividends | 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
uint25... |
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
... | *
* Calculate the divends for the current period given the dividend
* amounts (USD * tokenPrecision). |
88 | Ico | liquidate | 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
uint25... |
selfdestruct(owner);
| *
* Withdraw all funds and kill fund smart contract |
88 | Ico | getOwedDividend | 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
uint25... |
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];
... | getter to retrieve divident owed |
88 | Ico | balanceOf | 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
uint25... |
var (owedDividend, /* dividends */) = getOwedDividend(_owner);
return BasicToken.balanceOf(_owner).add(owedDividend);
| monkey patches |
88 | Ico | reconcileDividend | 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
uint25... |
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) {
balanc... | Reconcile all outstanding dividends for an address
into its balance. |
97 | MyFriendships | MyFriendships | contract MyFriendships {
address public me;
uint public numberOfFriends;
address public latestFriend;
mapping(address => bool) myFriends;
/**
* @dev Create a contract to keep track of my friendships.
*/
function MyFriendships() public {<FILL_FUNCTION_BODY>}
/**
... |
me = msg.sender;
| *
* @dev Create a contract to keep track of my friendships. |
97 | MyFriendships | becomeFriendsWithMe | contract MyFriendships {
address public me;
uint public numberOfFriends;
address public latestFriend;
mapping(address => bool) myFriends;
/**
* @dev Create a contract to keep track of my friendships.
*/
function MyFriendships() public {
me = msg.sender;
}
... |
require(msg.sender != me); // I won't be friends with myself.
myFriends[msg.sender] = true;
latestFriend = msg.sender;
numberOfFriends++;
| *
* @dev Start an exciting new friendship with me. |
97 | MyFriendships | friendsWith | contract MyFriendships {
address public me;
uint public numberOfFriends;
address public latestFriend;
mapping(address => bool) myFriends;
/**
* @dev Create a contract to keep track of my friendships.
*/
function MyFriendships() public {
me = msg.sender;
}
... |
return myFriends[addr];
| *
* @dev Am I friends with this address? |
99 | Initializable | isConstructor | contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function ... |
// 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 constr... | / @dev Returns true if and only if the function is running in the constructor |
99 | ContextUpgradeSafe | __Context_init | 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 {<FILL_FUNCTION_BODY>}
function __Context_init_unchained... |
__Context_init_unchained();
| Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. |
99 | OwnableUpgradeSafe | __Ownable_init | 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(... |
__Context_init_unchained();
__Ownable_init_unchained();
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
99 | OwnableUpgradeSafe | owner | 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(... |
return _owner;
| *
* @dev Returns the address of the current owner. |
99 | OwnableUpgradeSafe | renounceOwnership | 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(... |
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 ... |
99 | OwnableUpgradeSafe | transferOwnership | 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(... |
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. |
99 | Unbonded | setTokenContract | 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_... |
token = IERC20(_tokenAddress);
| *
* @dev Sets the Plutus ERC-20 token contract address |
99 | Unbonded | setTGE | 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_... |
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. |
99 | Unbonded | addToWhitelist | 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_... |
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. |
99 | Unbonded | claimPrivateTokens | 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_... |
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);
... | *
* @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 |
99 | Unbonded | claimCommunityTokens | 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_... |
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 -... | *
* @dev claim community tokens from the contract balance.
* Can be used only by an owner or from communityAddress |
101 | MetaProxyFactory | _metaProxyFromCalldata | contract MetaProxyFactory {
/// @dev Creates a child with metadata from calldata.
/// Copies everything from calldata except the first 4 bytes.
function _metaProxyFromCalldata () internal returns (address addr) {<FILL_FUNCTION_BODY>}
} |
// the following assembly code (init code + contract code) constructs a metaproxy.
assembly {
// load free memory pointer as per solidity convention
let start := mload(64)
// copy
let ptr := start
// deploy code (11 bytes) + first part of the proxy (21 bytes)
mstore(ptr, 0x6... | / @dev Creates a child with metadata from calldata.
/ Copies everything from calldata except the first 4 bytes. |
102 | ALCOIN | ALCOIN | contract ALCOIN {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (add... |
initialSupply = 500000000000;
name = "LATINO AMERICA COIN";
decimals = 3;
symbol = "ALC";
balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
totalSupply = initialSupply; // Update total sup... | Initializes contract with initial supply tokens to the creator of the contract |
102 | ALCOIN | transfer | contract ALCOIN {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (add... |
if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough
if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
balanceOf[msg.sender] -= _value; // Subtract from the sender
balanceOf[_to] += _value; ... | Send coins |
102 | ALCOIN | contract ALCOIN {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (add... |
throw; // Prevents accidental sending of ether
| This unnamed function is called whenever someone tries to send ether to it |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.