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 |
|---|---|---|---|---|---|
85340 | LokiInu | balanceOf | contract LokiInu 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
------------------------------------------------------------------------ |
85340 | LokiInu | transfer | contract LokiInu 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
------------------------------------------------------------------------ |
85340 | LokiInu | approve | contract LokiInu 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
------------------------------------------------------------------------ |
85340 | LokiInu | transferFrom | contract LokiInu 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
---------------------------------------------------------------------... |
85340 | LokiInu | allowance | contract LokiInu 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
------------------------------------------------------------------------ |
85340 | LokiInu | approveAndCall | contract LokiInu 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
------------------------------------------------------------------------ |
85340 | LokiInu | contract LokiInu 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
------------------------------------------------------------------------ | |
85340 | LokiInu | transferAnyERC20Token | contract LokiInu 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
------------------------------------------------------------------------ |
85341 | Ownable | Ownable | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onl... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85341 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
mod... |
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. |
85341 | BasicToken | transfer | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
address public addressTeam = 0x04cFbFa64917070d7AEECd20225782240E8976dc;
bool public frozenAccountICO = true;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
function setFrozenAccountICO(boo... |
if (msg.sender != owner && msg.sender != addressTeam){
require(!frozenAccountICO);
}
require(!frozenAccount[_to]); // Check if recipient is frozen
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _t... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
85341 | BasicToken | balanceOf | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
address public addressTeam = 0x04cFbFa64917070d7AEECd20225782240E8976dc;
bool public frozenAccountICO = true;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
function setFrozenAccountICO(boo... |
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. |
85341 | 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
... |
if (msg.sender != owner && msg.sender != addressTeam){
require(!frozenAccountICO);
}
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
require(_to != address(0... | *
* @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 amout of tokens to be transfered |
85341 | 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
... |
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0... | *
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. |
85341 | 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 specifing the amount of tokens still available for the spender. |
85341 | MintableToken | mint | contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will rece... |
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
| *
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. |
85341 | MintableToken | finishMinting | contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will rece... |
mintingFinished = true;
emit MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
85341 | MahalaCoin | freezeAccount | contract MahalaCoin is Ownable, MintableToken {
using SafeMath for uint256;
string public constant name = "Mahala Coin";
string public constant symbol = "MHC";
uint32 public constant decimals = 18;
// address public addressTeam;
uint public summTeam;
function MahalaCoin() public {
s... |
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
| / @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/ @param target Address to be frozen
/ @param freeze either to freeze it or not |
85341 | Crowdsale | contract Crowdsale is Ownable {
using SafeMath for uint256;
// totalTokens
uint256 public totalTokens;
// soft cap
uint softcap;
// hard cap
uint hardcap;
MahalaCoin public token;
// balances for softcap
mapping(address => uint) public balances;
// balances for softcap
mapping(addr... |
procureTokens(msg.sender);
| fallback function can be used to Procure tokens | |
85341 | Crowdsale | procureTokens | contract Crowdsale is Ownable {
using SafeMath for uint256;
// totalTokens
uint256 public totalTokens;
// soft cap
uint softcap;
// hard cap
uint hardcap;
MahalaCoin public token;
// balances for softcap
mapping(address => uint) public balances;
// balances for softcap
mapping(addr... |
uint256 tokens;
uint256 weiAmount = msg.value;
uint256 backAmount;
require(beneficiary != address(0));
//minimum amount in ETH
require(weiAmount >= minQuanValues);
//maximum amount in ETH
require(weiAmount.add(balances[msg.sender]) <= maxQuanValues);
//hard cap
add... | low level token Pledge function |
85341 | Crowdsale | freezeAccount | contract Crowdsale is Ownable {
using SafeMath for uint256;
// totalTokens
uint256 public totalTokens;
// soft cap
uint softcap;
// hard cap
uint hardcap;
MahalaCoin public token;
// balances for softcap
mapping(address => uint) public balances;
// balances for softcap
mapping(addr... |
token.freezeAccount(target, freeze);
| / @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/ @param target Address to be frozen
/ @param freeze either to freeze it or not |
85341 | Crowdsale | mintToken | contract Crowdsale is Ownable {
using SafeMath for uint256;
// totalTokens
uint256 public totalTokens;
// soft cap
uint softcap;
// hard cap
uint hardcap;
MahalaCoin public token;
// balances for softcap
mapping(address => uint) public balances;
// balances for softcap
mapping(addr... |
token.mint(target, mintedAmount);
| / @notice Create `mintedAmount` tokens and send it to `target`
/ @param target Address to receive the tokens
/ @param mintedAmount the amount of tokens it will receive |
85342 | Owned | Owned | contract Owned {
/**
* Contract owner.
*
* This value is set at contract creation time.
*/
address owner;
/**
* Contract constructor.
*
* This sets the owner of the Owned contract at the time of contract
* creation.
*/
function Owned() public... |
owner = msg.sender;
| *
* Contract constructor.
*
* This sets the owner of the Owned contract at the time of contract
* creation. |
85342 | ChiSale | ChiSale | contract ChiSale is Owned {
/**
* The CHI token contract.
*/
ERC20 chiTokenContract;
/**
* The start date of the CHI sale in seconds since the UNIX epoch.
*
* This is equivalent to February 17th, 12:00:00 UTC.
*/
uint256 constant START_DATE = 1518868800;
... |
chiTokenContract = ERC20(_chiTokenAddress);
| *
* Contract constructor.
*
* This passes the address of the Chi token contract address to the
* Chi sale contract. Additionally it sets the owner to the contract
* creator. |
85342 | ChiSale | buy | contract ChiSale is Owned {
/**
* The CHI token contract.
*/
ERC20 chiTokenContract;
/**
* The start date of the CHI sale in seconds since the UNIX epoch.
*
* This is equivalent to February 17th, 12:00:00 UTC.
*/
uint256 constant START_DATE = 1518868800;
... |
require(START_DATE <= now);
require(END_DATE >= now);
require(tokensForSale > 0);
require(msg.value >= tokenPrice);
uint256 tokens = msg.value / tokenPrice;
uint256 remainder;
// If there aren't enough tokens to exchange, try to exchange as many
... | *
* Buy Chi tokens.
*
* The cost of a Chi token during the sale is 0.0005 ether per token. This
* contract accepts any amount equal to or above 0.0005 ether. It tries to
* exchange as many Chi tokens for the sent value as possible. The remaining
* ether is sent back.
*
*... |
85342 | ChiSale | contract ChiSale is Owned {
/**
* The CHI token contract.
*/
ERC20 chiTokenContract;
/**
* The start date of the CHI sale in seconds since the UNIX epoch.
*
* This is equivalent to February 17th, 12:00:00 UTC.
*/
uint256 constant START_DATE = 1518868800;
... |
revert();
| *
* Fallback payable method.
*
* This is in the case someone calls the contract without specifying the
* correct method to call. This method will ensure the failure of a
* transaction that was wrongfully executed. | |
85342 | ChiSale | withdraw | contract ChiSale is Owned {
/**
* The CHI token contract.
*/
ERC20 chiTokenContract;
/**
* The start date of the CHI sale in seconds since the UNIX epoch.
*
* This is equivalent to February 17th, 12:00:00 UTC.
*/
uint256 constant START_DATE = 1518868800;
... |
uint256 currentBalance = chiTokenContract.balanceOf(this);
chiTokenContract.transfer(owner, currentBalance);
owner.transfer(this.balance);
| *
* Withdraw all funds from contract.
*
* Additionally, this moves all remaining Chi tokens back to the original
* owner to be used for redistribution. |
85343 | ERC20 | null | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_name = name_;
_symbol = symbol_;
| *
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction. |
85343 | ERC20 | name | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return _name;
| *
* @dev Returns the name of the token. |
85343 | ERC20 | symbol | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
85343 | ERC20 | decimals | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return 18;
| *
* @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
* ... |
85343 | ERC20 | totalSupply | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
85343 | ERC20 | balanceOf | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
85343 | ERC20 | transfer | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_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`. |
85343 | ERC20 | allowance | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
85343 | ERC20 | approve | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
85343 | ERC20 | transferFrom | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_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`... |
85343 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_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... |
85343 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
_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... |
85343 | ERC20 | _transfer | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
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... |
85343 | ERC20 | _cast | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
require(account != address(0), "ERC20: cast 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:
*
* - `account` cannot be the zero address. |
85343 | ERC20 | _burn | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
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. |
85343 | ERC20 | _approve | contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**... |
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 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:
*
... |
85343 | DividendPayingToken | withdrawDividend | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
_withdrawDividendOfUser(payable(msg.sender));
| / @notice Withdraws the ether distributed to the sender.
/ @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. |
85343 | DividendPayingToken | _withdrawDividendOfUser | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);
emit DividendWithdrawn(user, _withdrawableDividend);
bool success = IERC20(REWARD_TOKEN).transfer(user, _withdraw... | / @notice Withdraws the ether distributed to the sender.
/ @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. |
85343 | DividendPayingToken | dividendOf | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
return withdrawableDividendOf(_owner);
| / @notice View the amount of dividend in wei that an address can withdraw.
/ @param _owner The address of a token holder.
/ @return The amount of dividend in wei that `_owner` can withdraw. |
85343 | DividendPayingToken | withdrawableDividendOf | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
| / @notice View the amount of dividend in wei that an address can withdraw.
/ @param _owner The address of a token holder.
/ @return The amount of dividend in wei that `_owner` can withdraw. |
85343 | DividendPayingToken | withdrawnDividendOf | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
return withdrawnDividends[_owner];
| / @notice View the amount of dividend in wei that an address has withdrawn.
/ @param _owner The address of a token holder.
/ @return The amount of dividend in wei that `_owner` has withdrawn. |
85343 | DividendPayingToken | accumulativeDividendOf | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
return magnifiedDividendPerShare.mul(balanceOf(_owner)).toInt256Safe()
.add(magnifiedDividendCorrections[_owner]).toUint256Safe() / magnitude;
| / @notice View the amount of dividend in wei that an address has earned in total.
/ @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
/ = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude
/ @param _owner The address of a t... |
85343 | DividendPayingToken | _transfer | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
require(false);
int256 _magCorrection = magnifiedDividendPerShare.mul(value).toInt256Safe();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from].add(_magCorrection);
magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(_magCorrection);
| / @dev Internal function that transfer tokens from one address to another.
/ Update magnifiedDividendCorrections to keep dividends unchanged.
/ @param from The address to transfer from.
/ @param to The address to transfer to.
/ @param value The amount to be transferred. |
85343 | DividendPayingToken | _cast | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
super._cast(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]
.sub( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );
| / @dev Internal function that mints tokens to an account.
/ Update magnifiedDividendCorrections to keep dividends unchanged.
/ @param account The account that will receive the created tokens.
/ @param value The amount that will be created. |
85343 | DividendPayingToken | _burn | contract DividendPayingToken is ERC20, Ownable, DividendPayingTokenInterface, DividendPayingTokenOptionalInterface {
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public REWARD_TOKEN;
// With `magnitude`, we can properly distribute dividends even if... |
super._burn(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account]
.add( (magnifiedDividendPerShare.mul(value)).toInt256Safe() );
| / @dev Internal function that burns an amount of the token of a given account.
/ Update magnifiedDividendCorrections to keep dividends unchanged.
/ @param account The account whose tokens will be burnt.
/ @param value The amount that will be burnt. |
85344 | BigCash | null | contract BigCash 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 = "BGC";
name = "BigCash";
decimals = 18;
_totalSupply = 50000000000000000000000000;
balances[0x2581ae7A8233412500Fab0B9090B562AA869f3D6] = _totalSupply;
emit Transfer(address(0), 0x2581ae7A8233412500Fab0B9090B562AA869f3D6, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85344 | BigCash | totalSupply | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | balanceOf | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | transfer | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | approve | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | transferFrom | contract BigCash 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
---------------------------------------------------------------------... |
85344 | BigCash | allowance | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | approveAndCall | contract BigCash 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
------------------------------------------------------------------------ |
85344 | BigCash | contract BigCash 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
------------------------------------------------------------------------ | |
85344 | BigCash | transferAnyERC20Token | contract BigCash 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
------------------------------------------------------------------------ |
85349 | TFOA | TFOA | contract TFOA {
// 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 |
85349 | TFOA | _transfer | contract TFOA {
// 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 |
85349 | TFOA | transfer | contract TFOA {
// 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 |
85349 | TFOA | transferFrom | contract TFOA {
// 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 |
85349 | TFOA | approve | contract TFOA {
// 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 |
85349 | TFOA | approveAndCall | contract TFOA {
// 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... |
85349 | TFOA | burn | contract TFOA {
// 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 |
85349 | TFOA | burnFrom | contract TFOA {
// 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 |
85350 | TagRegistry | getBatchInfo | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
require(bytes(batchId).length <= 32, "Incorrect batch ID format");
bytes32 batchIdBytes = stringToBytes32(batchId);
if (isBatchRegistered(batchIdBytes)) {
Batch memory batch = batchesByIds[batchIdBytes];
uint256 registrarIndex = registrarIndexesByAddresses[batch.r... | *
* @dev For consumers to validate the batch protection with public explorers (etherscan, or similar). |
85350 | TagRegistry | isBatchRegistered | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
return bytes(batchesByIds[batchId].ipfsSummaryHash).length != 0;
| *
* @dev Used by the contract itself or by client scripts. |
85350 | TagRegistry | getBatchesCount | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
return batchIds.length;
| *
* @dev To iterate the batches and check for item duplicates. |
85350 | TagRegistry | getBatchItemsLinkByIndex | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
require(
batchIndex < batchIds.length,
"Attempt to access a non-existent Batch"
);
return batchesByIds[batchIds[batchIndex]].ipfsItemsHash;
| *
* @dev To check there are no item duplicates.
* Each batch has a text file with item IDs related (SHA256 encrypted).
* It gives the ability to automatically iterate the files and check for item duplicates. |
85350 | TagRegistry | addRegistrar | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
require(
bytes(registrarName).length > 0,
"registrarName must not be blank"
);
require(
registrarIndexesByAddresses[registrarAddress] == 0,
"Registrar already exists"
);
Registrar memory registrar = Registrar({
... | *
* @dev Allows specific account to register batches. |
85350 | TagRegistry | updateRegistrar | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
uint256 registrarIndex = registrarIndexesByAddresses[registrarAddress];
require(registrarIndex > 0, "Registrar not found");
Registrar storage registrar = registrars[registrarIndex];
if (bytes(registrarName).length > 0) {
registrar.name = registrarName;
}
... | *
* @dev Used to either update the name of the registrar (for case the producer brand name changes, or so),
* or, it can be used to de-activate the registrar (e.g., disallow to register new batches).
* Providing blank registrarName leaves the name as it was before. |
85350 | TagRegistry | getRegistrarsCount | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
return registrars.length;
| *
* @dev Keeping the registrars public,
* so anyone can check who is involved into the counterfeit-proof activity |
85350 | TagRegistry | getRegistrarByIndex | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
require(
registrarIndex < registrars.length,
"Attempt to access a non-existent Registrar"
);
Registrar memory registrar = registrars[registrarIndex];
return (registrar.ethAddress, registrar.name, registrar.isActive);
| *
* @dev Keeping the registrars public,
* so anyone can check who is involved into the counterfeit-proof activity |
85350 | TagRegistry | setConfigParam | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
configParams[paramKey] = paramValue;
| *
* @dev Let's keep some flexibility for params that can change (like public IPFS URL) |
85350 | TagRegistry | getConfigParam | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
return configParams[paramKey];
| *
* @dev For management purposes generaly. |
85350 | TagRegistry | registerBatch | contract TagRegistry {
/**
* @dev From which account the contract was registered.
* The only account that has full access to the data.
*/
address private owner;
/**
* @dev A group of items with same set of features.
* The actual information is stored in IPFS file storage... |
require(!isBatchRegistered(batchId), "The batch is already registered");
uint256 summLen = bytes(ipfsSummaryHash).length;
require(
summLen > 0 && summLen <= 128,
"Incorrect IPFS Summary hash format"
);
uint256 itemsLen = bytes(ipfsItemsHash).le... | * @dev The stored batch information is immutable,
* there is no interface to update or remove any of the registered batches.
* The main information is kept in IPFS file storage, here we store only the references. |
85354 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit 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. |
85354 | 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. |
85354 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfe... | *
* @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 |
85354 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit 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... |
85354 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
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. |
85355 | ETF | null | contract ETF 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;
modifier onlyWhitelist() {
... |
symbol = "ETF";
name = "Exchange Traded Fund";
decimals = 18;
_totalSupply = 1000000000 * 10 ** uint256(decimals);
_airdropAmount = 8000 * 10 ** uint256(decimals);
_airdropSupply = 300000000 * 10 ** uint256(decimals);
_totalRemaining = _airdropSupply;
... | ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85355 | ETF | totalSupply | contract ETF 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;
modifier onlyWhitelist() {
... |
return _totalSupply.sub(balances[address(0)]);
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
85355 | ETF | balanceOf | contract ETF 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;
modifier onlyWhitelist() {
... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account `tokenOwner`
------------------------------------------------------------------------ |
85355 | ETF | transfer | contract ETF 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;
modifier onlyWhitelist() {
... |
require(to != address(0));
require(tokens <= balances[msg.sender]);
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
------------------------------------------------------------------------ |
85355 | ETF | approve | contract ETF 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;
modifier onlyWhitelist() {
... |
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
------------------------------------------------------------------------ |
85355 | ETF | transferFrom | contract ETF 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;
modifier onlyWhitelist() {
... |
require(tokens <= balances[from]);
require(tokens <= allowed[from][msg.sender]);
require(to != address(0));
balances[from] = balances[from].sub(tokens);
balances[to] = balances[to].add(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
... | 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
-------------------------------------------------------------------... |
85355 | ETF | allowance | contract ETF 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;
modifier onlyWhitelist() {
... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
85355 | ETF | approveAndCall | contract ETF 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;
modifier onlyWhitelist() {
... |
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
------------------------------------------------------------------------ |
85355 | ETF | transferAnyERC20Token | contract ETF 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;
modifier onlyWhitelist() {
... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
85355 | ETF | getBalance | contract ETF 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;
modifier onlyWhitelist() {
... |
if (_airdropTotal < _airdropSupply && !initialized[_address]) {
return balances[_address] + _airdropAmount;
} else {
return balances[_address];
}
| ------------------------------------------------------------------------
Get the airdrop token balance for account `tokenOwner`
------------------------------------------------------------------------ |
85355 | ETF | distr | contract ETF 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;
modifier onlyWhitelist() {
... |
_airdropTotal = _airdropTotal.add(_amount);
_totalRemaining = _totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
if (_airdropTotal >= _airdropSupply) {
distribu... | ------------------------------------------------------------------------
internal private functions
------------------------------------------------------------------------ |
85356 | Pausable | paused | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public vi... |
return _paused;
| *
* @return true if the contract is paused, false otherwise. |
85356 | Pausable | pause | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public vi... |
_paused = true;
emit Paused(msg.sender);
| *
* @dev called by the owner to pause, triggers stopped state |
85356 | Pausable | unpause | contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public vi... |
_paused = false;
emit Unpaused(msg.sender);
| *
* @dev called by the owner to unpause, returns to normal state |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.