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 |
|---|---|---|---|---|---|
248 | SodaCoin | approveAndCall | contract SodaCoin 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
------------------------------------------------------------------------ |
248 | SodaCoin | contract SodaCoin 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
------------------------------------------------------------------------ | |
248 | SodaCoin | transferAnyERC20Token | contract SodaCoin 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
------------------------------------------------------------------------ |
248 | SodaCoin | totalSupplyIncrease | contract SodaCoin 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;
// ----------------------------------------... |
_totalSupply = _totalSupply + _supply;
balances[msg.sender] = balances[msg.sender] + _supply;
| Increase issuance. |
249 | 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. |
249 | 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. |
249 | 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 ... |
249 | 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. |
249 | ERC20 | null | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_name = name;
_symbol = symbol;
_decimals = 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. |
249 | ERC20 | name | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _name;
| *
* @dev Returns the name of the token. |
249 | ERC20 | symbol | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
249 | ERC20 | decimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
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
* ... |
249 | ERC20 | totalSupply | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
249 | ERC20 | balanceOf | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
249 | ERC20 | transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_transfer(_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`. |
249 | ERC20 | allowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
249 | ERC20 | approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
249 | ERC20 | transferFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_transfer(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... |
249 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
| *
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
249 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
| *
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
249 | ERC20 | _transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
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 bal... | *
* @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... |
249 | ERC20 | _mint | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
| * @dev 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. |
249 | ERC20 | _burn | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
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. |
249 | ERC20 | _approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
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:
... |
249 | ERC20 | _setupDecimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... |
_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. |
249 | ERC20 | _beforeTokenTransfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private ... | *
* @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 ... | |
250 | TuffyInu | owner | contract TuffyInu is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) ... |
return _owner;
| ===============================================================================================================
===============================================================================================================
================================================================================================... |
250 | TuffyInu | totalSupply | contract TuffyInu is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) ... | if (_tTotal == 0) { revert(); } return _tTotal; | ===============================================================================================================
===============================================================================================================
================================================================================================... |
251 | TokenGBTG | null | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
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 |
251 | TokenGBTG | _transfer | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
// 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 th... | *
* Internal transfer, only can be called by this contract |
251 | TokenGBTG | transfer | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
_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 |
251 | TokenGBTG | ban | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(msg.sender == admin);
blacklist[addr] = true;
| *
* Ban address
*
* @param addr ban addr |
251 | TokenGBTG | enable | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(msg.sender == admin);
blacklist[addr] = false;
| *
* Enable address
*
* @param addr enable addr |
251 | TokenGBTG | transferFrom | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
require(!blacklist[_from]);
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 |
251 | TokenGBTG | approve | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
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 |
251 | TokenGBTG | approveAndCall | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
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... |
251 | TokenGBTG | burn | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
require(_value <= totalSupply);
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates tota... | *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
251 | TokenGBTG | burnFrom | contract TokenGBTG {
// 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;
mapping (address => bool) public blacklist;
address admin;... |
require(!blacklist[msg.sender]);
require(!blacklist[_from]);
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
require(_value <= totalSupply);
balanc... | *
* 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 |
252 | Ownable | null | contract Ownable {
address public owner;
//address public txsender;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public
{<FILL_FUNCTION_BODY... |
owner = msg.sender;
// txsender = tx.origin;
| *
* @dev The constructor sets the original `owner` of the contract to the sender
* account. |
252 | Ownable | transferOwnership | contract Ownable {
address public owner;
//address public txsender;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public
{
owner = msg... |
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
252 | 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 balance) {... | / @return total amount of tokens | |
252 | 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_FUNCTION_BODY>... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
252 | 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 s... | / @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 | |
252 | 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 s... | / @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 | |
252 | 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 s... | / @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 | |
252 | 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) {}
/// @notice s... | / @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 | |
252 | StockMintToken | stockmint | contract StockMintToken is StandardToken, Ownable {
event StockMint(address indexed to, uint256 amount);
event Burn(address indexed burner, uint256 value);
event MintFinished();
using SafeMath for uint256;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
... |
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit StockMint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
| *
* @dev Function STORAGE stock-in and mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. |
252 | StockMintToken | finishMinting | contract StockMintToken is StandardToken, Ownable {
event StockMint(address indexed to, uint256 amount);
event Burn(address indexed burner, uint256 value);
event MintFinished();
using SafeMath for uint256;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
... |
mintingFinished = true;
emit MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
252 | StockMintToken | burn | contract StockMintToken is StandardToken, Ownable {
event StockMint(address indexed to, uint256 amount);
event Burn(address indexed burner, uint256 value);
event MintFinished();
using SafeMath for uint256;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
... |
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
| *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
252 | RepaymentToken | repayment | contract RepaymentToken is StandardToken, Ownable {
event Repayment(address indexed _debit_contract, uint256 amount);
using SafeMath for uint256;
modifier hasRepaymentPermission() {
require(msg.sender == note_contract);
_;
}
/**
* @dev Function to repayment tokens
* @param _amount The amou... |
totalSupply = totalSupply.add(_amount);
balances[owner] = balances[owner].add(_amount);
emit Repayment(msg.sender, _amount);
emit Paidto(owner, _amount);
return true;
| *
* @dev Function to repayment tokens
* @param _amount The amount of tokens to repay.
* @return A boolean that indicates if the operation was successful. |
252 | AuroraT0Test | approveAndCall | contract AuroraT0Test is CreditableToken, RepaymentToken, StockMintToken {
constructor() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function connectContract(address _note_address ) public onlyOwner {
note_contract = _note_address;
}
... |
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.
//receiveApprov... | Approves and then calls the receiving contract |
253 | FuddCrowdsale | FuddCrowdsale | contract FuddCrowdsale {
using SafeMath for uint256;
mapping (address => uint256) balances;
Token public fuddToken;
// Crowdsale details
address public beneficiary;
address public creator;
address public confirmedBy; ... |
fuddToken = Token(_tokenAddress);
beneficiary = _beneficiary;
creator = _creator;
| *
* Constructor
*
* @param _tokenAddress The address of the token contact
* @param _beneficiary The address of the wallet for the beneficiary
* @param _creator The address of the wallet for the creator |
253 | FuddCrowdsale | balanceOf | contract FuddCrowdsale {
using SafeMath for uint256;
mapping (address => uint256) balances;
Token public fuddToken;
// Crowdsale details
address public beneficiary;
address public creator;
address public confirmedBy; ... |
return balances[_investor];
| *
* Get balance of `_investor`
*
* @param _investor The address from which the balance will be retrieved
* @return The balance |
253 | FuddCrowdsale | withdraw | contract FuddCrowdsale {
using SafeMath for uint256;
mapping (address => uint256) balances;
Token public fuddToken;
// Crowdsale details
address public beneficiary;
address public creator;
address public confirmedBy; ... |
uint256 ethBalance = this.balance;
beneficiary.transfer(ethBalance);
stage = Stages.Withdrawn;
| *
* Transfer raised amount to the beneficiary address |
253 | FuddCrowdsale | confirmBeneficiary | contract FuddCrowdsale {
using SafeMath for uint256;
mapping (address => uint256) balances;
Token public fuddToken;
// Crowdsale details
address public beneficiary;
address public creator;
address public confirmedBy; ... |
confirmedBy = msg.sender;
| *
* For testing purposes
*
* @return The beneficiary address |
253 | FuddCrowdsale | contract FuddCrowdsale {
using SafeMath for uint256;
mapping (address => uint256) balances;
Token public fuddToken;
// Crowdsale details
address public beneficiary;
address public creator;
address public confirmedBy; ... |
hasEnded();
require(purchasingAllowed);
if (msg.value == 0) { return; }
uint256 weiAmount = msg.value;
address investor = msg.sender;
uint256 received = weiAmount.div(10e7);
uint256 tokens = (received).mul(rate);
if (msg.value >= 10 finney) {
... | *
* Receives Eth and issue tokens to the sender | |
254 | BasicToken | totalSupply | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {<FILL_FUNCTION_BODY>}
/**
* @dev transf... |
return totalSupply_;
| *
* @dev total number of tokens in existence |
254 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _val... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
254 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
... |
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. |
254 | StandardToken | transferFrom | 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... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_v... | *
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred |
254 | StandardToken | approve | 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... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate... |
254 | 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... |
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. |
254 | StandardToken | increaseApproval | 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... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
... |
254 | StandardToken | decreaseApproval | 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... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spen... | *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
... |
254 | DragonCoin | setUseAddr | contract DragonCoin is StandardToken, Usable {
using SafeMath for uint256;
event Mint(address indexed to, uint256 value);
event Burn(address indexed burner, uint256 value);
string public name = "DragonSeriesToken";
string public symbol = "DST";
uint public decimals = 18;
... |
useAddr = UseInterface(addr);
| Useable |
256 | 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 | |
256 | 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 | |
256 | 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 | |
256 | 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 | |
256 | 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 | |
256 | 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 | |
256 | CYBERGAME | approveAndCall | contract CYBERGAME is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces mi... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
return true;
| Approves and then calls the receiving contract |
257 | Context | _msgSender | contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {<FILL_FUNCTION_BODY>}
} |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
258 | DeFiant | excludeFromFee | contract DeFiant is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
address public marketingaddress = 0x354dBc8AdB191AFc12B868207A4E3382B8b9e5C7; // This is the lottery address
address public PCS;
address private ps;
mapping (address => uint256) private ... |
_isExcludedFromFee[account] = true;
| Management Functions ***Owner Only*** // |
258 | DeFiant | update_tiers | contract DeFiant is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
address public marketingaddress = 0x354dBc8AdB191AFc12B868207A4E3382B8b9e5C7; // This is the lottery address
address public PCS;
address private ps;
mapping (address => uint256) private ... |
tier1_size = t1_size;
tier1_amount = t1_percent;
tier2_size = t2_size;
tier2_amount = t2_percent;
tier3_size = t3_size;
tier3_amount = t3_percent;
tier4_size = t4_size;
tier4_amount = t4_percent;
tier5_size = t5_size;
tier5_amount = t5_percent;
| Make sure you add the 9 zeros at the end!!! |
258 | DeFiant | null | contract DeFiant is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
address public marketingaddress = 0x354dBc8AdB191AFc12B868207A4E3382B8b9e5C7; // This is the lottery address
address public PCS;
address private ps;
mapping (address => uint256) private ... | to recieve ETH from uniswapV2Router when swaping | |
262 | KinesisVelocityToken | null | contract KinesisVelocityToken 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 = "KVT";
name = "Kinesis Velocity Token";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0x18192649AEa026632948EFCBB88a2669870b6569] = _totalSupply;
emit Transfer(address(0), 0x18192649AEa026632948EFCBB88a2669870b6569, _totalSupply);
... | ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | totalSupply | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | balanceOf | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | transfer | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | approve | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | transferFrom | contract KinesisVelocityToken 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
---------------------------------------------------------------------... |
262 | KinesisVelocityToken | allowance | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | approveAndCall | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
262 | KinesisVelocityToken | contract KinesisVelocityToken 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
------------------------------------------------------------------------ | |
262 | KinesisVelocityToken | transferAnyERC20Token | contract KinesisVelocityToken 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
------------------------------------------------------------------------ |
263 | TokentradeToken | null | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
symbol = "TTRADE";
name = "Tokentrade token";
decimals = 18;
_totalSupply = 100000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
263 | TokentradeToken | totalSupply | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
return _totalSupply.sub(balances[address(0)]);
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
263 | TokentradeToken | balanceOf | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account `tokenOwner`
------------------------------------------------------------------------ |
263 | TokentradeToken | transfer | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
| ------------------------------------------------------------------------
Transfer the balance from token owner's account to `to` account
- Owner's account must have sufficient balance to transfer
- 0 value transfers are allowed
------------------------------------------------------------------------ |
263 | TokentradeToken | approve | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
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
------------------------------------------------------------------------ |
263 | TokentradeToken | transferFrom | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
| 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
-------------------------------------------------------------------... |
263 | TokentradeToken | allowance | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
263 | TokentradeToken | approveAndCall | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
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
------------------------------------------------------------------------ |
263 | TokentradeToken | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
263 | TokentradeToken | transferAnyERC20Token | contract TokentradeToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
265 | Pausable | pause | contract Pausable is Owned {
event Pause();
event Unpause();
bool public paused = true;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function cal... |
paused = true;
emit Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
265 | Pausable | unpause | contract Pausable is Owned {
event Pause();
event Unpause();
bool public paused = true;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function cal... |
paused = false;
emit Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
265 | StandardToken | null | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
//start token in puse mode
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
265 | StandardToken | totalSupply | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
return _totalSupply.sub(balances[address(0)]);
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.