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 |
|---|---|---|---|---|---|
44 | FinallyCoinConnects | burn | contract FinallyCoinConnects {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18; //小数位
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
... |
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
44 | FinallyCoinConnects | burnFrom | contract FinallyCoinConnects {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18; //小数位
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
... |
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender... | *
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn |
45 | NatminToken | name | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return _name;
| Returns the _name of the token |
45 | NatminToken | symbol | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return _symbol;
| Returns the _symbol of the token |
45 | NatminToken | standard | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return _standard;
| Returns the _standard of the token |
45 | NatminToken | decimals | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return _decimals;
| Returns the _decimals of the token |
45 | NatminToken | totalSupply | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return _totalSupply;
| Function to return the total supply of the token |
45 | NatminToken | balanceOf | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return balances[_user];
| Function to return the balance of a specified address |
45 | NatminToken | transfer | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
bytes memory _empty;
if(isContract(_to)){
return transferToContract(_to, _value, _empty);
}else{
return transferToAddress(_to, _value, _empty);
}
| Transfer function to be compatable with ERC20 Standard |
45 | NatminToken | transfer | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
if(isContract(_to)){
return transferToContract(_to, _value, _data);
}else{
return transferToAddress(_to, _value, _data);
}
| Transfer function to be compatable with ERC223 Standard |
45 | NatminToken | isContract | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
uint256 _codeLength;
assembly {
_codeLength := extcodesize(_to)
}
return _codeLength > 0;
| This function checks if the address is a contract or wallet
If the codeLength is greater than 0, it is a contract |
45 | NatminToken | transferToContract | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
require(balances[msg.sender] >= _value);
require(vestingEnded(msg.sender));
// This will override settings and allow contract owner to send to contract
if(msg.sender != contractOwner){
ERC223ReceivingContract _tokenReceiver = ERC223ReceivingContract(_to);
... | This function to be used if the target is a contract address |
45 | NatminToken | transferToAddress | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
require(balances[msg.sender] >= _value);
require(vestingEnded(msg.sender));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data)... | This function to be used if the target is a normal eth/wallet address |
45 | NatminToken | transferFrom | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
require(_value <= allowed[_from][msg.sender]);
require(_value <= balances[_from]);
require(vestingEnded(_from));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(... | ERC20 standard function |
45 | NatminToken | approve | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| ERC20 standard function |
45 | NatminToken | allowance | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
return allowed[_owner][_spender];
| ERC20 standard function |
45 | NatminToken | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
revert();
| Stops any attempt from sending Ether to this contract | |
45 | NatminToken | burn | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
_burn(msg.sender, _value);
| public function to call the _burn function |
45 | NatminToken | _burn | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
require(balances[_user] >= _value);
balances[_user] = balances[_user].sub(_value);
_totalSupply = _totalSupply.sub(_value);
emit Burn(_user, _value);
emit Transfer(_user, address(0), _value);
bytes memory _empty;
emit Transfer(_user, address(... | Burn the specified amount of tokens by the owner |
45 | NatminToken | addVesting | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
vestings[_user].amount = _amount;
vestings[_user].endTime = now + 180 days;
| Create a vesting entry for the specified user |
45 | NatminToken | getVestedAmount | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
_amount = vestings[_user].amount;
return _amount;
| Returns the vested amount for a specified user |
45 | NatminToken | getVestingEndTime | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
_endTime = vestings[_user].endTime;
return _endTime;
| Returns the vested end time for a specified user |
45 | NatminToken | vestingEnded | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
if(vestings[_user].endTime <= now) {
return true;
}
else {
return false;
}
| Checks if the venting period is over for a specified user |
45 | NatminToken | endVesting | contract NatminToken is ERC20Standard, ERC223Standard, Ownable, NatminVesting, BurnToken {
using SafeMath for uint256;
string _name = "Natmin";
string _symbol = "NAT";
string _standard = "ERC20 / ERC223";
uint256 _decimals = 18; // same value as wei
uint256 _totalSupply;
mapping(a... |
vestings[_user].endTime = now;
| Manual end vested time |
48 | raskaToken | raskaToken | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
symbol = "RKC";
name = "raska Token";
decimals = 18;
_totalSupply = 500000000000000000000000000;
balances[0xd96b07D42cbbd5442c6656232FFB030eaF6AbcF9] = _totalSupply;
Transfer(address(0), 0xd96b07D42cbbd5442c6656232FFB030eaF6AbcF9, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
48 | raskaToken | totalSupply | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
return _totalSupply - balances[address(0)];
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
48 | raskaToken | balanceOf | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account tokenOwner
------------------------------------------------------------------------ |
48 | raskaToken | transfer | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
return true;
| ------------------------------------------------------------------------
Transfer the balance from token owner's account to to account
- Owner's account must have sufficient balance to transfer
- 0 value transfers are allowed
------------------------------------------------------------------------ |
48 | raskaToken | approve | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
| https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
recommends that there are no checks for the approval double-spend attack
as this should be implemented in user interfaces
------------------------------------------------------------------------ |
48 | raskaToken | transferFrom | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, tokens);
return true;
| The calling account must already have sufficient tokens approve(...)-d
for spending from the from account and
- From account must have sufficient balance to transfer
- Spender must have sufficient allowance to transfer
- 0 value transfers are allowed
---------------------------------------------------------------------... |
48 | raskaToken | allowance | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
48 | raskaToken | approveAndCall | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
| ------------------------------------------------------------------------
Token owner can approve for spender to transferFrom(...) tokens
from the token owner's account. The spender contract function
receiveApproval(...) is then executed
------------------------------------------------------------------------ |
48 | raskaToken | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
48 | raskaToken | transferAnyERC20Token | contract raskaToken is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// --------------------------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
49 | BasicToken | totalSupply | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {<FILL_FUNCTION_BODY>}
/**
* @dev Transf... |
return totalSupply_;
| *
* @dev Total number of tokens in existence |
49 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 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]);
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. |
49 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 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. |
49 | 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... |
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 |
49 | 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... |
// avoid race condition
require((_value == 0) || (allowed[msg.sender][_spender] == 0), "reset allowance to 0 before change it's value.");
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
... |
49 | 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... |
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. |
50 | Ownable | Ownable | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {<FILL_FUNCTION_BODY>}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() ... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
50 | Ownable | transferOwnership | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onl... |
if (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. |
50 | Pausable | pause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the cont... |
paused = true;
Pause();
return true;
| *
* @dev called by the owner to pause, triggers stopped state |
50 | Pausable | unpause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the cont... |
paused = false;
Unpause();
return true;
| *
* @dev called by the owner to unpause, returns to normal state |
50 | 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) ret... |
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. |
50 | 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) ret... |
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. |
50 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_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 uint256 the amout of tokens to be transfered |
50 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0... | *
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. |
50 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
... |
return allowed[_owner][_spender];
| *
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender. |
50 | SomaIco | contract SomaIco is PausableToken {
using SafeMath for uint256;
string public name = "Soma Community Token";
string public symbol = "SCT";
uint8 public decimals = 18;
address public liquidityReserveWallet; // address where liquidity reserve tokens will be delivered
address public walle... |
address recipient = msg.sender;
uint256 weiAmount = msg.value;
uint256 amount = weiAmount.mul(rate);
assignTokens(recipient, amount);
totalRaised = totalRaised.add(weiAmount);
forwardFundsToWallet();
| / fallback function to buy tokens | |
50 | SomaIco | burn | contract SomaIco is PausableToken {
using SafeMath for uint256;
string public name = "Soma Community Token";
string public symbol = "SCT";
uint8 public decimals = 18;
address public liquidityReserveWallet; // address where liquidity reserve tokens will be delivered
address public walle... |
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
| *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
51 | Ownable | null | contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {<FILL_FUNCTION_BODY>}
/**
... |
admin = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
51 | Ownable | transferOwnership | contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
... |
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
51 | YeFiMpool1 | setTokenAddresses | contract YeFiMpool1 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfilend token contract address
address public tokenAddress;
// reward rate % per year
uint public rew... |
require(_tokenAddr != address(0), "Invalid address format is not supported");
tokenAddress = _tokenAddr;
| =============================ADMINISTRATIVE FUNCTIONS ================================== |
52 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
52 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
return balances[_owner];
| *
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. |
52 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfe... | *
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred |
52 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate thi... |
52 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
return allowed[_owner][_spender];
| *
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. |
53 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 bal... | / @return total amount of tokens | |
53 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {<FILL_FUNCTIO... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
53 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @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 | |
53 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @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 | |
53 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @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 | |
53 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @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 | |
53 | BoxTrade | BoxTrade | contract BoxTrade is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to custom... |
balances[msg.sender] = 100000000000000000;
totalSupply = 100000000000000000;
name = "BoxTrade"; // Set the name for display purposes
decimals = 5; // Amount of decimals for display purposes
symbol = "BOXY"; ... | human 0.1 standard. Just an arbitrary versioning scheme. |
53 | BoxTrade | approveAndCall | contract BoxTrade is StandardToken {
function () {
//if ether is sent to this address, send it back.
throw;
}
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to custom... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
55 | ERC20 | totalSupply | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
return _totalSupply;
| *
* @dev Total number of tokens in existence |
55 | ERC20 | balanceOf | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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. |
55 | ERC20 | allowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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. |
55 | ERC20 | transfer | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
_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. |
55 | ERC20 | approve | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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
... |
55 | ERC20 | transferFrom | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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 |
55 | ERC20 | increaseAllowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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... |
55 | ERC20 | decreaseAllowance | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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... |
55 | ERC20 | _transfer | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
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. |
55 | ERC20 | _mint | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
| *
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created. |
55 | ERC20 | _burn | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
| *
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt. |
55 | ERC20 | _burnFrom | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view re... |
require(value <= _allowed[account][msg.sender]);
// 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.sender].sub(
value);
_burn(ac... | *
* @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 value The amount that will be burnt. |
55 | ERC20Mintable | mint | contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
... |
_mint(to, value);
return true;
| *
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful. |
55 | Crowdsale | null | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
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
* @dev The rate is the conversion between wei and the smallest and indivisible
* token unit. So, if you are using a rate of 1 with a ERC20Detailed token
* with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK.
* @param wallet ... |
55 | Crowdsale | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
buyTokens(msg.sender);
| -----------------------------------------
Crowdsale external interface
-----------------------------------------
*
* @dev fallback function ***DO NOT OVERRIDE*** | |
55 | Crowdsale | token | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
return _token;
| *
* @return the token being sold. |
55 | Crowdsale | wallet | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
return _wallet;
| *
* @return the address where funds are collected. |
55 | Crowdsale | rate | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
return _rate;
| *
* @return the number of token units a buyer gets per wei. |
55 | Crowdsale | weiRaised | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
return _weiRaised;
| *
* @return the mount of wei raised. |
55 | Crowdsale | buyTokens | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPur... | *
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param beneficiary Address performing the token purchase |
55 | Crowdsale | _preValidatePurchase | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
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` in contracts that inherit from Crowdsale to extend their validations.
*... |
55 | Crowdsale | _postValidatePurchase | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
// 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 |
55 | Crowdsale | _deliverTokens | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
_token.safeTransfer(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 |
55 | Crowdsale | _processPurchase | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
_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 |
55 | Crowdsale | _updatePurchasingState | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
// 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 |
55 | Crowdsale | _getTokenAmount | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
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 |
55 | Crowdsale | _forwardFunds | contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The token being sold
IERC20 private _token;
// Address where funds are collected
address private _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest... |
_wallet.transfer(msg.value);
| *
* @dev Determines how ETH is stored/forwarded on purchases. |
55 | TimedCrowdsale | null | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
// solium-disable-next-line security/no-block-members
require(openingTime >= block.timestamp, "The Crowdsale must not start in the past");
require(closingTime >= openingTime, "The Crowdsale must end in the future");
_openingTime = openingTime;
_closingTime = closingTime;
| *
* @dev Constructor, takes crowdsale opening and closing times.
* @param openingTime Crowdsale opening time
* @param closingTime Crowdsale closing time |
55 | TimedCrowdsale | openingTime | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
return _openingTime;
| *
* @return the crowdsale opening time. |
55 | TimedCrowdsale | closingTime | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
return _closingTime;
| *
* @return the crowdsale closing time. |
55 | TimedCrowdsale | isOpen | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
// solium-disable-next-line security/no-block-members
return block.timestamp >= _openingTime && block.timestamp <= _closingTime;
| *
* @return true if the crowdsale is open, false otherwise. |
55 | TimedCrowdsale | hasClosed | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
// solium-disable-next-line security/no-block-members
return block.timestamp > _closingTime;
| *
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed |
55 | TimedCrowdsale | _preValidatePurchase | contract TimedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
uint256 internal _closingTime;
/**
* @dev Reverts if not in crowdsale time range.
*/
modifier onlyWhileOpen {
require(isOpen(), "Crowdsale is no longer open");
_;
}
/**
* @de... |
super._preValidatePurchase(beneficiary, weiAmount);
| *
* @dev Extend parent behavior requiring to be within contributing period
* @param beneficiary Token purchaser
* @param weiAmount Amount of wei contributed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.