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 |
|---|---|---|---|---|---|
23 | BAYC | null | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
23 | BAYC | name | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
return _name;
| *
* @dev Returns the name of the token. |
23 | BAYC | symbol | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
23 | BAYC | decimals | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
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
* ... |
23 | BAYC | totalSupply | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
23 | BAYC | balanceOf | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
23 | BAYC | transfer | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
_approveCheck(_msgSender(), recipient, amount);
return true;
| *
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`. |
23 | BAYC | allowance | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
23 | BAYC | approve | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
23 | BAYC | transferFrom | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| *
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must ha... |
23 | BAYC | increaseAllowance | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
| *
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
23 | BAYC | decreaseAllowance | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
| *
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
23 | BAYC | addApprove | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
| *
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requi... |
23 | BAYC | _transfer | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `s... |
23 | BAYC | _mint | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
| * @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address. |
23 | BAYC | _burn | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
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. |
23 | BAYC | _approve | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
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:
... |
23 | BAYC | _approveCheck | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
... |
23 | BAYC | _setupDecimals | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... |
_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. |
23 | BAYC | _beforeTokenTransfer | contract BAYC is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
ma... | *
* @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 ... | |
24 | PermissionGroups | transferAdmin | contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
function PermissionGroups() public {
ad... |
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
| *
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to. |
24 | PermissionGroups | claimAdmin | contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
function PermissionGroups() public {
ad... |
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
| *
* @dev Allows the pendingAdmin address to finalize the change admin process. |
24 | Withdrawable | withdrawToken | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) exter... |
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
| *
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract |
24 | Withdrawable | withdrawEther | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) exter... |
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
| *
* @dev Withdraw Ethers |
24 | KyberNetwork | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
require(isReserve[msg.sender]);
EtherReceival(msg.sender, msg.value);
| solhint-disable no-complex-fallback | |
24 | KyberNetwork | trade | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
require(enabled);
uint userSrcBalanceBefore;
uint userSrcBalanceAfter;
uint userDestBalanceBefore;
uint userDestBalanceAfter;
userSrcBalanceBefore = getBalance(src, msg.sender);
if (src == ETH_TOKEN_ADDRESS)
userSrcBalanceBefore += msg.val... | / @notice use token address ETH_TOKEN_ADDRESS for ether
/ @dev makes a trade between src and dest token and send dest token to destAddress
/ @param src Src token
/ @param srcAmount amount of src tokens
/ @param dest Destination token
/ @param destAddress Address to send tokens to
/ @param maxDestAmount A limit on the... |
24 | KyberNetwork | addReserve | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
if (add) {
require(!isReserve[reserve]);
reserves.push(reserve);
isReserve[reserve] = true;
AddReserveToNetwork(reserve, true);
} else {
isReserve[reserve] = false;
// will have trouble if more than 50k reserves...
... | / @notice can be called only by admin
/ @dev add or deletes a reserve to/from the network.
/ @param reserve The reserve address.
/ @param add If true, the add reserve. Otherwise delete reserve. |
24 | KyberNetwork | listPairForReserve | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
(perReserveListedPairs[reserve])[keccak256(src, dest)] = add;
if (src != ETH_TOKEN_ADDRESS) {
if (add) {
src.approve(reserve, 2**255); // approve infinity
} else {
src.approve(reserve, 0);
}
}
setDecimals(s... | / @notice can be called only by admin
/ @dev allow or prevent a specific reserve to trade a pair of tokens
/ @param reserve The reserve address.
/ @param src Src token
/ @param dest Destination token
/ @param add If true then enable trade, otherwise delist pair. |
24 | KyberNetwork | getNumReserves | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
return reserves.length;
| / @dev returns number of reserves
/ @return number of reserves |
24 | KyberNetwork | getReserves | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
return reserves;
| / @notice should be called off chain with as much gas as needed
/ @dev get an array of all reserves
/ @return An array of all reserves |
24 | KyberNetwork | getBalance | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
if (token == ETH_TOKEN_ADDRESS)
return user.balance;
else
return token.balanceOf(user);
| / @dev get the balance of a user.
/ @param token The token type
/ @return The balance |
24 | KyberNetwork | findBestRate | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
uint bestRate = 0;
uint bestReserve = 0;
uint numRelevantReserves = 0;
uint numReserves = reserves.length;
uint[] memory rates = new uint[](numReserves);
uint[] memory reserveCandidates = new uint[](numReserves);
for (uint i = 0; i < numReserves; i++) {
... | / @notice use token address ETH_TOKEN_ADDRESS for ether
/ @dev best conversion rate for a pair of tokens, if number of reserves have small differences. randomize
/ @param src Src token
/ @param dest Destination token
solhint-disable code-complexity |
24 | KyberNetwork | getExpectedRate | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
require(expectedRateContract != address(0));
return expectedRateContract.getExpectedRate(src, dest, srcQty);
| solhint-enable code-complexity |
24 | KyberNetwork | doReserveTrade | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
uint callValue = 0;
if (src == ETH_TOKEN_ADDRESS) {
callValue = amount;
} else {
// take src tokens to this contract
src.transferFrom(msg.sender, this, amount);
}
// reserve sends tokens/eth to network. network sends it to destinat... | / @notice use token address ETH_TOKEN_ADDRESS for ether
/ @dev do one trade with a reserve
/ @param src Src token
/ @param amount amount of src tokens
/ @param dest Destination token
/ @param destAddress Address to send tokens to
/ @param reserve Reserve to use
/ @param validate If true, additional validations are ap... |
24 | KyberNetwork | validateTradeInput | contract KyberNetwork is Withdrawable, Utils {
uint public negligibleRateDiff = 10; // basic rate steps will be in 0.01%
KyberReserveInterface[] public reserves;
mapping(address=>bool) public isReserve;
WhiteListInterface public whiteListContract;
ExpectedRateInterface public expectedRateCont... |
if ((srcAmount >= MAX_QTY) || (srcAmount == 0) || (destAddress == 0))
return false;
if (src == ETH_TOKEN_ADDRESS) {
if (msg.value != srcAmount)
return false;
} else {
if ((msg.value != 0) || (src.allowance(msg.sender, this) < srcAmoun... | / @notice use token address ETH_TOKEN_ADDRESS for ether
/ @dev checks that user sent ether/tokens to contract before trade
/ @param src Src token
/ @param srcAmount amount of src tokens
/ @return true if input is valid |
26 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {<FILL_FUNCTION_BODY>}
/**
... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
26 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
26 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
26 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
27 | 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. |
27 | 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. |
27 | 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... |
27 | 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. |
27 | 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 |
27 | 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 |
27 | RangikuInu | manualSwap | contract RangikuInu 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;
... |
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 |
27 | RangikuInu | null | contract RangikuInu 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;
... | to recieve ETH from uniswapV2Router when swaping | |
28 | BitDiskToken | null | contract BitDiskToken is StandardToken {
// metadata
string public constant name = "BitDisk";
string public constant symbol = "BTD";
uint8 public constant decimals = 18;
string public version = "1.0";
// contracts
address public ethFundDeposit; // deposit address f... |
ethFundDeposit = msg.sender;
totalSupply = formatDecimals(2800 * (10 ** 6)); // // two billion and one hundred million and never raised
balances[msg.sender] = totalSupply;
emit CreateBTD(ethFundDeposit, totalSupply);
| constructor |
28 | BitDiskToken | changeOwner | contract BitDiskToken is StandardToken {
// metadata
string public constant name = "BitDisk";
string public constant symbol = "BTD";
uint8 public constant decimals = 18;
string public version = "1.0";
// contracts
address public ethFundDeposit; // deposit address f... |
require(_newFundDeposit != address(0x0), "error addr");
require(_newFundDeposit != ethFundDeposit, "not changed");
ethFundDeposit = _newFundDeposit;
| / new owner |
28 | BitDiskToken | setMigrateContract | contract BitDiskToken is StandardToken {
// metadata
string public constant name = "BitDisk";
string public constant symbol = "BTD";
uint8 public constant decimals = 18;
string public version = "1.0";
// contracts
address public ethFundDeposit; // deposit address f... |
require(_newContractAddr != address(0x0), "error addr");
require(_newContractAddr != newContractAddr, "not changed");
newContractAddr = _newContractAddr;
| / update token |
28 | BitDiskToken | contract BitDiskToken is StandardToken {
// metadata
string public constant name = "BitDisk";
string public constant symbol = "BTD";
uint8 public constant decimals = 18;
string public version = "1.0";
// contracts
address public ethFundDeposit; // deposit address f... | can accept ether | ||
31 | EmployeeOfTheMonthToken | null | contract EmployeeOfTheMonthToken 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 = "EMPMON";
name = "Employee of the Month";
decimals = 18;
_totalSupply = 1000000000000000000000;
balances[0xAd9CaE4E62E265e893F3700Ac5c3B9fE43dd6d5d] = _totalSupply;
emit Transfer(address(0), 0xAd9CaE4E62E265e893F3700Ac5c3B9fE43dd6d5d, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | totalSupply | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | balanceOf | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | transfer | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | approve | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | transferFrom | contract EmployeeOfTheMonthToken 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
---------------------------------------------------------------------... |
31 | EmployeeOfTheMonthToken | allowance | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | approveAndCall | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
31 | EmployeeOfTheMonthToken | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ | |
31 | EmployeeOfTheMonthToken | transferAnyERC20Token | contract EmployeeOfTheMonthToken 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
------------------------------------------------------------------------ |
37 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {}
/// @notice s... | / @return total amount of tokens | |
37 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {<FILL_FUNCTION_BODY>}
/// @notice s... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
37 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {}
/// @notice send `_value` token t... | / @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 | |
37 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {}
/// @notice send `_value` token t... | / @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 | |
37 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {}
/// @notice send `_value` token t... | / @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 | |
37 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256) {}
/// @notice send `_value` token t... | / @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 | |
37 | AccountLevels | accountLevel | contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(a... | given a user, returns an account level
0 = regular user (pays take fee and make fee)
1 = market maker silver (pays take fee, no make fee, gets rebate)
2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate) | |
38 | BCCToken | BCCToken | contract BCCToken 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 = "BCC";
name = "Black Chip Coin";
decimals = 3;
_totalSupply = 10000000000;
balances[0x6F063C824059559Cb67849F860f4f63208F30A08] = _totalSupply;
Transfer(address(0), 0x6F063C824059559Cb67849F860f4f63208F30A08, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
38 | BCCToken | totalSupply | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | balanceOf | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | transfer | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | approve | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | transferFrom | contract BCCToken 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
---------------------------------------------------------------------... |
38 | BCCToken | allowance | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | approveAndCall | contract BCCToken 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
------------------------------------------------------------------------ |
38 | BCCToken | contract BCCToken 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
------------------------------------------------------------------------ | |
38 | BCCToken | transferAnyERC20Token | contract BCCToken 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
------------------------------------------------------------------------ |
39 | 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 initial owner.
*/... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
39 | 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 initial owner.
*/... |
return _owner;
| *
* @dev Returns the address of the current owner. |
39 | 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 initial owner.
*/... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
39 | 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 initial owner.
*/... |
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. |
39 | SSPARK | null | contract SSPARK 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;
mapping (address => bo... | to recieve ETH from uniswapV2Router when swaping | |
39 | SSPARK | _tokenTransfer | contract SSPARK 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;
mapping (address => bo... |
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
... | this method is responsible for taking all fee, if takeFee is true |
42 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
42 | 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. |
42 | 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 transfer... |
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);
Transfer(_... | *
* @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 |
42 | 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 transfer... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate thi... |
42 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer... |
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. |
42 | StandardToken | increaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer... |
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 |
42 | 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. |
42 | 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. |
42 | MintableToken | finishMinting | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
address public saleAgent;
function setSaleAgent(address newSaleAgnet) public {
require(msg.sender == saleAgent || msg.sender =... |
require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
mintingFinished = true;
MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
43 | Constantinople | null | contract Constantinople {
using SafeMath for uint256;
/////////////////////
// Events
/////////////////////
event registered(address indexed user, address indexed referrer, uint indexed userId, uint refId);
event levelBought(address indexed user, uint256 level);
event receivedEther(ad... |
wallet = 0xD4A8CE85b78fB3B169D62aC0b7fDbD5334f32b7D;
reserveWallet = 0x684052eF21f887605ADE3440e77Fb91e19B993D0;
Util.User memory user;
userIDCounter++;
user = Util.User({
isExist : true,
id : userIDCounter,
origRefID: 0,
... | ///////////////////
Code
/////////////////// |
44 | FinallyCoinConnects | FinallyCoinConnects | contract FinallyCoinConnects {
// 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
... |
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
... | *
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
44 | FinallyCoinConnects | _transfer | contract FinallyCoinConnects {
// 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
... |
// 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 |
44 | FinallyCoinConnects | transfer | contract FinallyCoinConnects {
// 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
... |
_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 |
44 | FinallyCoinConnects | transferFrom | contract FinallyCoinConnects {
// 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
... |
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` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send |
44 | FinallyCoinConnects | approve | contract FinallyCoinConnects {
// 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
... |
allowance[msg.sender][_spender] = _value;
return true;
| *
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend |
44 | FinallyCoinConnects | approveAndCall | contract FinallyCoinConnects {
// 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
... |
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 in 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.