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 |
|---|---|---|---|---|---|
85414 | DragonDivs | setSymbol | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
symbol = _symbol;
| *
* If we want to rebrand, we can. |
85414 | DragonDivs | totalEthereumBalance | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
return address(this).balance;
| ---------- HELPERS AND CALCULATORS ----------
*
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance() |
85414 | DragonDivs | totalSupply | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
return tokenSupply_;
| *
* Retrieve the total token supply. |
85414 | DragonDivs | myTokens | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
| *
* Retrieve the tokens owned by the caller. |
85414 | DragonDivs | myDividends | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
| *
* Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want the... |
85414 | DragonDivs | balanceOf | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
return tokenBalanceLedger_[_customerAddress];
| *
* Retrieve the token balance of any single address. |
85414 | DragonDivs | dividendsOf | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
| *
* Retrieve the dividend balance of any single address. |
85414 | DragonDivs | sellPrice | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
// our calculation relies on the token supply, so we need supply. Doh.
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ether... | *
* Return the buy price of 1 individual token. |
85414 | DragonDivs | buyPrice | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
// our calculation relies on the token supply, so we need supply. Doh.
if(tokenSupply_ == 0){
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ether... | *
* Return the sell price of 1 individual token. |
85414 | DragonDivs | calculateTokensReceived | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, dividendFee_),100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
| *
* Function for the frontend to dynamically retrieve the price scaling of buy orders. |
85414 | DragonDivs | calculateEthereumReceived | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, dividendFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
| *
* Function for the frontend to dynamically retrieve the price scaling of sell orders. |
85414 | DragonDivs | purchaseTokens | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
//As long as the whitelist is true, only whitelisted people are allowed to buy.
// if the person is not whitelisted but whitelist is true/active, revert the transaction
if (whitelisted_[msg.sender] == false && whitelist_ == true) {
revert();
}
// data setup... | ==========================================
= INTERNAL FUNCTIONS =
========================================== |
85414 | DragonDivs | ethereumToTokens_ | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial**2)
... | *
* Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. |
85414 | DragonDivs | tokensToEthereum_ | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPr... | *
* Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. |
85414 | DragonDivs | sqrt | contract DragonDivs {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifier onlyStro... |
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
| This is where all your gas goes, sorry
Not sorry, you probably only paid 1 gwei |
85415 | Ownable | null | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner()... |
owner = 0xCfFF1E0475547Cb68217515568D6d399eF144Ea8;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85415 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = 0xCfFF1E0475547Cb68217515568D6d399eF144Ea8;
}
/**
* @dev Throws if called by any account other than... |
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. |
85415 | BasicToken | freezeAccount | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
mapping(address => uint256) public lockAccounts;
event FrozenFunds(
address target,
bool frozen
);
event Account... |
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
| *
* @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
* @param target Address to be frozen
* @param freeze either to freeze it or not |
85415 | BasicToken | lockAccount | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
mapping(address => uint256) public lockAccounts;
event FrozenFunds(
address target,
bool frozen
);
event Account... |
lockAccounts[_addr] = _timePeriod;
emit AccountLocked(_addr, _timePeriod);
| *
* @dev Lock a specified address
* @notice Once an account is locked it can't be unlocked till the time period passes
* @param _addr The address to lock
* @param _timePeriod The time period to lock the account. |
85415 | BasicToken | burnTokens | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
mapping(address => uint256) public lockAccounts;
event FrozenFunds(
address target,
bool frozen
);
event Account... |
require(balances[_who] >= _amount);
balances[_who] = balances[_who].sub(_amount);
totalSupply = totalSupply.sub(_amount);
emit Burn(_who, _amount);
emit Transfer(_who, address(0), _amount);
| *
* @dev Function to burn tokens
* @param _who The address from which to burn tokens
* @param _amount The amount of tokens to burn
* |
85415 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
mapping(address => uint256) public lockAccounts;
event FrozenFunds(
address target,
bool frozen
);
event Account... |
require(now.add(1 * 1 hours) > lockAccounts[msg.sender] || lockAccounts[msg.sender] == 0);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
85415 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => bool) public frozenAccount;
mapping(address => uint256) public lockAccounts;
event FrozenFunds(
address target,
bool frozen
);
event Account... |
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. |
85415 | AdvanceToken | _burn | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
require(_account != 0);
require(_amount <= balances[_account]);
totalSupply = totalSupply.sub(_amount);
balances[_account] = balances[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
| *
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt. |
85415 | AdvanceToken | burnFrom | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
require(_amount <= allowed[_account][msg.sender]);
require(!frozenAccount[_account]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_account][msg.sender] = allowed[_account][msg.s... | *
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal _burn function.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt. |
85415 | AdvanceToken | burn | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
_burn(msg.sender, _value);
| *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
85415 | AdvanceToken | transferFrom | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(!frozenAccount[_from]); // Check if sender is frozen
require(now.add(1 * 1 hours) > lockAccounts[_from] || lockAccounts[_from] == 0);
balanc... | *
* @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 |
85415 | AdvanceToken | approve | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate thi... |
85415 | AdvanceToken | allowance | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
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. |
85415 | AdvanceToken | increaseApproval | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
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.sol
* @... |
85415 | AdvanceToken | decreaseApproval | contract AdvanceToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be... |
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][_spender]);
return true;
... | *
* @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.sol
* @... |
85415 | CanleadToken | null | contract CanleadToken is AdvanceToken {
string public constant name = "Canlead Token";
string public constant symbol = "CAND";
uint256 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * 10**decimals;
/**
* @dev Contructor
*/
constructor() public {<FILL_F... |
totalSupply = INITIAL_SUPPLY;
balances[0xCfFF1E0475547Cb68217515568D6d399eF144Ea8] = INITIAL_SUPPLY;
emit Transfer(address(0), address(0xCfFF1E0475547Cb68217515568D6d399eF144Ea8),totalSupply);
| *
* @dev Contructor |
85416 | ERC20 | paused | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _paused;
| *
* @return true if the contract is paused, false otherwise. |
85416 | ERC20 | pause | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
_paused = true;
emit Paused(msg.sender);
| *
* @dev called by the owner to pause, triggers stopped state |
85416 | ERC20 | unpause | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
_paused = false;
emit Unpaused(msg.sender);
| *
* @dev called by the owner to unpause, returns to normal state |
85416 | ERC20 | name | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _name;
| *
* @return the name of the token. |
85416 | ERC20 | symbol | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _symbol;
| *
* @return the symbol of the token. |
85416 | ERC20 | decimals | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _decimals;
| *
* @return the number of decimals of the token. |
85416 | ERC20 | totalSupply | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _totalSupply;
| *
* @dev Total number of tokens in existence |
85416 | ERC20 | balanceOf | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
return _balances[owner];
| *
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address. |
85416 | ERC20 | allowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
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. |
85416 | ERC20 | transfer | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
_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. |
85416 | ERC20 | approve | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
... |
85416 | ERC20 | transferFrom | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
| *
* @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 |
85416 | ERC20 | increaseAllowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
require(spender != address(0));
_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.sol
* @param... |
85416 | ERC20 | decreaseAllowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
| *
* @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.sol
* @param... |
85416 | ERC20 | _transfer | contract ERC20 is IERC20 {
using SafeMath for uint256;
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
event Paused(address account);
event Unpaused(address account);
Roles.Role private pausers;
mapping (address => uint2... |
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
| *
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred. |
85417 | WWCToken | setPercentFrozenWhenBought | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
percentFrozenWhenBought = _percentFrozenWhenBought;
| aforementioned period |
85417 | WWCToken | setPercentFrozenWhenAwarded | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
percentFrozenWhenAwarded = _percentFrozenWhenAwarded;
| aforementioned period |
85417 | WWCToken | grant | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
if (notAttributed>0) {
uint256 tokens = _nbTokens * weisPerEth;
if (tokens<=notAttributed) {
if (tokens > 0) {
balances[_to] += tokens;
notAttributed -= tokens;
emit Transfer(0, _to, tokens);
... | / transfer tokens from unattributed pool without any lockup (e.g. for human sale) |
85417 | WWCToken | moveTokens | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
if (_amount>0 && balances[_from] >= _amount) {
balances[_from] -= _amount;
balances[_to] += _amount;
emit Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
| mechanism allowing to stop thieves from profiting
/ Used to empty blocked accounts of stolen tokens and return them to rightful owners |
85417 | WWCToken | balanceOf | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
unfreezeTokens(_owner);
return balances[_owner];
| / @param _owner The address from which the balance will be retrieved
/ @return The balance |
85417 | WWCToken | transfer | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value... | / @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 |
85417 | WWCToken | transferFrom | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (!isBlockedAccount(msg.sender) && (balanceOf(_from) >= _value && allowe... | / @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 |
85417 | WWCToken | approve | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| / @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 |
85417 | WWCToken | allowance | contract WWCToken {
string public name = 'Wowbit Classic'; //fancy name
uint8 public decimals = 18; //How many decimals to show. It's like comparing 1 wei to 1 ether.
string public symbol = 'WCC'; //Identifier
string public version = '1.0';
uint256 weisPerEt... |
return allowed[_owner][_spender];
| / @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 |
85418 | 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. |
85418 | 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 = _msgSender... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85418 | 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 = _msgSender... |
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 ... |
85418 | 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 = _msgSender... |
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. |
85419 | 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) public retu... |
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. |
85419 | 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) public retu... |
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. |
85419 | 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 to... |
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(_from, _to, _valu... | *
* @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 |
85419 | 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 to... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
... |
85419 | 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 to... |
return allowed[_owner][_spender];
| *
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. |
85419 | 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 to... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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.sol
* @param _... |
85419 | 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 to transfer to... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @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.sol
* @param _... |
85419 | Token | Token | contract Token is StandardToken {
string public constant symbol = "NGR";
string public constant name = "Nagri Token";
uint8 public constant decimals = 18;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function Token (uint256 _totalSupply) public {<FILL_FUNCTION_BODY>}
} |
// total supply must not be zero
require(_totalSupply > 0);
totalSupply = _totalSupply;
// init token balance of the owner, all tokens go to him
balances[msg.sender] = _totalSupply;
| *
* @dev Constructor that gives msg.sender all of existing tokens. |
85421 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev 从一个地址向另外一个地址转token
* @param _from 转账的from地址
* @param _to address 转账的to地址
* @param _value uint256 转账token数量
*/
function transferFrom(
address _from,
addres... |
// 做合法性检查
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);
... | *
* @dev 从一个地址向另外一个地址转token
* @param _from 转账的from地址
* @param _to address 转账的to地址
* @param _value uint256 转账token数量 |
85421 | MintableToken | finishMinting | contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the op... |
mintingFinished = true;
emit MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
85426 | 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. |
85426 | 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. |
85426 | HashcoCoin | HashcoCoin | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
owner = msg.sender;
ownerWallet = wallet;
name = "HashcoCoin";
symbol = "HCC";
decimals = 18;
_totalSupply = 60000000 * 10 ** uint(decimals);
tokenBalances[wallet] = _totalSupply; //Since we divided the token into 10^18 parts
| *
* @dev Contructor that gives msg.sender all of existing tokens. |
85426 | HashcoCoin | balanceOf | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
return tokenBalances[tokenOwner];
| Get the token balance for account `tokenOwner` |
85426 | HashcoCoin | transfer | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
require(to != address(0));
require(tokens <= tokenBalances[msg.sender]);
tokenBalances[msg.sender] = tokenBalances[msg.sender].sub(tokens);
tokenBalances[to] = tokenBalances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
| Transfer the balance from owner's account to another account |
85426 | HashcoCoin | transferFrom | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
require(_to != address(0));
require(_value <= tokenBalances[_from]);
require(_value <= allowed[_from][msg.sender]);
tokenBalances[_from] = tokenBalances[_from].sub(_value);
tokenBalances[_to] = tokenBalances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_... | *
* @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 |
85426 | HashcoCoin | approve | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
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.
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. |
85426 | HashcoCoin | totalSupply | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
return _totalSupply - tokenBalances[address(0)];
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
85426 | HashcoCoin | allowance | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
85426 | HashcoCoin | increaseApproval | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by. |
85426 | HashcoCoin | decreaseApproval | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by. |
85426 | HashcoCoin | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
85426 | HashcoCoin | transferAnyERC20Token | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
85426 | HashcoCoin | mint | contract HashcoCoin is ERC20Interface,Ownable {
using SafeMath for uint256;
string public name;
string public symbol;
uint256 public decimals;
uint256 public _totalSupply;
mapping(address => uint256) tokenBalances;
address ownerWallet;
// Owner of account approves the transfer o... |
require(tokenBalances[wallet] >= tokenAmount); // checks if it has enough to sell
tokenBalances[buyer] = tokenBalances[buyer].add(tokenAmount); // adds the amount to buyer's balance
tokenBalances[wallet] = tokenBalances[wallet].sub(tokenAmount); ... | only to be used by the ICO |
85426 | HashcoCoinCrowdsale | createTokenContract | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
return new HashcoCoin(wall);
| creates the token to be sold. |
85426 | HashcoCoinCrowdsale | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
buyTokens(msg.sender);
| fallback function can be used to buy tokens | |
85426 | HashcoCoinCrowdsale | buyTokens | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
require(beneficiary != 0x0);
require(isCrowdsalePaused == false);
require(msg.value>0);
require(TOKENS_SOLD<maxTokensToSale);
uint256 weiAmount = msg.value;
uint256 tokens;
uint256 bonus;
// calculate token amount to be transferred
if (TOKENS_SOLD < 15000000 * 10 ** 18)
... | low level token purchase function
Minimum purchase can be of 1 ETH |
85426 | HashcoCoinCrowdsale | forwardFunds | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
wallet.transfer(msg.value);
| send ether to the fund collection wallet
override to create custom fund forwarding mechanisms |
85426 | HashcoCoinCrowdsale | setPriceRatePhase1 | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
require (msg.sender == wallet);
ratePerWeiFirstPhase = newPrice;
| *
* function to change the price rate for phase 1
* can only be called from owner wallet
* |
85426 | HashcoCoinCrowdsale | setPriceRatePhase2 | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
require (msg.sender == wallet);
ratePerWeiSecondPhase = newPrice;
| *
* function to change the price rate for phase 1
* can only be called from owner wallet
* |
85426 | HashcoCoinCrowdsale | pauseCrowdsale | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
require(msg.sender==wallet);
isCrowdsalePaused = true;
| *
* function to pause the crowdsale
* can only be called from owner wallet
* |
85426 | HashcoCoinCrowdsale | resumeCrowdsale | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
require(msg.sender==wallet);
isCrowdsalePaused = false;
| *
* function to resume the crowdsale if it is paused
* can only be called from owner wallet
* if the crowdsale has been stopped, this function would not resume it
* |
85426 | HashcoCoinCrowdsale | remainingTokensForSale | contract HashcoCoinCrowdsale {
using SafeMath for uint256;
// The token being sold
HashcoCoin public token;
// address where funds are collected
// address where tokens are deposited and from where we send tokens to buyers
address public wallet;
// how many token units a buyer gets per wei
... |
return maxTokensToSale - TOKENS_SOLD;
| ------------------------------------------------------------------------
Remaining tokens for sale
------------------------------------------------------------------------ |
85429 | BasicToken | totalSupply | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {<FILL_FUNCTION_BODY>}
/**
... |
return totalSupply_;
| *
* @dev total number of tokens in existence |
85429 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _val... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
85429 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
... |
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. |
85429 | 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]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_v... | *
* @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 |
85429 | 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... |
85429 | 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. |
85429 | 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;
| *
* 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 |
85429 | TokenTimelock | release | contract TokenTimelock {
using SafeERC20 for ERC20Basic;
// ERC20 basic token contract being held
ERC20Basic public token;
// beneficiary of tokens after they are released
address public beneficiary;
// timestamp when token release is enabled
uint64 public releaseTime;
co... |
require(uint64(block.timestamp) >= releaseTime);
uint256 amount = token.balanceOf(this);
require(amount > 0);
token.safeTransfer(beneficiary, amount);
| *
* @notice Transfers tokens held by timelock to beneficiary. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.