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 |
|---|---|---|---|---|---|
180 | MrBanker | withdraw | contract MrBanker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 earlyRewardM... |
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(user.rewardDebt);
safeSushiTr... | Withdraw LP tokens from MrBanker. |
180 | MrBanker | emergencyWithdraw | contract MrBanker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 earlyRewardM... |
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
user.amount = 0;
user.rewardDebt = 0;
| Withdraw without caring about rewards. EMERGENCY ONLY. |
180 | MrBanker | safeSushiTransfer | contract MrBanker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 earlyRewardM... |
uint256 sushiBal = sushi.balanceOf(address(this));
if (_amount > sushiBal) {
sushi.transfer(_to, sushiBal);
} else {
sushi.transfer(_to, _amount);
}
| Safe boo transfer function, just in case if rounding error causes pool to not have enough BOOBs. |
180 | MrBanker | setBurnRate | contract MrBanker is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 earlyRewardM... |
require(_burnDivisor > 0, "Boo: burnDivisor must be bigger than 0");
sushi.setBurnRate(_burnDivisor);
| Set burn rate for both BooBank and Ectoplasma |
181 | 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. |
181 | 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. |
181 | 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. |
181 | 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
* ... |
181 | 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}. |
181 | 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}. |
181 | 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`. |
181 | 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}. |
181 | 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. |
181 | 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... |
181 | 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... |
181 | 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... |
181 | 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... |
181 | 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. |
181 | 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. |
181 | 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:
... |
181 | 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. |
181 | 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 ... | |
183 | ArticCoin | ArticCoin | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
totalSupply = 10000000000000000000000000 * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = 10000000000000000000000000; // Give the creator all initial tokens
name = "ArticCoin"; // Set the name ... | *
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
183 | ArticCoin | _transfer | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
// 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 |
183 | ArticCoin | transfer | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
_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 |
183 | ArticCoin | transferFrom | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
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 |
183 | ArticCoin | approve | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
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 |
183 | ArticCoin | approveAndCall | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
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... |
183 | ArticCoin | burn | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
183 | ArticCoin | burnFrom | contract ArticCoin {
// Public variables of the token
string public name = "ArticCoin";
string public symbol = "ART";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balance... |
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 |
184 | DSTokenBase | totalSupply | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
return _supply;
| *
* @dev Total number of tokens in existence |
184 | DSTokenBase | balanceOf | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
return _balances[src];
| *
* @dev Gets the balance of the specified address.
* @param src The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address. |
184 | DSTokenBase | allowance | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
return _approvals[src][guy];
| *
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param src address The address which owns the funds.
* @param guy address The address which will spend the funds. |
184 | DSTokenBase | transfer | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
return transferFrom(msg.sender, dst, wad);
| *
* @dev Transfer token for a specified address
* @param dst The address to transfer to.
* @param wad The amount to be transferred. |
184 | DSTokenBase | transferFrom | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
if (src != msg.sender) {
_approvals[src][msg.sender] = sub(_approvals[src][msg.sender], wad);
}
_balances[src] = sub(_balances[src], wad);
_balances[dst] = add(_balances[dst], wad);
emit Transfer(src, dst, wad);
return true;
... | *
* @dev Transfer tokens from one address to another
* @param src address The address which you want to send tokens from
* @param dst address The address which you want to transfer to
* @param wad uint256 the amount of tokens to be transferred |
184 | DSTokenBase | approve | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
_approvals[msg.sender][guy] = wad;
emit Approval(msg.sender, guy, wad);
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... |
184 | DSTokenBase | increaseAllowance | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
require(src != address(0));
_approvals[src][msg.sender] = add(_approvals[src][msg.sender], wad);
emit Approval(msg.sender, src, _approvals[msg.sender][src]);
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
... |
184 | DSTokenBase | decreaseAllowance | contract DSTokenBase is ERC20, DSMath {
uint256 _supply;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _approvals;
constructor(uint supply) public {
_balances[msg.send... |
require(src != address(0));
_approvals[src][msg.sender] = sub(_approvals[src][msg.sender], wad);
emit Approval(msg.sender, src, _approvals[msg.sender][src]);
return true;
| *
* @dev Decrese 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
... |
184 | ZDTToken | isAdmin | contract ZDTToken is DSTokenBase , DSStop {
string public symbol="ZDT";
string public name="Zenoshi Dividend Token";
uint256 public decimals = 8; // Token Precision every token is 1.00000000
uint256 public initialSupply=90000000000000000;// 900000000+8 zeros for decimals
add... |
return msg.sender == burnAdmin;
| *
* @return true if `msg.sender` is the owner of the contract. |
184 | ZDTToken | renounceOwnership | contract ZDTToken is DSTokenBase , DSStop {
string public symbol="ZDT";
string public name="Zenoshi Dividend Token";
uint256 public decimals = 8; // Token Precision every token is 1.00000000
uint256 public initialSupply=90000000000000000;// 900000000+8 zeros for decimals
add... |
burnAdmin = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore. |
184 | ZDTToken | burnfromAdmin | contract ZDTToken is DSTokenBase , DSStop {
string public symbol="ZDT";
string public name="Zenoshi Dividend Token";
uint256 public decimals = 8; // Token Precision every token is 1.00000000
uint256 public initialSupply=90000000000000000;// 900000000+8 zeros for decimals
add... |
require(guy != address(0));
_balances[guy] = sub(_balances[guy], wad);
_supply = sub(_supply, wad);
emit Burn(guy, wad);
emit Transfer(guy, address(0), wad);
| *
* @dev Burns a specific amount of tokens from the target address
* @param guy address The address which you want to send tokens from
* @param wad uint256 The amount of token to be burned |
187 | 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() public {<FILL_FUNCTION_BODY>}
/... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
187 | 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() public {
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. |
187 | StandardToken | increaseApproval | contract StandardToken is iERC20Token {
using SafeMath for uint256;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
function transfer(address _to, uint _value) public returns (bool success) {
require(_to != address(0));
require(_value ... |
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 |
187 | FreezableToken | contractFallback | contract FreezableToken is iERC223Token, StandardToken, Ownable {
event ContractTransfer(address indexed _from, address indexed _to, uint _value, bytes _data);
bool public freezed;
modifier canTransfer(address _transferer) {
require(owner == _transferer || !freezed);
_;
}
... |
ContractTransfer(_origin, _to, _value, _data);
ERC223Receiver reciever = ERC223Receiver(_to);
require(reciever.tokenFallback(_origin, _value, _data));
return true;
| function that is called when transaction target is a contract |
187 | FreezableToken | isContract | contract FreezableToken is iERC223Token, StandardToken, Ownable {
event ContractTransfer(address indexed _from, address indexed _to, uint _value, bytes _data);
bool public freezed;
modifier canTransfer(address _transferer) {
require(owner == _transferer || !freezed);
_;
}
... |
uint length;
assembly { length := extcodesize(_addr) }
return length > 0;
| assemble the given address bytecode. If bytecode exists then the _addr is a contract. |
190 | Feed | Feed | contract Feed is Owned {
uint public basePrice=0.005 ether;
uint public k=1;
uint public showInterval=15;
uint public totalMessages=0;
struct Message
{
string content;
uint date;
address sender;
uint price;
uint show_date;
uint ... | Initializes contract | |
193 | Ownable | null | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
193 | Ownable | owner | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
return _owner;
| *
* @dev Returns the address of the current owner. |
193 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
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 av... |
193 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
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. |
193 | Ownable | lock | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
| Locks the contract for owner for the amount of time provided |
193 | Ownable | unlock | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the ... |
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
| Unlocks the contract for owner when _lockTime is exceeds |
193 | SIB | manualSwap | contract SIB is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
m... |
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
| We are exposing these functions to be able to manual swap and send
in case the token is highly valued and 5M becomes too much |
193 | SIB | null | contract SIB is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
m... | to recieve ETH from uniswapV2Router when swaping | |
194 | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
// uint256 durationInMinutes;
// address where funds are collected
address public wallet;
// token address
address public addressOfTokenUsedAsReward;
uint256 public price = 1818;
token tokenReward;
// mapping (address => uint) public co... |
buyTokens(msg.sender,"");
| fallback function can be used to buy tokens | |
194 | Crowdsale | buyTokens | contract Crowdsale {
using SafeMath for uint256;
// uint256 durationInMinutes;
// address where funds are collected
address public wallet;
// token address
address public addressOfTokenUsedAsReward;
uint256 public price = 1818;
token tokenReward;
// mapping (address => uint) public co... |
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
// if(weiAmount < 10**16) throw;
// if(weiAmount > 50*10**18) throw;
// calculate token amount to be sent
uint256 tokens = (weiAmount) * price;//weiamount * price
if (promoCode == ... | low level token purchase function |
194 | Crowdsale | forwardFunds | contract Crowdsale {
using SafeMath for uint256;
// uint256 durationInMinutes;
// address where funds are collected
address public wallet;
// token address
address public addressOfTokenUsedAsReward;
uint256 public price = 1818;
token tokenReward;
// mapping (address => uint) public co... |
// wallet.transfer(msg.value);
if (!wallet.send(msg.value)) {
throw;
}
| send ether to the fund collection wallet
override to create custom fund forwarding mechanisms |
194 | Crowdsale | validPurchase | contract Crowdsale {
using SafeMath for uint256;
// uint256 durationInMinutes;
// address where funds are collected
address public wallet;
// token address
address public addressOfTokenUsedAsReward;
uint256 public price = 1818;
token tokenReward;
// mapping (address => uint) public co... |
bool withinPeriod = started;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
| @return true if the transaction can buy tokens |
195 | 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) {}
/// @notice... | / @return total amount of tokens | |
195 | 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>}
/// @notice... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
195 | 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... | / @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 | |
195 | 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... | / @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 | |
195 | 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 send `_value` token... | / @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 | |
195 | 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 send `_value` token... | / @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 | |
195 | ERC20Token | ERC20Token | contract ERC20Token is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
string public name = "Rainbow Token"; //Name of the token
uint8 public decimals = 18; //How many decimals to show. ie. There could 1000 base units with 3 decima... |
balances[msg.sender] = 450000000000000000000000000000000; // Give the creator all initial tokens (100000 for example)
totalSupply = 900000000000000000000000000000000; // Update total supply (100000 for example)
name = "Rainbow Token"; // Set the name for display purposes
decimals = 18; // Amount of decimals
... | make sure this function name matches the contract name above. So if you’re token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token |
195 | ERC20Token | approveAndCall | contract ERC20Token is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
string public name = "Rainbow Token"; //Name of the token
uint8 public decimals = 18; //How many decimals to show. ie. There could 1000 base units with 3 decima... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn’t have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _valu... | Approves and then calls the receiving contract |
196 | Ownable | Ownable | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
m... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
196 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
... |
require(newOwner != address(0));
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
196 | ZNCoin | batchTransfer | contract ZNCoin is ERC20,ZNCoinStandard,Ownable {
using SafeMath for uint256;
string public name = "ZNCoin";
string public symbol = "ZNC";
uint public decimals = 18;
uint public chainStartTime; //chain start time
uint public chainStartBlockNumber; //chain start block number
uint p... |
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
uint64 _now = uint64(now);
for(uin... | Batch token transfer. Used by contract creator to distribute initial tokens to holders |
197 | UNOS_Lock_Dec | transferAnyERC20Tokens | contract UNOS_Lock_Dec is Ownable {
using SafeMath for uint;
address public constant tokenAddress = 0xd18A8abED9274eDBEace4B12D86A8633283435Da;
uint public constant tokensLocked = 13860e18; // 13860 UNOS
uint public constant unlockRate = 13860; // Unlock Date: 20 Dec... |
require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
UNOS(_tokenAddr).transfer(_to, _amount);
| function to allow admin to claim *other than UNOS* ERC20 tokens sent to this contract (by mistake) like USDT
UNOS can't be unlocked untill 20 Dec 2020 |
200 | 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() internal {<FILL_FUNCTION_BODY>}
/**... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
200 | 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() internal {
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. |
200 | Pausable | pause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = true;
Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
200 | Pausable | unpause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = false;
Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
200 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
require(_to != address(0x0));
// 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. |
200 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
return balances[_owner];
| *
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. |
200 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken, Pausable {
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 trans... |
require(_to != address(0x0));
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] = bal... | *
* @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 |
200 | JubsICO | JubsICO | contract JubsICO is StandardToken {
using SafeMath for uint256;
//Information coin
string public name = "Honor";
string public symbol = "HNR";
uint256 public decimals = 18;
uint256 public totalSupply = 100000000 * (10 ** decimals); //100 000 000 HNR
//Adress informated in white pa... |
//Address
walletETH = 0x6eA3ec9339839924a520ff57a0B44211450A8910;
icoWallet = 0x357ace6312BF8B519424cD3FfdBB9990634B8d3E;
preIcoWallet = 0x7c54dC4F3328197AC89a53d4b8cDbE35a56656f7;
teamWallet = 0x06BC5305016E9972F4cB3F6a3Ef2C734D417788a;
bountyMktWallet = 0x6f... | =================================== Constructor ============================================= |
200 | JubsICO | contract JubsICO is StandardToken {
using SafeMath for uint256;
//Information coin
string public name = "Honor";
string public symbol = "HNR";
uint256 public decimals = 18;
uint256 public totalSupply = 100000000 * (10 ** decimals); //100 000 000 HNR
//Adress informated in white pa... |
uint256 amount = msg.value.mul(rate);
assignTokens(msg.sender, amount);
totalRaised = totalRaised.add(msg.value);
forwardFundsToWallet();
| ========================================== Functions ===========================================================================
/ fallback function to buy tokens | |
204 | MthereumToken | balanceOf | contract MthereumToken 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;
function MthereumToken() public {
... |
return balances[tokenOwner];
| ------------------------------------------------------------------------ |
204 | MthereumToken | allowance | contract MthereumToken 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;
function MthereumToken() public {
... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------ |
204 | MthereumToken | approveAndCall | contract MthereumToken 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;
function MthereumToken() public {
... |
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
| ------------------------------------------------------------------------ |
205 | svb | svb | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
if (supply > 0) {
totalSupply = supply;
} else {
totalSupply = totalSupplyDefault;
}
owner = msg.sender;
demurringFeeOwner = owner;
transferFeeOwner = owner;
balances[this] = totalSupply;
| if supply provided is 0, then default assigned |
205 | svb | chargeDemurringFee | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
if (addr != owner && addr != transferFeeOwner && addr != demurringFeeOwner && balances[addr] > 0 && now > timestamps[addr] + 60) {
var mins = (now - timestamps[addr]) / 60;
var fee = balances[addr] * mins * demurringFeeNum / demurringFeeDenum;
if (fee < minFee) {
... | charge demurring fee for previuos period
fee is not applied to owners |
205 | svb | chargeTransferFee | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
if (addr != owner && addr != transferFeeOwner && addr != demurringFeeOwner && balances[addr] > 0) {
var fee = amount * transferFeeNum / transferFeeDenum;
if (fee < minFee) {
fee = minFee;
} else if (fee > balances[addr]) {
fee = balances... | fee is not applied to owners |
205 | svb | issue | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
if (totalSupply + amount > totalSupply) {
totalSupply += amount;
balances[this] += amount;
}
| issue new coins |
205 | svb | destroy | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
require(amount>0 && balances[this] >= amount);
balances[this] -= amount;
totalSupply -= amount;
| destroy existing coins |
205 | svb | kill | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
require (totalSupply == 0);
selfdestruct(owner);
| kill contract only if all wallets are empty |
205 | svb | contract svb {
// totalSupply is zero by default, owner can issue and destroy coins any amount any time
uint constant totalSupplyDefault = 0;
string public constant symbol = "SVB";
string public constant name = "Silver";
uint8 public constant decimals = 5;
// minimum fee is 0.00001
... |
revert();
| payments ar reverted back | |
208 | 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 (ui... | / @return total amount of tokens | |
208 | 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) {<FIL... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
208 | 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 | |
208 | 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 | |
208 | 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 | |
208 | 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 | |
208 | KoinTradeExchange | KoinTradeExchange | contract KoinTradeExchange 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 co... |
balances[msg.sender] = 900000000000000000000000000; // 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 = 900000000000000000000000000; ... | 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 |
208 | KoinTradeExchange | batchTransfer | contract KoinTradeExchange 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 co... |
require(_dests.length == _values.length);
uint256 i = 0;
while (i < _dests.length) {
transfer(_dests[i], _values[i]);
i += 1;
}
| *
* @dev Batch transfer some tokens to some addresses, address and value is one-on-one.
* @param _dests Array of addresses
* @param _values Array of transfer tokens number |
208 | KoinTradeExchange | batchTransferSingleValue | contract KoinTradeExchange 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 co... |
uint256 i = 0;
while (i < _dests.length) {
transfer(_dests[i], _value);
i += 1;
}
| *
* @dev Batch transfer equal tokens amout to some addresses
* @param _dests Array of addresses
* @param _value Number of transfer tokens amount |
208 | KoinTradeExchange | approveAndCall | contract KoinTradeExchange 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 co... |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.