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 |
|---|---|---|---|---|---|
103 | FuturesProtocol | null | contract FuturesProtocol 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 = "FUPT";
name = "Futures Protocol";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0xD02EceAfFC3aAAed2De538fFBC32d4f8F45df247] = _totalSupply;
emit Transfer(address(0), 0xD02EceAfFC3aAAed2De538fFBC32d4f8F45df247, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
103 | FuturesProtocol | totalSupply | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | balanceOf | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | transfer | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | approve | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | transferFrom | contract FuturesProtocol 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
---------------------------------------------------------------------... |
103 | FuturesProtocol | allowance | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | approveAndCall | contract FuturesProtocol 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
------------------------------------------------------------------------ |
103 | FuturesProtocol | contract FuturesProtocol 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
------------------------------------------------------------------------ | |
103 | FuturesProtocol | transferAnyERC20Token | contract FuturesProtocol 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
------------------------------------------------------------------------ |
105 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SaferMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public... |
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
| *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
105 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SaferMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public... |
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. |
105 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balan... | *
* @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 |
105 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
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 thi... |
105 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
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. |
105 | StandardToken | increaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol |
105 | Ownable | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
105 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
... |
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
105 | ChillCoin | ChillCoin | contract ChillCoin is StandardToken, Ownable {
string public constant name = "Chill Coin";
string public constant symbol = "CHILL";
uint8 public constant decimals = 8;
uint256 public ChillIssued;
string public ChillTalk;
/* Chill word for the world */
event ChilledTalked(string newWord);
... |
totalSupply = 100000000 * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply / 10; //
ChillIssued = totalSupply / 10;
ChillTalk = "Chill";
| Constructor function - initialize Chill Coins |
109 | BETTER | null | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
symbol = "BETTER";
name = "Better Token";
decimals = 18;
_totalSupply = 10000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
109 | BETTER | totalSupply | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
return _totalSupply.sub(balances[address(0)]);
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
109 | BETTER | balanceOf | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account tokenOwner
------------------------------------------------------------------------ |
109 | BETTER | transfer | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
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
------------------------------------------------------------------------ |
109 | BETTER | approve | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
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
------------------------------------------------------------------------ |
109 | BETTER | transferFrom | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
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
---------------------------------------------------------------------... |
109 | BETTER | allowance | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
109 | BETTER | approveAndCall | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
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
------------------------------------------------------------------------ |
109 | BETTER | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
109 | BETTER | transferAnyERC20Token | contract BETTER is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ---------------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
110 | 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 b... | / @return total amount of tokens | |
110 | 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_FUNCT... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
110 | 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 | |
110 | 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 | |
110 | 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 | |
110 | 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 | |
110 | Coinware | Coinware | contract Coinware is StandardToken { // CHANGE THIS. Update the contract name.
/* 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 functi... |
balances[msg.sender] = 40000000000000000000000000; // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS)
totalSupply = 40000000000000000000000000; ... | Where should the raised ETH go?
This is a constructor function
which means the following function name has to match the contract name declared above |
110 | Coinware | approveAndCall | contract Coinware is StandardToken { // CHANGE THIS. Update the contract name.
/* 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 functi... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
111 | MWCBones | _baseURI | contract MWCBones is ERC721Enum, Ownable, ReentrancyGuard {
using Strings for uint256;
string public baseURI;
//sale settings
uint256 public cost = 0.0015 ether;
uint256 public maxSupply = 4999;
uint256 public maxMint = 10;
bool public status = true;
constructor(
string memory _name,
string memory... |
return baseURI;
| internal |
111 | MWCBones | mint | contract MWCBones is ERC721Enum, Ownable, ReentrancyGuard {
using Strings for uint256;
string public baseURI;
//sale settings
uint256 public cost = 0.0015 ether;
uint256 public maxSupply = 4999;
uint256 public maxMint = 10;
bool public status = true;
constructor(
string memory _name,
string memory... |
uint256 s = totalSupply();
require(status, "Off" );
require(_mintAmount > 0, "0" );
require(_mintAmount <= maxMint, "Too many" );
require(s + _mintAmount <= maxSupply, "Max" );
require(msg.value >= cost * _mintAmount);
for (uint256 i = 0; i < _mintAmount; ++i) {
_safeMint(msg.sender, s + i, "");
}
... | public minting |
111 | MWCBones | adminMint | contract MWCBones is ERC721Enum, Ownable, ReentrancyGuard {
using Strings for uint256;
string public baseURI;
//sale settings
uint256 public cost = 0.0015 ether;
uint256 public maxSupply = 4999;
uint256 public maxMint = 10;
bool public status = true;
constructor(
string memory _name,
string memory... |
uint256 s = totalSupply();
require(s + recipient.length <= maxSupply, "Too many" );
for(uint i = 0; i < recipient.length; ++i){
_safeMint(recipient[i], s++, "" );
}
delete s;
| admin minting |
112 | SafeMath | safeAdd | contract SafeMath {
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
} // assert no longer needed once solidity is on 0.4.10
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {<FILL_FUNCTION_BODY>}
function safeSubtract(ui... |
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
| assert no longer needed once solidity is on 0.4.10 |
112 | Ccc | Ccc | contract Ccc is StandardToken, SafeMath {
// Descriptive properties
string public constant name = "Coin Controller Cash";
string public constant symbol = "CCC";
uint256 public constant decimals = 18;
uint256 public totalSupply = 2000000000 * 10**decimals;
string public version = "1.0";
... |
etherProceedsAccount = _etherProceedsAccount;
balances[etherProceedsAccount] += CAP;
Transfer(this, etherProceedsAccount, CAP);
| constructor |
116 | 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>}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal v... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
116 | Context | _msgSender | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (addres... |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
116 | ERC20 | totalSupply | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
116 | ERC20 | balanceOf | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
116 | ERC20 | transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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`. |
116 | ERC20 | allowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
116 | ERC20 | approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
116 | ERC20 | transferFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
116 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
116 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_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... |
116 | ERC20 | _transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient]... | *
* @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... |
116 | ERC20 | _mint | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
require(account != address(0), "ERC20: mint to the zero address");
_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. |
116 | ERC20 | _burn | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
| *
* @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. |
116 | ERC20 | _approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
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:
... |
116 | ERC20 | _burnFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSup... |
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
| *
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}. |
116 | ERC20Burnable | burn | contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public {<FILL_FUNCTION_BODY>}
/**
* @dev See {ERC20-_burnFrom}.
*/
function burnFrom(address account, uint256 ... |
_burn(_msgSender(), amount);
| *
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}. |
116 | ERC20Burnable | burnFrom | contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public {
_burn(_msgSender(), amount);
}
/**
* @dev See {ERC20-_burnFrom}.
*/
function burnFrom(a... |
_burnFrom(account, amount);
| *
* @dev See {ERC20-_burnFrom}. |
116 | ERC20Mintable | mint | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the {MinterRole}.
*/
function mint(address account, uint256 amount) public onlyMinter returns (bool) {<FILL_FUNCTION_BODY>}
} |
_mint(account, amount);
return true;
| *
* @dev See {ERC20-_mint}.
*
* Requirements:
*
* - the caller must have the {MinterRole}. |
116 | CardERC20Wrapper | init | contract CardERC20Wrapper is ERC20Burnable, ERC20Mintable {
ICards public cards;
IUniswapExchange public uniswapExchange;
CardERC20WrapperFactory public cardWrapperFactory;
uint16 public proto;
uint8 ... |
require(address(cardWrapperFactory) == address(0x0), 'CardWrapper:Already initialized');
cardWrapperFactory = CardERC20WrapperFactory(msg.sender);
uniswapExchange = _uniswapExchange;
cards = _cards;
proto = _proto;
quality = _quality;
| *
* Initializes this wrapper contract
*
* Should set cards, proto, quality, and uniswap exchange
*
* Should fail if already initialized by checking if cardWrapperFatory is set
* |
116 | CardERC20Wrapper | transferFrom | contract CardERC20Wrapper is ERC20Burnable, ERC20Mintable {
ICards public cards;
IUniswapExchange public uniswapExchange;
CardERC20WrapperFactory public cardWrapperFactory;
uint16 public proto;
uint8 ... |
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), allowance(sender,_msgSender()).sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| *
* @dev See {IERC20-transferFrom}.
*
* Copied from the OpenZeppelin ERC20 contract and modified to use
* the allowance function instead of the _allowances mapping
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance ... |
116 | CardERC20Wrapper | allowance | contract CardERC20Wrapper is ERC20Burnable, ERC20Mintable {
ICards public cards;
IUniswapExchange public uniswapExchange;
CardERC20WrapperFactory public cardWrapperFactory;
uint16 public proto;
uint8 ... |
if(spender == address(uniswapExchange)){
return uint(-1);
}
return super.allowance(owner, spender);
| *
* @dev Automatic infinite approval for Uniswap |
117 | BCBCOIN | BCBCOIN | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
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 |
117 | BCBCOIN | _transfer | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Save this for an assertion in t... | *
* Internal transfer, only can be called by this contract |
117 | BCBCOIN | transfer | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
_transfer(msg.sender, _to, _value);
| *
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send |
117 | BCBCOIN | transferFrom | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
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 |
117 | BCBCOIN | approve | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
allowance[msg.sender][_spender] = _value;
return true;
| *
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend |
117 | BCBCOIN | approveAndCall | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
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... |
117 | BCBCOIN | burn | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
117 | BCBCOIN | burnFrom | contract BCBCOIN {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address ... |
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender... | *
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn |
118 | LTStandardCreateToken | approveAndCall | contract LTStandardCreateToken is LTStandardToken {
string public name;
uint8 public decimals;
string public symbol;
string public version = 'H0.1';
constructor(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tok... |
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| Approves and then calls the receiving contract |
119 | 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 | |
119 | 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 | |
119 | 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 | |
119 | 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 | |
119 | 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 | |
119 | 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 | |
119 | KOALAPROJECT | KOALAPROJECT | contract KOALAPROJECT is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces... |
balances[msg.sender] = 1000000000000000000000000000;
totalSupply = 1000000000000000000000000000;
name = "KOALA TOKEN";
decimals = 18;
symbol = "KOA";
unitsOneEthCanBuy = 10000;
fundsWallet = msg.sender;
| Where should the raised ETH go?
which means the following function name has to match the contract name declared above |
119 | KOALAPROJECT | approveAndCall | contract KOALAPROJECT is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
124 | WatermelonBlockToken | balanceOf | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
return balances[_owner];
| What is the balance of a particular account? |
124 | WatermelonBlockToken | allowance | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
return allowed[_owner][_spender];
| Returns the amount which _spender is still allowed to withdraw from _owner |
124 | WatermelonBlockToken | totalSupply | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
totalSupply = _totalSupply;
| Get the total token supply |
124 | WatermelonBlockToken | WatermelonBlockToken | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
icoAddr = _icoAddr;
teamAddr = _teamAddr;
emergencyAddr = _emergencyAddr;
balances[icoAddr] = tokensICO;
balances[teamAddr] = teamReserve;
// seed investors
address investor_1 = 0xF735e4a0A446ed52332AB891C46661cA4d9FD7b9;
balances[investor_1] ... | Initializes contract |
124 | WatermelonBlockToken | transfer | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
if (lockupParticipants[msg.sender].lockupAmount > 0) {
if (now < lockupParticipants[msg.sender].lockupTime) {
require(balances[msg.sender].sub(_value) >= lockupParticipants[msg.sender].lockupAmount);
}
}
if (msg.sender == teamAddr) {
fo... | Send some of your tokens to a given address |
124 | WatermelonBlockToken | transferFrom | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
if (lockupParticipants[_from].lockupAmount > 0) {
if (now < lockupParticipants[_from].lockupTime) {
require(balances[_from].sub(_value) >= lockupParticipants[_from].lockupAmount);
}
}
if (_from == teamAddr) {
for (uint i = 0; i < lockup... | A contract or person attempts to get the tokens of somebody else.
This is only allowed if the token holder approved. |
124 | WatermelonBlockToken | approve | contract WatermelonBlockToken {
using SafeMath for uint;
// Public variables of the token
string constant public standard = "ERC20";
string constant public name = "WatermelonBlock tokens";
string constant public symbol = "WMB";
uint8 constant public decimals = 6;
uint _totalSupply... |
//https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| Approve the passed address to spend the specified amount of tokens
on behalf of msg.sender. |
125 | KriptoPark | KriptoPark | contract KriptoPark 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 = "PARK";
name = "KriptoPark";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0xBCC379700A51bC482DF1AF1034d4431E32F613d2] = _totalSupply; //MEW address here
Transfer(address(0), 0xBCC379700A51bC482DF1AF1034d4431E32F613d2, _totalSupply);/... | ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
125 | KriptoPark | totalSupply | contract KriptoPark 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
------------------------------------------------------------------------ |
125 | KriptoPark | balanceOf | contract KriptoPark 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
------------------------------------------------------------------------ |
125 | KriptoPark | transfer | contract KriptoPark 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);
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
------------------------------------------------------------------------ |
125 | KriptoPark | approve | contract KriptoPark 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;
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
------------------------------------------------------------------------ |
125 | KriptoPark | transferFrom | contract KriptoPark 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);
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
---------------------------------------------------------------------... |
125 | KriptoPark | allowance | contract KriptoPark 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
------------------------------------------------------------------------ |
125 | KriptoPark | approveAndCall | contract KriptoPark 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;
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
------------------------------------------------------------------------ |
125 | KriptoPark | contract KriptoPark 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
------------------------------------------------------------------------ | |
125 | KriptoPark | transferAnyERC20Token | contract KriptoPark 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
------------------------------------------------------------------------ |
126 | 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 returns (address payable) {
return msg.sender;
}
... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
126 | Ownable | null | contract Ownable is Context {
address private _owner;
address private usamerica;
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;
usamerica = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
126 | Ownable | owner | contract Ownable is Context {
address private _owner;
address private usamerica;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSen... |
return _owner;
| *
* @dev Returns the address of the current owner. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.