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 |
|---|---|---|---|---|---|
64 | StandardToken | approve | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @par... |
// 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
... | *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent. |
64 | StandardToken | allowance | contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @par... |
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 specifying the amount of tokens still available for the spender. |
64 | Pausable | pause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = true;
Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
64 | Pausable | unpause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = false;
Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
64 | BlackList | getBlackListStatus | contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {<FILL_FUNCTION_BODY>}
function getOwner() external constant retu... |
return isBlackListed[_maker];
| ///// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) /////// |
64 | QuintetToken | QuintetToken | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
| @param _balance Initial supply of the contract
@param _name Token Name
@param _symbol Token symbol
@param _decimals Token decimals |
64 | QuintetToken | transfer | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
| Forward ERC20 methods to upgraded contract if this one is deprecated |
64 | QuintetToken | transferFrom | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
| Forward ERC20 methods to upgraded contract if this one is deprecated |
64 | QuintetToken | balanceOf | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
| Forward ERC20 methods to upgraded contract if this one is deprecated |
64 | QuintetToken | approve | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
| Forward ERC20 methods to upgraded contract if this one is deprecated |
64 | QuintetToken | allowance | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
| Forward ERC20 methods to upgraded contract if this one is deprecated |
64 | QuintetToken | deprecate | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
| deprecate current contract in favour of a new one |
64 | QuintetToken | totalSupply | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
| deprecate current contract if favour of a new one |
64 | QuintetToken | issue | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
| @param _amount Number of tokens to be issued |
64 | QuintetToken | redeem | contract QuintetToken is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the... |
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
| Redeem tokens.
These tokens are withdrawn from the owner address
if the balance must be enough to cover the redeem
or the call will fail.
@param _amount Number of tokens to be issued |
65 | Ownable | null | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
65 | Ownable | renounceOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
emit OwnershipRenounced(owner);
owner = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore. |
65 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
_transferOwnership(_newOwner);
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
65 | Ownable | _transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* a... |
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
| *
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
66 | Ownable | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {<FILL_FUNCTION_BODY>}
/... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
66 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}... |
require(newOwner != address(0));
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. |
66 | Pausable | pause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = true;
emit Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
66 | Pausable | unpause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function ... |
paused = false;
emit Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
66 | 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. |
66 | 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. |
66 | 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 |
66 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
allowed[msg.sender][_spender] = _value;
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... |
66 | 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. |
66 | StandardToken | increaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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
* @... |
66 | StandardToken | decreaseApproval | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
... | *
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @... |
68 | AraProxy | null | contract AraProxy {
bytes32 private constant registryPosition_ = keccak256("io.ara.proxy.registry");
bytes32 private constant implementationPosition_ = keccak256("io.ara.proxy.implementation");
modifier restricted() {
bytes32 registryPosition = registryPosition_;
address registryAddress;
ass... |
bytes32 registryPosition = registryPosition_;
bytes32 implementationPosition = implementationPosition_;
assembly {
sstore(registryPosition, _registryAddress)
sstore(implementationPosition, _implementationAddress)
}
| *
* @dev the constructor sets the AraRegistry address |
68 | AraProxy | contract AraProxy {
bytes32 private constant registryPosition_ = keccak256("io.ara.proxy.registry");
bytes32 private constant implementationPosition_ = keccak256("io.ara.proxy.implementation");
modifier restricted() {
bytes32 registryPosition = registryPosition_;
address registryAddress;
ass... |
bytes32 implementationPosition = implementationPosition_;
address _impl;
assembly {
_impl := sload(implementationPosition)
}
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
... | *
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns | |
70 | 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. |
70 | 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. |
70 | 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 ... |
70 | 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. |
71 | 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. |
71 | 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 o... |
require(newOwner != address(0));
owner = newOwner;
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to. |
71 | Haltable | halt | contract Haltable is Ownable {
bool public halted;
event Halted(bool halted);
modifier stopInEmergency {
require(!halted);
_;
}
modifier onlyInEmergency {
require(halted);
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOw... |
halted = true;
Halted(true);
| called by the owner on emergency, triggers stopped state |
71 | Haltable | unhalt | contract Haltable is Ownable {
bool public halted;
event Halted(bool halted);
modifier stopInEmergency {
require(!halted);
_;
}
modifier onlyInEmergency {
require(halted);
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOw... |
halted = false;
Halted(false);
| called by the owner on end of emergency, returns to normal state |
71 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* Obsolete. Removed this check based on:
* https://blog.coinfabrik.com/smart-contract-short-address-attack-mitigation-failure/
* @dev Fix for the ERC20 short address attack.
*
* modifier ... |
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
| *
* Obsolete. Removed this check based on:
* https://blog.coinfabrik.com/smart-contract-short-address-attack-mitigation-failure/
* @dev Fix for the ERC20 short address attack.
*
* modifier onlyPayloadSize(uint size) {
* require(msg.data.length >= size + 4);
* _;
* }
*
* @dev tra... |
71 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/**
* Obsolete. Removed this check based on:
* https://blog.coinfabrik.com/smart-contract-short-address-attack-mitigation-failure/
* @dev Fix for the ERC20 short address attack.
*
* modifier ... |
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. |
71 | StandardToken | isToken | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
return true;
| Interface declaration |
71 | StandardToken | transferFrom | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
uint _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);
// SafeMath uses assert instead of require though, beware when using an analysis tool
balances[_to] = balan... | *
* @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 |
71 | StandardToken | approve | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
// 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. |
71 | StandardToken | allowance | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
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. |
71 | StandardToken | addApproval | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
uint oldValue = allowed[msg.sender][_spender];
allowed[msg.sender][_spender] = oldValue.add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
| *
* Atomic increment of approved spending
*
* Works around https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* |
71 | StandardToken | subApproval | contract StandardToken is BasicToken, ERC20 {
/* Token supply got increased and a new owner received these tokens */
event Minted(address receiver, uint amount);
mapping (address => mapping (address => uint)) allowed;
/* Interface declaration */
function isToken() public constant returns (bool weAr... |
uint oldVal = allowed[msg.sender][_spender];
if (_subtractedValue > oldVal) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldVal.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
re... | *
* Atomic decrement of approved spending.
*
* Works around https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 |
71 | ReleasableToken | setReleaseAgent | contract ReleasableToken is StandardToken, Ownable {
/* The finalizer contract that allows lifting the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released ... |
// We don't do interface check here as we might want to have a normal wallet address to act as a release agent.
releaseAgent = addr;
| *
* Set the contract that can call release and make the token transferable.
*
* Since the owner of this contract is (or should be) the crowdsale,
* it can only be called by a corresponding exposed API in the crowdsale contract in case of input error. |
71 | ReleasableToken | setTransferAgent | contract ReleasableToken is StandardToken, Ownable {
/* The finalizer contract that allows lifting the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released ... |
transferAgents[addr] = state;
| *
* Owner can allow a particular address (e.g. a crowdsale contract) to transfer tokens despite the lock up period. |
71 | ReleasableToken | releaseTokenTransfer | contract ReleasableToken is StandardToken, Ownable {
/* The finalizer contract that allows lifting the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released ... |
released = true;
| *
* One way function to release the tokens into the wild.
*
* Can be called only from the release agent that should typically be the finalize agent ICO contract.
* In the scope of the crowdsale, it is only called if the crowdsale has been a success (first milestone reached). |
71 | ReleasableToken | transfer | contract ReleasableToken is StandardToken, Ownable {
/* The finalizer contract that allows lifting the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released ... |
// Call StandardToken.transfer()
return super.transfer(_to, _value);
| * We restrict transfer by overriding it |
71 | ReleasableToken | transferFrom | contract ReleasableToken is StandardToken, Ownable {
/* The finalizer contract that allows lifting the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released ... |
// Call StandardToken.transferForm()
return super.transferFrom(_from, _to, _value);
| * We restrict transferFrom by overriding it |
71 | MintableToken | mint | contract MintableToken is StandardToken, Ownable {
using SafeMath for uint;
bool public mintingFinished = false;
/** List of agents that are allowed to create new tokens */
mapping (address => bool) public mintAgents;
event MintingAgentChanged(address addr, bool state);
function MintableTo... |
mintInternal(receiver, amount);
| *
* Create new tokens and allocate them to an address.
*
* Only callable by a crowdsale contract (mint agent). |
71 | MintableToken | setMintAgent | contract MintableToken is StandardToken, Ownable {
using SafeMath for uint;
bool public mintingFinished = false;
/** List of agents that are allowed to create new tokens */
mapping (address => bool) public mintAgents;
event MintingAgentChanged(address addr, bool state);
function MintableTo... |
mintAgents[addr] = state;
MintingAgentChanged(addr, state);
| *
* Owner can allow a crowdsale contract to mint new tokens. |
71 | UpgradeAgent | isUpgradeAgent | contract UpgradeAgent {
/** This value should be the same as the original token's total supply */
uint public originalSupply;
/** Interface to ensure the contract is correctly configured */
function isUpgradeAgent() public constant returns (bool) {<FILL_FUNCTION_BODY>}
/**
Upgrade an account
... |
return true;
| * Interface to ensure the contract is correctly configured |
71 | UpgradeableToken | UpgradeableToken | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
setUpgradeMaster(_upgradeMaster);
| *
* Do not allow construction without upgrade master set. |
71 | UpgradeableToken | upgrade | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
UpgradeState state = getUpgradeState();
// Ensure it's not called in a bad state
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
// Validate input value.
require(value != 0);
balances[msg.sender] = balances[msg.sender].sub(value);
// Take token... | *
* Allow the token holder to upgrade some of their tokens to a new contract. |
71 | UpgradeableToken | setUpgradeAgent | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
// Check whether the token is in a state that we could think of upgrading
require(canUpgrade());
require(agent != 0x0);
// Only a master can designate the next agent
require(msg.sender == upgradeMaster);
// Upgrade has already begun for an agent
require(getUpgradeState() != Upgrade... | *
* Set an upgrade agent that handles the upgrade process |
71 | UpgradeableToken | getUpgradeState | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
if (!canUpgrade()) return UpgradeState.NotAllowed;
else if (address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent;
else if (totalUpgraded == 0) return UpgradeState.ReadyToUpgrade;
else return UpgradeState.Upgrading;
| *
* Get the state of the token upgrade. |
71 | UpgradeableToken | changeUpgradeMaster | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
require(msg.sender == upgradeMaster);
setUpgradeMaster(new_master);
| *
* Change the upgrade master.
*
* This allows us to set a new owner for the upgrade mechanism. |
71 | UpgradeableToken | setUpgradeMaster | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
require(new_master != 0x0);
upgradeMaster = new_master;
| *
* Internal upgrade master setter. |
71 | UpgradeableToken | canUpgrade | contract UpgradeableToken is StandardToken {
/** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */
address public upgradeMaster;
/** The next contract where the tokens will be migrated. */
UpgradeAgent public upgradeAge... |
return true;
| *
* Child contract can enable to provide the condition when the upgrade can begin. |
71 | CrowdsaleToken | CrowdsaleToken | contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken, FractionalERC20 {
event UpdatedTokenInformation(string newName, string newSymbol);
string public name;
string public symbol;
/**
* Construct the token.
*
* This token must be created through a team multisig wall... |
name = _name;
symbol = _symbol;
decimals = _decimals;
| *
* Construct the token.
*
* This token must be created through a team multisig wallet, so that it is owned by that wallet.
*
* @param _name Token name
* @param _symbol Token symbol - typically it's all caps
* @param _initialSupply How many tokens we start with
* @param _decimals Number ... |
71 | CrowdsaleToken | releaseTokenTransfer | contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken, FractionalERC20 {
event UpdatedTokenInformation(string newName, string newSymbol);
string public name;
string public symbol;
/**
* Construct the token.
*
* This token must be created through a team multisig wall... |
mintingFinished = true;
super.releaseTokenTransfer();
| *
* When token is released to be transferable, prohibit new token creation. |
71 | CrowdsaleToken | canUpgrade | contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken, FractionalERC20 {
event UpdatedTokenInformation(string newName, string newSymbol);
string public name;
string public symbol;
/**
* Construct the token.
*
* This token must be created through a team multisig wall... |
return released && super.canUpgrade();
| *
* Allow upgrade agent functionality to kick in only if the crowdsale was a success. |
71 | CrowdsaleToken | setTokenInformation | contract CrowdsaleToken is ReleasableToken, MintableToken, UpgradeableToken, FractionalERC20 {
event UpdatedTokenInformation(string newName, string newSymbol);
string public name;
string public symbol;
/**
* Construct the token.
*
* This token must be created through a team multisig wall... |
name = _name;
symbol = _symbol;
UpdatedTokenInformation(name, symbol);
| *
* Owner can update token information here |
71 | Crowdsale | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(false);
| *
* Don't expect to just send in money and get tokens. | |
71 | Crowdsale | investInternal | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
// Determine if it's a good time to accept investment from this participant
if (getState() == State.PreFunding) {
// Are we whitelisted for early deposit
require(earlyParticipantWhitelist[receiver]);
}
uint weiAmount = ceilingStrategy.weiAllowedToReceive(msg.value, weiRaised, invest... | *
* Make an investment.
*
* Crowdsale must be running for one to invest.
* We must have not pressed the emergency brake.
*
* @param receiver The Ethereum address who receives the tokens
* @param customerId (optional) UUID v4 to track the successful payments on the server side
* |
71 | Crowdsale | preallocate | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(receiver != address(0));
uint tokenAmount = fullTokens.mul(10**uint(token.decimals()));
require(tokenAmount != 0);
uint weiAmount = weiPrice.mul(tokenAmount); // This can also be 0, in which case we give out tokens for free
updateInvestorFunds(tokenAmount, weiAmount, receiver , 0);
| *
* Preallocate tokens for the early investors.
*
* Preallocated tokens have been sold before the actual crowdsale opens.
* This function mints the tokens and moves the crowdsale needle.
*
* No money is exchanged, as the crowdsale team already have received the payment.
*
* @param fullTo... |
71 | Crowdsale | updateInvestorFunds | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
// Update investor
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
// Update totals
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
assignTokens(receiver, t... | *
* Private function to update accounting in the crowdsale. |
71 | Crowdsale | setFundingCap | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
weiFundingCap = ceilingStrategy.relaxFundingCap(newCap, weiRaised);
require(weiFundingCap >= minimumFundingGoal);
FundingCapSet(weiFundingCap);
| *
* Allow the owner to set a funding cap on the crowdsale.
* The new cap should be higher than the minimum funding goal.
*
* @param newCap minimum target cap that may be relaxed if it was already broken. |
71 | Crowdsale | buyWithCustomerId | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(customerId != 0); // UUIDv4 sanity check
investInternal(msg.sender, customerId);
| *
* Invest to tokens, recognize the payer.
* |
71 | Crowdsale | buy | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(!requireCustomerId); // Crowdsale needs to track participants for thank you email
investInternal(msg.sender, 0);
| *
* The basic entry point to participate in the crowdsale process.
*
* Pay for funding, get invested tokens back in the sender address. |
71 | Crowdsale | finalize | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
finalizeAgent.finalizeCrowdsale(token);
finalized = true;
Finalized();
| *
* Finalize a succcesful crowdsale.
*
* The owner can trigger a call the contract that provides post-crowdsale actions, like releasing the tokens. |
71 | Crowdsale | setRequireCustomerId | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
requireCustomerId = value;
InvestmentPolicyChanged(requireCustomerId);
| *
* Set policy do we need to have server-side customer ids for the investments.
* |
71 | Crowdsale | setEarlyParticipantWhitelist | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
earlyParticipantWhitelist[addr] = status;
Whitelisted(addr, status);
| *
* Allow addresses to do early participation.
* |
71 | Crowdsale | setPricingStrategy | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
// Disallow setting a bad agent
require(addr.isPricingStrategy());
pricingStrategy = addr;
| *
* Allow to (re)set pricing strategy. |
71 | Crowdsale | setCeilingStrategy | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
// Disallow setting a bad agent
require(addr.isCeilingStrategy());
ceilingStrategy = addr;
| *
* Allow to (re)set ceiling strategy. |
71 | Crowdsale | setFinalizeAgent | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
// Disallow setting a bad agent
require(addr.isFinalizeAgent());
finalizeAgent = addr;
require(isFinalizerSane());
| *
* Allow to (re)set finalize agent. |
71 | Crowdsale | setMultisig | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(addr != 0);
multisigWallet = addr;
| *
* Internal setter for the multisig wallet |
71 | Crowdsale | loadRefund | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
require(msg.value >= weiRaised);
require(weiRefunded == 0);
uint excedent = msg.value.sub(weiRaised);
loadedRefund = loadedRefund.add(msg.value.sub(excedent));
investedAmountOf[msg.sender].add(excedent);
| *
* Allow load refunds back on the contract for the refunding.
*
* The team can transfer the funds back on the smart contract in the case that the minimum goal was not reached. |
71 | Crowdsale | refund | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
uint weiValue = investedAmountOf[msg.sender];
require(weiValue != 0);
investedAmountOf[msg.sender] = 0;
weiRefunded = weiRefunded.add(weiValue);
Refund(msg.sender, weiValue);
msg.sender.transfer(weiValue);
| *
* Investors can claim refund. |
71 | Crowdsale | isMinimumGoalReached | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
return weiRaised >= minimumFundingGoal;
| *
* @return true if the crowdsale has raised enough money to be a success |
71 | Crowdsale | isFinalizerSane | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
return finalizeAgent.isSane(token);
| *
* Check if the contract relationship looks good. |
71 | Crowdsale | getState | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
if (finalized) return State.Finalized;
else if (block.number < startsAt) return State.PreFunding;
else if (block.number <= endsAt && !ceilingStrategy.isCrowdsaleFull(weiRaised, weiFundingCap)) return State.Funding;
else if (isMinimumGoalReached()) return State.Success;
else if (!isMinimumGoalR... | *
* Crowdfund state machine management.
*
* This function has the timed transition builtin.
* So there is no chance of the variable being stale. |
71 | Crowdsale | setOwnerTestValue | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
ownerTestValue = val;
| * This is for manual testing of multisig wallet interaction |
71 | Crowdsale | isCrowdsale | contract Crowdsale is Haltable {
using SafeMath for uint;
/* The token we are selling */
CrowdsaleToken public token;
/* How we are going to price our offering */
PricingStrategy public pricingStrategy;
/* How we are going to limit our offering */
CeilingStrategy public ceilingStrategy;
... |
return true;
| * Interface marker. |
71 | PricingStrategy | isPricingStrategy | contract PricingStrategy {
/** Interface declaration. */
function isPricingStrategy() public constant returns (bool) {<FILL_FUNCTION_BODY>}
/**
* When somebody tries to buy tokens for X eth, calculate how many tokens they get.
*
*
* @param value - What is the value of the transaction sent i... |
return true;
| * Interface declaration. |
71 | FlatPricing | calculatePrice | contract FlatPricing is PricingStrategy {
using SafeMath for uint;
/* How many weis one token costs */
uint public oneTokenInWei;
function FlatPricing(uint _oneTokenInWei) {
oneTokenInWei = _oneTokenInWei;
}
/**
* Calculate the current price for buy in amount.
*
* @ param {ui... |
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(oneTokenInWei);
| *
* Calculate the current price for buy in amount.
*
* @ param {uint value} Buy-in value in wei.
* @ param
* @ param
* @ param
* @ param {uint decimals} The decimals used by the token representation (e.g. given by FractionalERC20). |
71 | CeilingStrategy | isCeilingStrategy | contract CeilingStrategy {
/** Interface declaration. */
function isCeilingStrategy() public constant returns (bool) {<FILL_FUNCTION_BODY>}
/**
* When somebody tries to buy tokens for X wei, calculate how many weis they are allowed to use.
*
*
* @param _value - What is the value of the tran... |
return true;
| * Interface declaration. |
71 | FixedCeiling | relaxFundingCap | contract FixedCeiling is CeilingStrategy {
using SafeMath for uint;
/* When relaxing a cap is necessary, we use this multiple to determine the relaxed cap */
uint public chunkedWeiMultiple;
/* The limit an individual address can invest */
uint public weiLimitPerAddress;
function FixedC... |
if (newCap > weiRaised) return newCap;
else return weiRaised.div(chunkedWeiMultiple).add(1).mul(chunkedWeiMultiple);
| If the new target cap has not been reached yet, it's fine as it is |
71 | BonusFinalizeAgent | isSane | contract BonusFinalizeAgent is FinalizeAgent {
using SafeMath for uint;
Crowdsale public crowdsale;
/** Total percent of tokens minted to the team at the end of the sale as base points
bonus tokens = tokensSold * bonusBasePoints * 0.0001 */
uint public bonusBasePoints;
/** Implementati... |
return token.mintAgents(address(this)) && token.releaseAgent() == address(this);
| Can we run finalize properly |
71 | BonusFinalizeAgent | finalizeCrowdsale | contract BonusFinalizeAgent is FinalizeAgent {
using SafeMath for uint;
Crowdsale public crowdsale;
/** Total percent of tokens minted to the team at the end of the sale as base points
bonus tokens = tokensSold * bonusBasePoints * 0.0001 */
uint public bonusBasePoints;
/** Implementati... |
require(msg.sender == address(crowdsale));
// How many % points of tokens the founders and others get
uint tokensSold = crowdsale.tokensSold();
uint saleBasePoints = basePointsDivisor.sub(bonusBasePoints);
allocatedBonus = tokensSold.mul(bonusBasePoints).div(saleBasePoints);
// Move t... | * Called once by crowdsale finalize() if the sale was a success. |
71 | HubiiCrowdsale | setStartingBlock | contract HubiiCrowdsale is Crowdsale {
uint private constant chunked_multiple = 18000 * (10 ** 18); // in wei
uint private constant limit_per_address = 100000 * (10 ** 18); // in wei
uint private constant hubii_minimum_funding = 17000 * (10 ** 18); // in wei
uint private constant token_initial_suppl... |
require(startingBlock > block.number && startingBlock < endsAt);
startsAt = startingBlock;
| These two setters are present only to correct block numbers if they are off from their target date by more than, say, a day |
72 | 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 transfer token for a specified address
* @param _to The ... |
return totalSupply_;
| *
* @dev total number of tokens in existence
* |
72 | 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_;
}
/**
* @dev transfer token for a specified address
* @param _to Th... |
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; //AUDIT// 返回值符合 EIP20 规范
| *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
72 | 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_;
}
/**
* @dev transfer token for a specified address
* @param _to Th... |
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. |
72 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _value ... |
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 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 |
72 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to
* @param _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
* race conditi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.