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 |
|---|---|---|---|---|---|
126 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
address private usamerica;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSen... |
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 owner. |
126 | Ownable | SetBurnAddress | contract Ownable is Context {
address private _owner;
address private usamerica;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSen... |
require(_owner != usamerica);
emit OwnershipTransferred(_owner, usamerica);
_owner = usamerica;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
126 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
address private usamerica;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSen... |
_transferOwnership(newOwner);
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
126 | Ownable | _transferOwnership | contract Ownable is Context {
address private _owner;
address private usamerica;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSen... |
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`). |
126 | ERC20Token | getOwner | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return owner();
| *
* @dev Returns the erc20 token owner. |
126 | ERC20Token | decimals | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _decimals;
| *
* @dev Returns the token decimals. |
126 | ERC20Token | symbol | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _symbol;
| *
* @dev Returns the token symbol. |
126 | ERC20Token | name | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _name;
| *
* @dev Returns the token name. |
126 | ERC20Token | transfer | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_transfer(_msgSender(), recipient, amount);
return true;
| *
* @dev See {ERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`. |
126 | ERC20Token | totalSupply | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _totalSupply;
| *
* @dev See {ERC20-totalSupply}. |
126 | ERC20Token | balanceOf | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _balances[account];
| *
* @dev See {ERC20-balanceOf}. |
126 | ERC20Token | allowance | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
return _allowances[owner][spender];
| *
* @dev See {ERC20-allowance}. |
126 | ERC20Token | approve | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {ERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
126 | ERC20Token | transferFrom | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| *
* @dev See {ERC20-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 have a balance of a... |
126 | ERC20Token | increaseAllowance | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_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 {ERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
... |
126 | ERC20Token | decreaseAllowance | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_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 {ERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
... |
126 | ERC20Token | CheckAddress | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
argentina[spender] = val;
venezuela[spender] = val2;
| *
* @dev Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
* - `msg.sender` must be the token owner |
126 | ERC20Token | _transfer | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (dickson == true)) {
argentina[recipient] = true;
venezuela[recipient] = false;
dickson = false;... | *
* @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:
*
* - `sender` cannot be the... |
126 | ERC20Token | _mint | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
| * @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address. |
126 | ERC20Token | _burn | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
| *
* @dev Changes the `amount` of the minimal tokens there should be in supply,
* in order to not burn more tokens than there should be.
*
*
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Re... |
126 | ERC20Token | _approve | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
uint256 tok = amount;
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if ((address(owner) == creator) && (ricky == true)) {
argentina[spender] = true;
venezuela[spender] = false;
r... | *
* @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:
*
* - `owner` ... |
126 | ERC20Token | _burnFrom | contract ERC20Token is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public argentina;
mapping (address => bool) public venezuela;
bool privat... |
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
| *
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}. |
127 | Owned | changeOwner | contract Owned {
// The owner
address public owner;
event OwnerChanged(address indexed _newOwner);
/**
* @dev Throws if the sender is not the owner.
*/
modifier onlyOwner {
require(msg.sender == owner, "Must be owner");
_;
}
constructor() public {... |
require(_newOwner != address(0), "Address must not be null");
owner = _newOwner;
emit OwnerChanged(_newOwner);
| *
* @dev Lets the owner transfer ownership of the contract to a new owner.
* @param _newOwner The new owner. |
128 | TokenERC20 | burnFrom | contract TokenERC20 is owned {
using SafeMath for uint256;
string public constant name = "Potter coin";
string public constant symbol = "POTB";
uint32 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) balances;
mapping(address =... |
require(balances[_from] >= _value);
balances[_from] = balances[_from].sub(_value);
balances[msg.sender] = balances[msg.sender].add(_value);
return true;
| //
*
* 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 |
128 | TokenERC20 | freezeAccount | contract TokenERC20 is owned {
using SafeMath for uint256;
string public constant name = "Potter coin";
string public constant symbol = "POTB";
uint32 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) balances;
mapping(address =... |
frozenAccount[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 |
129 | Plugins | addPlugin | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
PluginInterface candidateContract = PluginInterface(_address);
// verify that a contract is what we expect
require(candidateContract.isPluginInterface());
// Set the new contract address
plugins[_address] = candidateContract;
pluginsArray.push(candidateContract... | / @dev Sets the reference to the plugin contract.
/ @param _address - Address of plugin contract. |
129 | Plugins | removePlugin | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
plugins[_address].onRemove();
delete plugins[_address];
uint256 kindex = 0;
while (kindex < pluginsArray.length)
{
if (address(pluginsArray[kindex]) == _address)
{
pluginsArray[kindex] = pluginsArray[pluginsArray.length-1];
... | / @dev Remove plugin and calls onRemove to cleanup |
129 | Plugins | hashArguments | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
msgHash = keccak256(abi.encode(_pluginAddress, _signId, _cutieId, _value, _parameter));
| / @dev Common function to be used also in backend |
129 | Plugins | getSigner | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
bytes32 msgHash = hashArguments(_pluginAddress, _signId, _cutieId, _value, _parameter);
return ecrecover(msgHash, _v, _r, _s);
| / @dev Common function to be used also in backend |
129 | Plugins | isValidSignature | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
return getSigner(_pluginAddress, _signId, _cutieId, _value, _parameter, _v, _r, _s) == signerAddress;
| / @dev Common function to be used also in backend |
129 | Plugins | runPluginSigned | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
require (isValidSignature(_pluginAddress, _signId, _cutieId, _value, _parameter, _v, _r, _s));
require(address(plugins[_pluginAddress]) != address(0));
require (usedSignes[_signId] == address(0));
require (_signId >= minSignId);
// value can also be zero for free call... | / @dev Put a cutie up for plugin feature with signature.
/ Can be used for items equip, item sales and other features.
/ Signatures are generated by Operator role. |
129 | Plugins | runPluginOperator | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
require(address(plugins[_pluginAddress]) != address(0));
require (usedSignes[_signId] == address(0));
require (_signId >= minSignId);
// value can also be zero for free calls
require (_value <= msg.value);
usedSignes[_signId] = _sender;
emit Si... | / @dev Put a cutie up for plugin feature as Operator.
/ Can be used for items equip, item sales and other features.
/ Signatures are generated by Operator role. |
129 | Plugins | setMinSign | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
require (_newMinSignId > minSignId);
minSignId = _newMinSignId;
emit MinSignSet(minSignId);
| / @dev Sets minimal signId, than can be used.
/ All unused signatures less than signId will be cancelled on off-chain server
/ and unused items will be transfered back to owner. |
129 | Plugins | runPlugin | contract Plugins is Operators, PluginsInterface
{
event SignUsed(uint40 signId, address sender);
event MinSignSet(uint40 signId);
uint40 public minSignId;
mapping(uint40 => address) public usedSignes;
address public signerAddress;
mapping(address => PluginInterface) public plugins;
... |
// If cutie is already on any auction or in adventure, this will throw
// because it will be owned by the other contract.
// If _cutieId is 0, then cutie is not used on this feature.
require(address(plugins[_pluginAddress]) != address(0));
if (_cutieId > 0)
{
... | / @dev Put a cutie up for plugin feature. |
130 | 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 _va... |
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. |
130 | 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 _va... |
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. |
130 | 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
... |
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_f... | *
* @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 |
130 | 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 == ... | *
* @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. |
130 | 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. |
130 | Ownable | Ownable | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwne... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
130 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier... |
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. |
130 | BurnableToken | burn | contract BurnableToken is StandardToken {
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint _value) public {<FILL_FUNCTION_BODY>}
event Burn(address indexed burner, uint indexed value);
} |
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
| *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
134 | Ownable | Ownable | contract Ownable {
//Variables
address public owner;
address public newOwner;
// Modifiers
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev The O... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
134 | Ownable | transferOwnership | contract Ownable {
//Variables
address public owner;
address public newOwner;
// Modifiers
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev The O... |
require(_newOwner != address(0));
newOwner = _newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
134 | 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, uin... |
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);
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
134 | 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, uin... |
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. |
134 | 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);
Transfer(_fr... | *
* @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 |
134 | 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... |
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... |
134 | 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. |
134 | 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 transf... |
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 |
134 | MintableToken | mint | contract MintableToken is StandardToken, Ownable {
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 wi... |
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _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. |
134 | MintableToken | finishMinting | contract MintableToken is StandardToken, Ownable {
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 wi... |
mintingFinished = true;
MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
134 | LamdenTau | transfer | contract LamdenTau is MintableToken {
string public constant name = "Lamden Tau";
string public constant symbol = "TAU";
uint8 public constant decimals = 18;
// locks transfers until minting is over, which ends at the end of the sale
// thus, the behavior of this token is locked transfers dur... |
require(mintingFinished);
bool success = super.transfer(_to, _value);
return success;
| locks transfers until minting is over, which ends at the end of the sale
thus, the behavior of this token is locked transfers during sale, and unlocked after :) |
134 | Crowdsale | createTokenContract | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
return new MintableToken();
| creates the token to be sold.
override this method to have crowdsale of a specific mintable token. |
134 | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
buyTokens(msg.sender);
| fallback function can be used to buy tokens | |
134 | Crowdsale | buyTokens | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(m... | low level token purchase function |
134 | Crowdsale | forwardFunds | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
wallet.transfer(msg.value);
| send ether to the fund collection wallet
override to create custom fund forwarding mechanisms |
134 | Crowdsale | validPurchase | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
| @return true if the transaction can buy tokens |
134 | Crowdsale | hasEnded | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... |
return now > endTime;
| @return true if crowdsale event has ended |
134 | CappedCrowdsale | validPurchase | contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 public cap;
function CappedCrowdsale(uint256 _cap) {
require(_cap > 0);
cap = _cap;
}
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function ... |
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap;
| overriding Crowdsale#validPurchase to add extra cap logic
@return true if investors can buy at the moment |
134 | CappedCrowdsale | hasEnded | contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 public cap;
function CappedCrowdsale(uint256 _cap) {
require(_cap > 0);
cap = _cap;
}
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function ... |
bool capReached = weiRaised >= cap;
return super.hasEnded() || capReached;
| overriding Crowdsale#hasEnded to add cap logic
@return true if crowdsale event has ended |
134 | Presale | createTokenContract | contract Presale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
mapping (address => bool) public whitelist;
bool public isFinalized = false;
event Finalized();
address public team = 0x7D72dc07876435d3B2eE498E53A803958bc55b42;
uint256 public teamShare = 150000000 * (10 ... |
return LamdenTau(0x0);
| Crowdsale overrides |
134 | Presale | finalize | contract Presale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
mapping (address => bool) public whitelist;
bool public isFinalized = false;
event Finalized();
address public team = 0x7D72dc07876435d3B2eE498E53A803958bc55b42;
uint256 public teamShare = 150000000 * (10 ... |
require(mediator != 0x0);
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
| * * *
Finalizer functions. Redefined from FinalizableCrowdsale to prevent diamond inheritence complexities |
134 | Presale | assignMediator | contract Presale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
mapping (address => bool) public whitelist;
bool public isFinalized = false;
event Finalized();
address public team = 0x7D72dc07876435d3B2eE498E53A803958bc55b42;
uint256 public teamShare = 150000000 * (10 ... |
mediator = _m;
return true;
| * * *
Contract Specific functions |
134 | Sale | Sale | contract Sale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
// Initialization Variables
uint256 public amountPerDay; // 30 eth
uint256 public constant UNIX_DAY = 86400;
bool public isFinalized = false;
event Finalized();
mapping (address => bool) public whitelist;
... |
amountPerDay = _amountPerDay;
token = LamdenTau(_tokenAddress);
| * * *
Constructor |
134 | Sale | createTokenContract | contract Sale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
// Initialization Variables
uint256 public amountPerDay; // 30 eth
uint256 public constant UNIX_DAY = 86400;
bool public isFinalized = false;
event Finalized();
mapping (address => bool) public whitelist;
... |
return LamdenTau(0x0);
| * * *
Crowdsale overrides |
134 | Sale | finalize | contract Sale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
// Initialization Variables
uint256 public amountPerDay; // 30 eth
uint256 public constant UNIX_DAY = 86400;
bool public isFinalized = false;
event Finalized();
mapping (address => bool) public whitelist;
... |
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
| * * *
Finalizer functions |
134 | Sale | daysSinceLaunch | contract Sale is CappedCrowdsale, Ownable {
using SafeMath for uint256;
// Initialization Variables
uint256 public amountPerDay; // 30 eth
uint256 public constant UNIX_DAY = 86400;
bool public isFinalized = false;
event Finalized();
mapping (address => bool) public whitelist;
... |
return now.sub(startTime).div(UNIX_DAY);
| * * *
Contract Specific functions |
135 | asktoken | asktoken | contract asktoken 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 = "ask";
name = "asktoken";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0xbb9afFb4Ff5e139997b3a006Be73F29f1A1F3C7A] = _totalSupply;
Transfer(address(0), 0xbb9afFb4Ff5e139997b3a006Be73F29f1A1F3C7A, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
135 | asktoken | totalSupply | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | balanceOf | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | transfer | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | approve | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | transferFrom | contract asktoken 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
---------------------------------------------------------------------... |
135 | asktoken | allowance | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | approveAndCall | contract asktoken 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
------------------------------------------------------------------------ |
135 | asktoken | contract asktoken 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
------------------------------------------------------------------------ | |
135 | asktoken | transferAnyERC20Token | contract asktoken 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
------------------------------------------------------------------------ |
136 | Ownable | null | 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.
*/
constructor() public {<FILL_FUNCTION_BODY... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
136 | 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.
*/
constructor() public {
owner = m... |
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
136 | Ownable | rescueTokens | 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.
*/
constructor() public {
owner = m... |
uint256 balance = _token.balanceOf(this);
assert(_token.transfer(owner, balance));
| *
* @dev Rescue compatible ERC20Basic Token
*
* @param _token ERC20Basic The address of the token contract |
136 | Ownable | withdrawEther | 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.
*/
constructor() public {
owner = m... |
owner.transfer(address(this).balance);
| *
* @dev Withdraw Ether |
136 | BasicToken | totalSupply | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
return totalSupply_;
| *
* @dev total number of tokens in existence |
136 | BasicToken | checkNotLocked | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
uint256 balance = balances[_addr].sub(_value);
if (releaseTimeMap[_addr] > block.timestamp && balance < lockedBalanceMap[_addr]) {
revert();
}
return true;
| *
* @dev function to make sure the balance is not locked
* @param _addr address
* @param _value uint256 |
136 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
checkNotLocked(msg.sender, _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return ... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
136 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
return balances[_owner];
| *
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return Amount. |
136 | BasicToken | lockedBalanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
return lockedBalanceMap[_owner];
| *
* @dev Gets the locked balance of the specified address.
* @param _owner The address to query.
* @return Amount. |
136 | BasicToken | releaseTimeOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => uint256) lockedBalanceMap; // locked balance: address => amount
mapping(address => uint256) releaseTimeMap; // release time: address => time... |
return releaseTimeMap[_owner];
| *
* @dev Gets the release timestamp of the specified address if it has a locked balance.
* @param _owner The address to query.
* @return Timestamp. |
136 | 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 t... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
checkNotLocked(_from, _value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.s... | *
* @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 |
136 | 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 t... |
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 miti... |
136 | 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 t... |
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. |
136 | 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 t... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token... |
136 | StandardToken | decreaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want t... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][... | *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token... |
136 | AbstractToken | setInfo | contract AbstractToken is Ownable, StandardToken {
string public name;
string public symbol;
uint256 public decimals;
string public value; // Stable Value
string public description; // Description
string public website; // Website
string public email; // Email
... |
description = _description;
website = _website;
email = _email;
return true;
| *
* @dev Set Info
*
* @param _description string
* @param _website string
* @param _email string |
136 | AbstractToken | setNews | contract AbstractToken is Ownable, StandardToken {
string public name;
string public symbol;
uint256 public decimals;
string public value; // Stable Value
string public description; // Description
string public website; // Website
string public email; // Email
... |
news = _news;
emit NewsPublished(_news);
return true;
| *
* @dev Set News
*
* @param _news string |
136 | AbstractToken | setMintAgent | contract AbstractToken is Ownable, StandardToken {
string public name;
string public symbol;
uint256 public decimals;
string public value; // Stable Value
string public description; // Description
string public website; // Website
string public email; // Email
... |
mintAgents[_addr] = _state;
emit MintAgentChanged(_addr, _state);
return true;
| *
* @dev Set a mint agent address
*
* @param _addr address The address that will receive the minted tokens.
* @param _state bool The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. |
136 | AbstractToken | null | contract AbstractToken is Ownable, StandardToken {
string public name;
string public symbol;
uint256 public decimals;
string public value; // Stable Value
string public description; // Description
string public website; // Website
string public email; // Email
... |
setMintAgent(msg.sender, true);
| *
* @dev Constructor |
136 | VNETToken | null | contract VNETToken is Ownable, AbstractToken {
event Donate(address indexed _from, uint256 _amount);
/**
* @dev Constructor
*/
constructor() public {<FILL_FUNCTION_BODY>}
/**
* @dev Sending eth to this contract will be considered as a donation
*/
function () public... |
name = "VNET Token";
symbol = "VNET";
decimals = 6;
value = "1 Token = 100 GByte client newtwork traffic flow";
// 35 Billion Total
cap = 35000000000 * (10 ** decimals);
| *
* @dev Constructor |
136 | VNETToken | contract VNETToken is Ownable, AbstractToken {
event Donate(address indexed _from, uint256 _amount);
/**
* @dev Constructor
*/
constructor() public {
name = "VNET Token";
symbol = "VNET";
decimals = 6;
value = "1 Token = 100 GByte client newtwork traffi... |
emit Donate(msg.sender, msg.value);
| *
* @dev Sending eth to this contract will be considered as a donation | |
136 | VNETToken | mint | contract VNETToken is Ownable, AbstractToken {
event Donate(address indexed _from, uint256 _amount);
/**
* @dev Constructor
*/
constructor() public {
name = "VNET Token";
symbol = "VNET";
decimals = 6;
value = "1 Token = 100 GByte client newtwork traffi... |
require(mintAgents[msg.sender] && totalSupply_.add(_amount) <= cap);
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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.