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 |
|---|---|---|---|---|---|
265 | StandardToken | balanceOf | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account `tokenOwner`
------------------------------------------------------------------------ |
265 | StandardToken | transfer | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
//allow trading in tokens only if sale fhined or by token creator (for bounty program)
if (msg.sender != owner)
require(!paused);
require(to != address(0));
require(tokens > 0);
require(tokens <= balances[msg.sender]);
balances[msg.sender] = balances[m... | ------------------------------------------------------------------------
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
------------------------------------------------------------------------ |
265 | StandardToken | approve | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
require(spender != address(0));
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
| https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
recommends that there are no checks for the approval double-spend attack
as this should be implemented in user interfaces
------------------------------------------------------------------------ |
265 | StandardToken | transferFrom | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
//allow trading in token only if sale fhined
if (msg.sender != owner)
require(!paused);
require(tokens > 0);
require(to != address(0));
require(from != address(0));
require(tokens <= balances[from]);
require(tokens <= allowed[from][msg.sender]... | 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 not allowed
---------------------------------------------------------------... |
265 | StandardToken | allowance | contract StandardToken is ERC20Interface, Pausable {
using SafeMath for uint256;
string public constant symbol = "AST-NET";
string public constant name = "AllStocks Token";
uint256 public constant decimals = 18;
uint256 public _totalSupply = 0;
mapping(address => uint256) public balanc... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
265 | MintableToken | mint | contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receiv... |
require(_to != address(0));
require(_amount > 0);
_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. |
265 | MintableToken | finishMinting | contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receiv... |
mintingFinished = true;
emit MintFinished();
return true;
| *
* @dev Function to stop minting new tokens.
* @return True if the operation was successful. |
265 | AllstocksToken | null | contract AllstocksToken is MintableToken {
string public version = "1.0";
uint256 public constant INITIAL_SUPPLY = 225 * (10**5) * 10**decimals; // 22.5m reserved for Allstocks use
// constructor
constructor() public {<FILL_FUNCTION_BODY>}
function () public payable {
re... |
owner = msg.sender;
_totalSupply = INITIAL_SUPPLY; // 22.5m reserved for Allstocks use
balances[owner] = INITIAL_SUPPLY; // Deposit Allstocks share
emit Transfer(address(0x0), owner, INITIAL_SUPPLY); // log transfer... | 22.5m reserved for Allstocks use
constructor |
267 | 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. |
267 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
267 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
267 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
267 | RefractFin | null | contract RefractFin is Context, IERC20, Ownable
{
/**
* @Libary - SafeMath for mathematical functions
* @Library - Address for storing and interacting with ERC-20 addresses
*/
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
... |
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
| *
* Constructor - public
* Creates ERC-20 token based on given parameters
* Emits a transfer event |
268 | Context | null | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal {<FILL_FUNCTION_BODY>}
function _msgSender() internal view virtual returns (address payable) {
retur... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
268 | 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. |
268 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
268 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
268 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
268 | HodlDex | poke | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
_accrueByTime();
| *************************************************************************************
* Anyone can nudge the time-based accrual forward
************************************************************************************* |
268 | HodlDex | hodlTIssue | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
User storage u = userStruct[msg.sender];
User storage t = userStruct[address(token)];
u.balanceHodl = u.balanceHodl.sub(amount);
t.balanceHodl = t.balanceHodl.add(amount);
_pruneHodler(msg.sender);
token.transfer(msg.sender, amount);
emit HodlTIssued(msg.s... | *************************************************************************************
* 1:1 Convertability to HODLT ERC20
************************************************************************************* |
268 | HodlDex | sellHodlC | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
emit SellHodlC(msg.sender, quantityHodl, lowGas);
uint orderUsd = convertHodlToUsd(quantityHodl);
uint orderLimit = orderLimit();
require(orderUsd >= minOrderUsd, "Sell order is less than minimum USD value");
require(orderUsd <= orderLimit || orderLimit == 0, "Order exceed... | *************************************************************************************
* Sell HodlC to buy orders, or if no buy orders open a sell order.
* Selectable low gas protects against future EVM price changes.
* Completes as much as possible (gas) and return unprocessed Hodl.
************... |
268 | HodlDex | buyHodlC | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
emit BuyHodlC(msg.sender, amountEth, lowGas);
uint orderLimit = orderLimit();
uint orderUsd = convertEthToUsd(amountEth);
require(orderUsd >= minOrderUsd, "Buy order is less than minimum USD value");
require(orderUsd <= orderLimit || orderLimit == 0, "Order exceeds... | *************************************************************************************
* Buy HodlC from sell orders, or if no sell orders, from reserve. Lastly, open a
* buy order is the reserve is sold out.
* Selectable low gas protects against future EVM price changes.
* Completes as much as p... |
268 | HodlDex | cancelSell | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
SellOrder storage o = sellOrder[orderId];
User storage u = userStruct[o.seller];
require(o.seller == msg.sender, "Sender is not the seller.");
u.balanceHodl = u.balanceHodl.add(o.volumeHodl);
u.sellOrderIdFifo.remove(orderId);
sellOrderIdFifo.remove(orderId);
... | *************************************************************************************
* Cancel orders
************************************************************************************* |
268 | HodlDex | convertEthToUsd | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
inUsd = amtEth.mul(maker.read()).div(USD_PRECISION);
| *************************************************************************************
* Prices and quotes
************************************************************************************* |
268 | HodlDex | depositEth | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
require(msg.value > 0, "You must send Eth to this function");
User storage u = userStruct[msg.sender];
u.balanceEth = u.balanceEth.add(msg.value);
emit UserDepositEth(msg.sender, msg.value);
| *************************************************************************************
* Eth accounts
************************************************************************************* |
268 | HodlDex | rates | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
hodlUsd = HODL_USD;
dailyAccrualRate = DAILY_ACCRUAL_RATE;
uint startTime = BIRTHDAY.add(SLEEP_TIME);
if(now > startTime) {
uint daysFromStart = (now.sub(startTime)) / 1 days;
uint daysUnprocessed = daysFromStart.sub(accrualDaysProcessed);
if(d... | *************************************************************************************
* Accrual and rate decay over time
*************************************************************************************
Moves forward in 1-day steps to prevent overflow |
268 | HodlDex | _accrueByTransaction | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
HODL_USD = HODL_USD.add(USD_TXN_ADJUSTMENT);
| *************************************************************************************
* Stateful activity-based and time-based rate adjustments
************************************************************************************* |
268 | HodlDex | _makeHodler | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
User storage u = userStruct[user];
if(convertHodlToUsd(u.balanceHodl) >= minOrderUsd) {
if(!hodlerAddrSet.exists(user)) hodlerAddrSet.insert(user);
}
| *************************************************************************************
* Add and remove from hodlerAddrSet based on total HODLC owned/controlled
************************************************************************************* |
268 | HodlDex | contractBalanceEth | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... | return address(this).balance; | *************************************************************************************
* View functions to enumerate the state
*************************************************************************************
Courtesy function |
268 | HodlDex | distributionsLength | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... | return distribution.length; | Distribution queue |
268 | HodlDex | hodlerCount | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... | return hodlerAddrSet.count(); | Hodlers in no particular order |
268 | HodlDex | sellOrderCount | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... | return sellOrderIdFifo.count(); | Open orders, FIFO |
268 | HodlDex | userSellOrderCount | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... | return userStruct[userAddr].sellOrderIdFifo.count(); | open orders by user, FIFO |
268 | HodlDex | initUser | contract HodlDex is Ownable {
using Address for address payable; // OpenZeppelin address utility
using SafeMath for uint; // OpenZeppelin safeMath utility
using Bytes32Set for Bytes32Set.Set; // Unordered... |
User storage u = userStruct[userAddr];
User storage r = userStruct[address(this)];
u.balanceEth = u.balanceEth.add(msg.value);
u.balanceHodl = u.balanceHodl.add(hodl);
r.balanceHodl = r.balanceHodl.sub(hodl);
_makeHodler(userAddr);
emit UserInitialized(ms... | *************************************************************************************
* Initialization functions that support migration cannot be used after trading starts
************************************************************************************* |
270 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
/**
* @dev transfer toke... |
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. |
270 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
/**
* @dev transfer toke... |
return balances[_owner];
| *
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address. |
270 | StandardToken | transferFrom | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) 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
* @p... |
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_fro... | *
* @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 uint the amout of tokens to be transfered |
270 | StandardToken | approve | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) 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
* @p... |
// 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
if ((_value != 0) &&... | *
* @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. |
270 | StandardToken | allowance | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) 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
* @p... |
return allowed[_owner][_spender];
| *
* @dev Function to check the amount of tokens than 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 uint specifing the amount of tokens still avaible for the spender. |
270 | AdsharesToken | AdsharesToken | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
owner1 = _owner1;
owner2 = _owner2;
withdrawAddress = _withdrawAddress;
crowdsaleStartBlock = _crowdsaleStartBlock;
| constructor |
270 | AdsharesToken | getLockedBalance | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
return this.balance.sub(unlockedBalance);
| *
* Returns not yet unlocked balance |
270 | AdsharesToken | getBuyPrice | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
// Token price formula is twofold. We have flat pricing below tokenCreationMin,
// and above that price linarly increases with supply.
uint flatTokenCount;
uint startSupply;
uint linearBidValue;
if(totalSupply < tokenCreationMin) {
uint... | *
* @dev Calculates how many tokens one can buy for specified value
* @return Amount of tokens one will receive and purchase value without remainder. |
270 | AdsharesToken | getSellPrice | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
uint flatTokenCount;
uint linearTokenMin;
if(totalSupply <= tokenCreationMin) {
return tokenPriceMin * _askSizeTokens;
}
if(totalSupply.sub(_askSizeTokens) < tokenCreationMin) {
flatTokenCount = tokenCreationMin - totalSupply.su... | *
* @dev Calculates average token price for sale of specified token count
* @return Total value received for given sale size. |
270 | AdsharesToken | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
buyLimit(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
| *
* Default function called by sending Ether to this address with no arguments.
* @dev Buy tokens with market order | |
270 | AdsharesToken | buy | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
buyLimit(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
| *
* @dev Buy tokens without price limit |
270 | AdsharesToken | buyLimit | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
require(msg.value >= tokenPriceMin);
assert(!isHalted);
uint boughtTokens;
uint averagePrice;
uint purchaseValue;
(boughtTokens, purchaseValue) = getBuyPrice(msg.value);
if(boughtTokens == 0) {
// bid to small, return ethe... | *
* @dev Buy tokens with limit maximum average price
* @param _maxPrice Maximum price user want to pay for one token |
270 | AdsharesToken | sell | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
sellLimit(_tokenCount, 0);
| *
* @dev Sell tokens without limit on price
* @param _tokenCount Amount of tokens user wants to sell |
270 | AdsharesToken | sellLimit | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
require(_tokenCount > 0);
assert(balances[msg.sender] >= _tokenCount);
uint saleValue = getSellPrice(_tokenCount);
uint averagePrice = saleValue.div(_tokenCount);
assert(averagePrice >= tokenPriceMin);
if(minFundingReached) {
averagePrice -... | *
* @dev Sell tokens with limit on minimum average priceprice
* @param _tokenCount Amount of tokens user wants to sell
* @param _minPrice Minimum price user wants to receive for one token |
270 | AdsharesToken | unlockFunds | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
assert(minFundingReached);
assert(block.timestamp >= fundingUnlockTime);
uint unlockedAmount = getLockedBalance().div(fundingUnlockFractionInvert);
unlockedBalance += unlockedAmount;
assert(getLockedBalance() > 0);
fundingUnlockTime += fundingUn... | *
* @dev Unlock funds for withdrawal. Only 1% can be unlocked weekly. |
270 | AdsharesToken | withdrawFunds | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
require(_value <= unlockedBalance);
assert(minFundingReached);
unlockedBalance -= _value;
withdrawnBalance += _value;
LogWithdraw(_value);
withdrawAddress.transfer(_value);
| *
* @dev Withdraw funds. Only unlocked funds can be withdrawn. |
270 | AdsharesToken | declareCrowdsaleEnd | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
assert(minFundingReached);
assert(crowdsaleEndDeclarationTime == 0);
crowdsaleEndDeclarationTime = block.timestamp;
LogCrowdsaleEnd(false);
| *
* @dev Declares that crowdsale is about to end. Users have one week to decide if the want to keep token or sell them to contract. |
270 | AdsharesToken | confirmCrowdsaleEnd | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
assert(crowdsaleEndDeclarationTime > 0 && block.timestamp > crowdsaleEndDeclarationTime + crowdsaleEndLockTime);
LogCrowdsaleEnd(true);
withdrawAddress.transfer(this.balance);
| *
* @dev Can be called one week after initial declaration. Withdraws ether and stops trading. Tokens remain in circulation. |
270 | AdsharesToken | haltCrowdsale | contract AdsharesToken is StandardToken {
using SafeMath for uint;
// metadata
string public constant name = "Adshares Token";
string public constant symbol = "ADST";
uint public constant decimals = 0;
// crowdsale parameters
uint public constant tokenCreationMin = 10000000;
... |
assert(!minFundingReached);
isHalted = !isHalted;
| *
* @dev Halts crowdsale. Can only be called before minimumFunding is reached.
* @dev When contract is halted no one can buy new tokens, but can sell them back to contract.
* @dev Function will be called if minimum funding target isn't reached for extended period of time |
271 | DOO | DOO | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
owner = msg.sender;
balances[owner] = _totalSupply;
| / @dev Constructor |
271 | DOO | totalSupply | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
return _totalSupply;
| / @dev Gets totalSupply
/ @return Total supply |
271 | DOO | balanceOf | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
return balances[_addr];
| / @dev Gets account's balance
/ @param _addr Address of the account
/ @return Account balance |
271 | DOO | isApprovedInvestor | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
return approvedInvestorList[_addr];
| / @dev check address is approved investor
/ @param _addr address |
271 | DOO | getDeposit | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
return deposit[_addr];
| / @dev get ETH deposit
/ @param _addr address get deposit
/ @return amount deposit of an buyer |
271 | DOO | transfer | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
// if sender's balance has enough unit and amount >= 0,
// and the sum is not overflow,
// then DOO transfer
if ( (balances[msg.sender] >= _amount) &&
(_amount >= 0) &&
(balances[_to] + _amount > balances[_to]) ) {
balances[msg.sender]... | / @dev Transfers the balance from msg.sender to an account
/ @param _to Recipient address
/ @param _amount Transfered amount in unit
/ @return Transfer status |
271 | DOO | transferFrom | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
if (balances[_from] >= _amount && _amount > 0 && allowed[_from][msg.sender] >= _amount) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
... | Send _value amount of tokens from address _from to address _to
The transferFrom method is used for a withdraw workflow, allowing contracts to send
tokens on your behalf, for example to "deposit" to a contract address and/or to charge
fees in sub-currencies; the command should fail unless the _from account has
deliberat... |
271 | DOO | approve | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
| Allow _spender to withdraw from your account, multiple times, up to the _value amount.
If this function is called again it overwrites the current allowance with _value. |
271 | DOO | allowance | contract DOO is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DOO";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DOO for each account
... |
return allowed[_owner][_spender];
| get allowance |
273 | GenericCrowdsale | pause | contract GenericCrowdsale {
address public icoBackend;
address public icoManager;
address public emergencyManager;
// paused state
bool paused = false;
/**
* @dev Confirms that token issuance for an off-chain purchase was processed successfully.
* @param _beneficiary Token ... |
paused = true;
Paused();
| *
* @dev Pauses the token allocation process. |
273 | GenericCrowdsale | unpause | contract GenericCrowdsale {
address public icoBackend;
address public icoManager;
address public emergencyManager;
// paused state
bool paused = false;
/**
* @dev Confirms that token issuance for an off-chain purchase was processed successfully.
* @param _beneficiary Token ... |
paused = false;
Unpaused();
| *
* @dev Unpauses the token allocation process. |
273 | GenericCrowdsale | changeicoBackend | contract GenericCrowdsale {
address public icoBackend;
address public icoManager;
address public emergencyManager;
// paused state
bool paused = false;
/**
* @dev Confirms that token issuance for an off-chain purchase was processed successfully.
* @param _beneficiary Token ... |
icoBackend = _icoBackend;
| *
* @dev Allows the manager to change backends. |
273 | Cappasity | Cappasity | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
manager = _manager;
| Constructor
=========== |
273 | Cappasity | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
revert();
| Fallback function
Do not allow to send money directly to this contract | |
273 | Cappasity | transfer | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(!tokensAreFrozen);
return super.transfer(_to, _value);
| ERC20 functions
========================= |
273 | Cappasity | mint | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(_value != 0);
require(totalSupply.add(_value) <= TOKEN_LIMIT);
require(mintingIsAllowed == true);
balances[_beneficiary] = balances[_beneficiary].add(_value);
totalSupply = totalSupply.add(_value);
| Mint some tokens and assign them to an address |
273 | Cappasity | endMinting | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(mintingIsAllowed == true);
mintingIsAllowed = false;
MintingDisabled();
| Disable minting. Can be enabled later, but TokenAllocation.sol only does that once. |
273 | Cappasity | startMinting | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(mintingIsAllowed == false);
mintingIsAllowed = true;
MintingAllowed();
| Enable minting. See TokenAllocation.sol |
273 | Cappasity | freeze | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(tokensAreFrozen == false);
tokensAreFrozen = true;
TokensFrozen();
| Disable token transfer |
273 | Cappasity | unfreeze | contract Cappasity is StandardToken {
// Constants
// =========
string public constant name = "Cappasity";
string public constant symbol = "CAPP";
uint8 public constant decimals = 2;
uint public constant TOKEN_LIMIT = 10 * 1e9 * 1e2; // 10 billion tokens, 2 decimals
// State varia... |
require(tokensAreFrozen == true);
tokensAreFrozen = false;
TokensUnfrozen();
| Allow token transfer |
273 | VestingWallet | VestingWallet | contract VestingWallet {
using SafeMath for uint;
event TokensReleased(uint _tokensReleased, uint _tokensRemaining, uint _nextPeriod);
address public foundersWallet;
address public crowdsaleContract;
ERC20 public tokenContract;
// Two-year vesting with 1 month cliff. Roughly.
bo... |
require(_foundersWallet != address(0));
require(_tokenContract != address(0));
foundersWallet = _foundersWallet;
tokenContract = ERC20(_tokenContract);
crowdsaleContract = msg.sender;
| Constructor
=========== |
273 | VestingWallet | releaseBatch | contract VestingWallet {
using SafeMath for uint;
event TokensReleased(uint _tokensReleased, uint _tokensRemaining, uint _nextPeriod);
address public foundersWallet;
address public crowdsaleContract;
ERC20 public tokenContract;
// Two-year vesting with 1 month cliff. Roughly.
bo... |
require(true == vestingStarted);
require(now > nextPeriod);
require(periodsPassed < totalPeriods);
uint tokensToRelease = 0;
do {
periodsPassed = periodsPassed.add(1);
nextPeriod = nextPeriod.add(cliffPeriod);
tokensToRelease ... | PRIVILEGED FUNCTIONS
==================== |
273 | TokenAllocation | TokenAllocation | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
require(_icoManager != address(0));
require(_icoBackend != address(0));
require(_foundersWallet != address(0));
require(_partnersWallet != address(0));
require(_emergencyManager != address(0));
tokenContract = new Cappasity(address(this));
icoManager ... | *
* @dev Constructs the allocator.
* @param _icoBackend Wallet address that should be owned by the off-chain backend, from which \
* \ it mints the tokens for contributions accepted in other currencies.
* @param _icoManager Allowed to start phase 2.
* @param _foundersWallet Where ... |
273 | TokenAllocation | issueTokens | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
// phase 1 cap less than hard cap
if (crowdsalePhase == CrowdsalePhase.PhaseOne) {
require(totalCentsGathered.add(_contribution) <= phaseOneCap);
} else {
require(totalCentsGathered.add(_contribution) <= hardCap);
}
uint remainingContribution = _... | PRIVILEGED FUNCTIONS
====================
*
* @dev Issues tokens for a particular address as for a contribution of size _contribution, \
* \ then issues bonuses in proportion.
* @param _beneficiary Receiver of the tokens.
* @param _contribution Size of the contribution (in USD cents). |
273 | TokenAllocation | issueTokensWithCustomBonus | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
// sanity check, ensure we allocate more than 0
require(_tokens > 0);
// all tokens can be bonuses, but they cant be less than bonuses
require(_tokens >= _bonus);
// check capps
if (crowdsalePhase == CrowdsalePhase.PhaseOne) {
// ensure we are not ov... | *
* @dev Issues tokens for the off-chain contributors by accepting calls from the trusted address.
* Supposed to be run by the backend. Used for distributing bonuses for affiliate transactions
* and special offers
*
* @param _beneficiary Token holder.
* @param _contribu... |
273 | TokenAllocation | rewardFoundersAndPartners | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
uint tokensDuringThisPhase;
if (crowdsalePhase == CrowdsalePhase.PhaseOne) {
tokensDuringThisPhase = totalTokenSupply;
} else {
tokensDuringThisPhase = totalTokenSupply - tokensDuringPhaseOne;
}
// Total tokens sold is 70% of the overall supply, ... | *
* @dev Issues the rewards for founders and early contributors. 18% and 12% of the total token supply by the end
* of the crowdsale, respectively, including all the token bonuses on early contributions. Can only be
* called after the end of the crowdsale phase, ends the current phase. |
273 | TokenAllocation | beginPhaseTwo | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
require(crowdsalePhase == CrowdsalePhase.BetweenPhases);
require(_tokenRate != 0);
tokenRate = _tokenRate;
crowdsalePhase = CrowdsalePhase.PhaseTwo;
bonusPhase = BonusPhase.TenPercent;
tokenContract.startMinting();
| *
* @dev Set the CAPP / USD rate for Phase two, and then start the second phase of token allocation.
* Can only be called by the crowdsale manager.
* _tokenRate How many CAPP per 1 USD cent. As dollars, CAPP has two decimals.
* For instance: tokenRate = 125 means "1.25 CAPP per... |
273 | TokenAllocation | freeze | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
require(crowdsalePhase != CrowdsalePhase.PhaseOne);
tokenContract.freeze();
| *
* @dev Allows to freeze all token transfers in the future
* This is done to allow migrating to new contract in the future
* If such need ever arises (ie Migration to ERC23, or anything that community decides worth doing) |
273 | TokenAllocation | calculateCentsLeftInPhase | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
// Ten percent bonuses happen in both Phase One and Phase two, therefore:
// Take the bonus tier size, subtract the total money gathered in the current phase
if (bonusPhase == BonusPhase.TenPercent) {
return bonusTierSize.sub(totalCentsGathered.sub(centsInPhaseOne));
}
... | INTERNAL FUNCTIONS
==================== |
273 | TokenAllocation | advanceBonusPhase | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
if (crowdsalePhase == CrowdsalePhase.PhaseOne) {
if (bonusPhase == BonusPhase.TenPercent) {
bonusPhase = BonusPhase.FivePercent;
} else if (bonusPhase == BonusPhase.FivePercent) {
bonusPhase = BonusPhase.None;
}
} else if (bonus... | *
* @dev Advance the bonus phase to next tier when appropriate, do nothing otherwise. |
273 | TokenAllocation | contract TokenAllocation is GenericCrowdsale {
using SafeMath for uint;
// Events
event TokensAllocated(address _beneficiary, uint _contribution, uint _tokensIssued);
event BonusIssued(address _beneficiary, uint _bonusTokensIssued);
event FoundersAndPartnersTokensIssued(address _foundersWalle... |
revert();
| Do not allow to send money directly to this contract | |
275 | NFTeGG_Fame_Token | null | contract NFTeGG_Fame_Token is ERC20Interface, SafeMath {
string public name;
string public symbol;
uint8 public decimals;
uint256 public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* Constructor fu... |
name = "NFTeGG Fame Token";
symbol = "eFAME";
decimals = 18;
_totalSupply = 10000000000000000000000000;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
| *
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract |
277 | Context | _msgSender | contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {<FILL_FUNCTION_BODY>}
} |
return msg.sender;
| solhint-disable-previous-line no-empty-blocks |
278 | Crowdsale | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
| *
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold |
278 | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
buyTokens(msg.sender);
| -----------------------------------------
Crowdsale external interface
-----------------------------------------
*
* @dev fallback function ***DO NOT OVERRIDE*** | |
278 | Crowdsale | buyTokens | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = 0;
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit To... | *
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase |
278 | Crowdsale | _preValidatePurchase | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
require(_beneficiary != address(0));
require(_weiAmount != 0);
| -----------------------------------------
Internal interface (extensible)
-----------------------------------------
*
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing ... |
278 | Crowdsale | _postValidatePurchase | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
// optional override
| *
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase |
278 | Crowdsale | _deliverTokens | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
token.transfer(_beneficiary, _tokenAmount);
| *
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted |
278 | Crowdsale | _processPurchase | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
_deliverTokens(_beneficiary, _tokenAmount);
| *
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased |
278 | Crowdsale | _updatePurchasingState | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
// optional override
| *
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase |
278 | Crowdsale | _getTokenAmount | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
return _weiAmount.mul(rate);
| *
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount |
278 | Crowdsale | _forwardFunds | contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised... |
wallet.transfer(msg.value);
| *
* @dev Determines how ETH is stored/forwarded on purchases. |
278 | 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_B... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
278 | 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 ... |
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. |
278 | HexanCoinCrowdsale | HexanCoinCrowdsale | contract HexanCoinCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
// Map of all purchaiser's balances (doesn't include bounty amounts)
mapping(address => uint256) public balances;
// Amount of issued tokens
uint256 public tokensIssued;
// Bonus tokens rate multiplier x1... |
bonusMultiplier = _bonusMultiplier;
| *
* Init crowdsale by setting its params
*
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
* @param _bonusMultiplier bonus tokens rate multiplier x1000 |
278 | HexanCoinCrowdsale | withdrawTokens | contract HexanCoinCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
// Map of all purchaiser's balances (doesn't include bounty amounts)
mapping(address => uint256) public balances;
// Amount of issued tokens
uint256 public tokensIssued;
// Bonus tokens rate multiplier x1... |
_withdrawTokensFor(msg.sender);
| *
* @dev Withdraw tokens only after crowdsale ends. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.