contract_name
stringlengths 1
61
| file_path
stringlengths 5
50.4k
| contract_address
stringlengths 42
42
| language
stringclasses 1
value | class_name
stringlengths 1
61
| class_code
stringlengths 4
330k
| class_documentation
stringlengths 0
29.1k
| class_documentation_type
stringclasses 6
values | func_name
stringlengths 0
62
| func_code
stringlengths 1
303k
| func_documentation
stringlengths 2
14.9k
| func_documentation_type
stringclasses 4
values | compiler_version
stringlengths 15
42
| license_type
stringclasses 14
values | swarm_source
stringlengths 0
71
| meta
dict | __index_level_0__
int64 0
60.4k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint256 | library SafeMathUint256 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint256
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
| /**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1263,
1422
]
} | 6,200 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
98,
334
]
} | 6,201 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
424,
573
]
} | 6,202 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
693,
851
]
} | 6,203 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
921,
1094
]
} | 6,204 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SafeMathUint8 | library SafeMathUint8 {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint8 a, uint8 b) internal pure returns (uint8 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "SafeMath: Multiplier exception");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint8 a, uint8 b) internal pure returns (uint8) {
return a / b; // Solidity automatically throws when dividing by 0
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint8 a, uint8 b) internal pure returns (uint8) {
require(b <= a, "SafeMath: Subtraction exception");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint8 a, uint8 b) internal pure returns (uint8 c) {
c = a + b;
require(c >= a, "SafeMath: Addition exception");
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
} | /**
* @title SafeMath for uint8
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mod | function mod(uint8 a, uint8 b) internal pure returns (uint8) {
require(b != 0, "SafeMath: Modulo exception");
return a % b;
}
| /**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1237,
1390
]
} | 6,205 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | BasicToken | contract BasicToken is ERC20Basic, Controllable {
using SafeMathUint256 for uint256;
mapping(address => uint256) balances;
uint256 public totalSupply;
constructor(uint256 _initialSupply) public
{
totalSupply = _initialSupply;
if (0 < _initialSupply) {
balances[msg.sender] = _initialSupply;
emit Transfer(address(0), msg.sender, _initialSupply);
}
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// 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 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.
*/
function balanceOf(address _owner) public view
returns (uint256 balance)
{
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// 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.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
609,
1196
]
} | 6,206 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | BasicToken | contract BasicToken is ERC20Basic, Controllable {
using SafeMathUint256 for uint256;
mapping(address => uint256) balances;
uint256 public totalSupply;
constructor(uint256 _initialSupply) public
{
totalSupply = _initialSupply;
if (0 < _initialSupply) {
balances[msg.sender] = _initialSupply;
emit Transfer(address(0), msg.sender, _initialSupply);
}
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "BasicToken.transfer: Zero value");
require(_value <= balances[msg.sender], "BasicToken.transfer: Insufficient fund");
// 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 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.
*/
function balanceOf(address _owner) public view
returns (uint256 balance)
{
return balances[_owner];
}
} | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view
returns (uint256 balance)
{
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.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1412,
1546
]
} | 6,207 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | StandardToken | 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 uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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 _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
408,
1155
]
} | 6,208 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | StandardToken | 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 uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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 _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1798,
2172
]
} | 6,209 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | StandardToken | 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 uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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 _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender) public view
returns (uint256)
{
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.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
2503,
2656
]
} | 6,210 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | StandardToken | 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 uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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 _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
3133,
3598
]
} | 6,211 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | StandardToken | 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 uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_from)
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StandardToken.transferFrom: Zero value");
require(_value <= balances[_from], "StandardToken.transferFrom: Insufficient fund");
require(_value <= allowed[_from][msg.sender], "StandardToken.transferFrom: Insufficient allowance");
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 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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _value, "StandardToken.approve: Zero value");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @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.
*/
function allowance(address _owner, address _spender) public view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @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 _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint256 _addedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _addedValue, "StandardToken.increaseApproval: Zero value");
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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 _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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;
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/ | NatSpecMultiLine | decreaseApproval | function decreaseApproval(address _spender, uint256 _subtractedValue) public
isUsable
onlyActive(msg.sender)
onlyActive(_spender)
returns (bool)
{
require(0 < _subtractedValue, "StandardToken.decreaseApproval: Zero value");
uint256 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
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
4080,
4710
]
} | 6,212 |
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | increaseSupply | function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
| /**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1204,
1596
]
} | 6,213 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | increaseSupplyWithDeposit | function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
| /**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
1850,
2475
]
} | 6,214 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | decreaseSupply | function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
| /**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
2690,
3372
]
} | 6,215 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freeze | function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
| /**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
3542,
4082
]
} | 6,216 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freezeWithPurpose | function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
| /**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
4315,
4528
]
} | 6,217 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | freezeWithPurposeCode | function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
| /**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
4770,
5339
]
} | 6,218 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreeze | function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
| /**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
5515,
6083
]
} | 6,219 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreezeWithPurpose | function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
| /**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
6323,
6559
]
} | 6,220 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | unfreezeWithPurposeCode | function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
| /**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
6808,
7398
]
} | 6,221 |
||
SUSD | SUSD.sol | 0xe8de351d8f949b2ffb8068a84a3bc8034874fd32 | Solidity | SUSD | contract SUSD is StandardToken {
using SafeMathUint256 for uint256;
bytes32 constant FREEZE_CODE_DEFAULT = 0x0000000000000000000000000000000000000000000000000000000000000000;
event Freeze(address indexed from, uint256 value);
event Unfreeze(address indexed from, uint256 value);
event FreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
event UnfreezeWithPurpose(address indexed from, uint256 value, bytes32 purpose);
string public name;
string public symbol;
uint8 public decimals;
// Keep track total frozen balances
mapping (address => uint256) public freezeOf;
// Keep track sub total frozen balances
mapping (address => mapping (bytes32 => uint256)) public freezes;
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _initialSupply) public
BasicToken(_initialSupply)
{
name = _name;
symbol = _symbol;
decimals = _decimals;
}
/**
* @dev Increase total supply (mint) to an address
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
*/
function increaseSupply(uint256 _value, address _to) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupply: Zero value");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
/**
* @dev Increase total supply (mint) to an address with deposit
*
* @param _value The amount of tokens to be mint
* @param _to The address which will receive token
* @param _deposit The amount of deposit
*/
function increaseSupplyWithDeposit(uint256 _value, address _to, uint256 _deposit) external
onlyOwner
onlyActive(_to)
returns (bool)
{
require(0 < _value, "StableCoin.increaseSupplyWithDeposit: Zero value");
require(_deposit <= _value, "StableCoin.increaseSupplyWithDeposit: Insufficient deposit");
totalSupply = totalSupply.add(_value);
balances[_to] = balances[_to].add(_value);
freezeWithPurposeCode(_to, _deposit, encodePacked("InitialDeposit"));
emit Transfer(address(0), _to, _value.sub(_deposit));
return true;
}
/**
* @dev Decrease total supply (burn) from an address that gave allowance
*
* @param _value The amount of tokens to be burn
* @param _from The address's token will be burn
*/
function decreaseSupply(uint256 _value, address _from) external
onlyOwner
onlyActive(_from)
returns (bool)
{
require(0 < _value, "StableCoin.decreaseSupply: Zero value");
require(_value <= balances[_from], "StableCoin.decreaseSupply: Insufficient fund");
require(_value <= allowed[_from][address(0)], "StableCoin.decreaseSupply: Insufficient allowance");
totalSupply = totalSupply.sub(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][address(0)] = allowed[_from][address(0)].sub(_value);
emit Transfer(_from, address(0), _value);
return true;
}
/**
* @dev Freeze holder balance
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
*/
function freeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freeze: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purpose The purpose of freeze
*/
function freezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
returns (bool)
{
return freezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Freeze holder balance with purpose code
*
* @param _from The address which will be freeze
* @param _value The amount of tokens to be freeze
* @param _purposeCode The purpose code of freeze
*/
function freezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= balances[_from], "StableCoin.freezeWithPurposeCode: Insufficient fund");
balances[_from] = balances[_from].sub(_value);
freezeOf[_from] = freezeOf[_from].add(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].add(_value);
emit Freeze(_from, _value);
emit FreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Unfreeze holder balance
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
*/
function unfreeze(address _from, uint256 _value) external
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][FREEZE_CODE_DEFAULT], "StableCoin.unfreeze: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][FREEZE_CODE_DEFAULT] = freezes[_from][FREEZE_CODE_DEFAULT].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, FREEZE_CODE_DEFAULT);
return true;
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purpose The purpose of unfreeze
*/
function unfreezeWithPurpose(address _from, uint256 _value, string calldata _purpose) external
onlyOwner
returns (bool)
{
return unfreezeWithPurposeCode(_from, _value, encodePacked(_purpose));
}
/**
* @dev Unfreeze holder balance with purpose code
*
* @param _from The address which will be unfreeze
* @param _value The amount of tokens to be unfreeze
* @param _purposeCode The purpose code of unfreeze
*/
function unfreezeWithPurposeCode(address _from, uint256 _value, bytes32 _purposeCode) public
onlyOwner
returns (bool)
{
require(_value <= freezes[_from][_purposeCode], "StableCoin.unfreezeWithPurposeCode: Insufficient fund");
freezeOf[_from] = freezeOf[_from].sub(_value);
freezes[_from][_purposeCode] = freezes[_from][_purposeCode].sub(_value);
balances[_from] = balances[_from].add(_value);
emit Unfreeze(_from, _value);
emit UnfreezeWithPurpose(_from, _value, _purposeCode);
return true;
}
/**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
function encodePacked(string memory s) internal pure
returns (bytes32)
{
return keccak256(abi.encodePacked(s));
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData) external
isUsable
returns (bool)
{
// Give allowance to spender (previous approved allowances will be clear)
approve(_spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
| /**
* @dev Allocate allowance and perform contract call
*
* @param _spender The spender address
* @param _value The allowance value
* @param _extraData The function call data
*/ | NatSpecMultiLine | v0.5.0+commit.1d4f565a | None | bzzr://711a6677176af3f67d1ddbd90362b841cc9a7f5dbd889313f751386a79a83e52 | {
"func_code_index": [
7620,
8017
]
} | 6,222 |
||
FREXATestToken2 | Ownable.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | 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 {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | Ownable | function Ownable() public {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
250,
307
]
} | 6,223 |
FREXATestToken2 | Ownable.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | 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 {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
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.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
613,
789
]
} | 6,224 |
VolOracle | contracts/libraries/Welford.sol | 0x4df938e57fd4ad1dfdddeeb1b4cfabab19e33a0e | Solidity | Welford | library Welford {
using SignedSafeMath for int256;
/**
* @notice Performs an update of the tuple (count, mean, m2) using the new value
* @param curCount is the current value for count
* @param curMean is the current value for mean
* @param curM2 is the current value for M2
* @param newValue is the new value to be added into the dataset
*/
function update(
uint256 curCount,
int256 curMean,
uint256 curM2,
int256 newValue
)
internal
pure
returns (
uint256 count,
int256 mean,
uint256 m2
)
{
int256 _count = int256(curCount + 1);
int256 delta = newValue.sub(int256(curMean));
int256 _mean = int256(curMean).add(delta.div(_count));
int256 delta2 = newValue.sub(_mean);
int256 _m2 = int256(curM2).add(delta.mul(delta2));
require(_count > 0, "count<=0");
require(_m2 >= 0, "m2<0");
count = uint256(_count);
mean = _mean;
m2 = uint256(_m2);
}
/**
* @notice Calculate the variance using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function variance(uint256 count, uint256 m2)
internal
pure
returns (uint256)
{
require(count > 0, "!count");
return m2 / count;
}
/**
* @notice Calculate the standard deviation using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function stdev(uint256 count, uint256 m2) internal pure returns (uint256) {
return Math.sqrt(variance(count, m2));
}
} | // REFERENCE
// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm | LineComment | update | function update(
uint256 curCount,
int256 curMean,
uint256 curM2,
int256 newValue
)
internal
pure
returns (
uint256 count,
int256 mean,
uint256 m2
)
{
int256 _count = int256(curCount + 1);
int256 delta = newValue.sub(int256(curMean));
int256 _mean = int256(curMean).add(delta.div(_count));
int256 delta2 = newValue.sub(_mean);
int256 _m2 = int256(curM2).add(delta.mul(delta2));
require(_count > 0, "count<=0");
require(_m2 >= 0, "m2<0");
count = uint256(_count);
mean = _mean;
m2 = uint256(_m2);
}
| /**
* @notice Performs an update of the tuple (count, mean, m2) using the new value
* @param curCount is the current value for count
* @param curMean is the current value for mean
* @param curM2 is the current value for M2
* @param newValue is the new value to be added into the dataset
*/ | NatSpecMultiLine | v0.7.3+commit.9bfce1f6 | {
"func_code_index": [
380,
1075
]
} | 6,225 |
||
VolOracle | contracts/libraries/Welford.sol | 0x4df938e57fd4ad1dfdddeeb1b4cfabab19e33a0e | Solidity | Welford | library Welford {
using SignedSafeMath for int256;
/**
* @notice Performs an update of the tuple (count, mean, m2) using the new value
* @param curCount is the current value for count
* @param curMean is the current value for mean
* @param curM2 is the current value for M2
* @param newValue is the new value to be added into the dataset
*/
function update(
uint256 curCount,
int256 curMean,
uint256 curM2,
int256 newValue
)
internal
pure
returns (
uint256 count,
int256 mean,
uint256 m2
)
{
int256 _count = int256(curCount + 1);
int256 delta = newValue.sub(int256(curMean));
int256 _mean = int256(curMean).add(delta.div(_count));
int256 delta2 = newValue.sub(_mean);
int256 _m2 = int256(curM2).add(delta.mul(delta2));
require(_count > 0, "count<=0");
require(_m2 >= 0, "m2<0");
count = uint256(_count);
mean = _mean;
m2 = uint256(_m2);
}
/**
* @notice Calculate the variance using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function variance(uint256 count, uint256 m2)
internal
pure
returns (uint256)
{
require(count > 0, "!count");
return m2 / count;
}
/**
* @notice Calculate the standard deviation using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function stdev(uint256 count, uint256 m2) internal pure returns (uint256) {
return Math.sqrt(variance(count, m2));
}
} | // REFERENCE
// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm | LineComment | variance | function variance(uint256 count, uint256 m2)
internal
pure
returns (uint256)
{
require(count > 0, "!count");
return m2 / count;
}
| /**
* @notice Calculate the variance using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/ | NatSpecMultiLine | v0.7.3+commit.9bfce1f6 | {
"func_code_index": [
1268,
1449
]
} | 6,226 |
||
VolOracle | contracts/libraries/Welford.sol | 0x4df938e57fd4ad1dfdddeeb1b4cfabab19e33a0e | Solidity | Welford | library Welford {
using SignedSafeMath for int256;
/**
* @notice Performs an update of the tuple (count, mean, m2) using the new value
* @param curCount is the current value for count
* @param curMean is the current value for mean
* @param curM2 is the current value for M2
* @param newValue is the new value to be added into the dataset
*/
function update(
uint256 curCount,
int256 curMean,
uint256 curM2,
int256 newValue
)
internal
pure
returns (
uint256 count,
int256 mean,
uint256 m2
)
{
int256 _count = int256(curCount + 1);
int256 delta = newValue.sub(int256(curMean));
int256 _mean = int256(curMean).add(delta.div(_count));
int256 delta2 = newValue.sub(_mean);
int256 _m2 = int256(curM2).add(delta.mul(delta2));
require(_count > 0, "count<=0");
require(_m2 >= 0, "m2<0");
count = uint256(_count);
mean = _mean;
m2 = uint256(_m2);
}
/**
* @notice Calculate the variance using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function variance(uint256 count, uint256 m2)
internal
pure
returns (uint256)
{
require(count > 0, "!count");
return m2 / count;
}
/**
* @notice Calculate the standard deviation using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/
function stdev(uint256 count, uint256 m2) internal pure returns (uint256) {
return Math.sqrt(variance(count, m2));
}
} | // REFERENCE
// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm | LineComment | stdev | function stdev(uint256 count, uint256 m2) internal pure returns (uint256) {
return Math.sqrt(variance(count, m2));
}
| /**
* @notice Calculate the standard deviation using the existing tuple (count, mean, m2)
* @param count is the length of the dataset
* @param m2 is the sum of square errors
*/ | NatSpecMultiLine | v0.7.3+commit.9bfce1f6 | {
"func_code_index": [
1652,
1784
]
} | 6,227 |
||
GasCrowdsale | GasCrowdsale.sol | 0xa54a1b3a6203cef877b759b64c6d205421e9f86c | Solidity | GasCrowdsale | contract GasCrowdsale {
using SafeMath for uint256;
address public beneficiary;
uint256 public fundingGoal;
uint256 public amountRaised;
uint256 public startdate;
uint256 public deadline;
uint256 public price;
uint256 public fundTransferred;
token public tokenReward;
mapping(address => uint256) public balanceOf;
bool fundingGoalReached = false;
bool crowdsaleClosed = false;
//event GoalReached(address recipient, uint256 totalAmountRaised);
//event FundTransfer(address backer, uint256 amount, bool isContribution);
/**
* Constrctor function
*
* Setup the owner
*/
function GasCrowdsale() {
beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81;
fundingGoal = 8000 ether;
startdate = 1518134400;
deadline = startdate + 29 days;
price = 0.0003 ether;
tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7);
}
/**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/
function () payable {
require(!crowdsaleClosed);
uint256 bonus;
uint256 amount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
//add bounus for funders
if(now >= startdate && now <= startdate + 24 hours ){
amount = amount.div(price);
bonus = amount.mul(30).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours && now <= startdate + 24 hours + 1 weeks ){
amount = amount.div(price);
bonus = amount.mul(20).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours + 1 weeks && now <= startdate + 24 hours + 3 weeks ){
amount = amount.div(price);
bonus = amount.mul(10).div(100);
amount = amount.add(bonus);
} else {
amount = amount.div(price);
}
amount = amount.mul(100000000);
tokenReward.transfer(msg.sender, amount);
//FundTransfer(msg.sender, amount, true);
}
modifier afterDeadline() { if (now >= deadline) _; }
/**
*ends the campaign after deadline
*/
function endCrowdsale() afterDeadline {
crowdsaleClosed = true;
}
/**
* Withdraw the funds
*/
function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
}
} | GasCrowdsale | function GasCrowdsale() {
beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81;
fundingGoal = 8000 ether;
startdate = 1518134400;
deadline = startdate + 29 days;
price = 0.0003 ether;
tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7);
}
| /**
* Constrctor function
*
* Setup the owner
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://937858ff8fc5d8ea4d04d4b76dca8d93b183c98bea4f5a3b9880dafe95e140d1 | {
"func_code_index": [
678,
996
]
} | 6,228 |
|||
GasCrowdsale | GasCrowdsale.sol | 0xa54a1b3a6203cef877b759b64c6d205421e9f86c | Solidity | GasCrowdsale | contract GasCrowdsale {
using SafeMath for uint256;
address public beneficiary;
uint256 public fundingGoal;
uint256 public amountRaised;
uint256 public startdate;
uint256 public deadline;
uint256 public price;
uint256 public fundTransferred;
token public tokenReward;
mapping(address => uint256) public balanceOf;
bool fundingGoalReached = false;
bool crowdsaleClosed = false;
//event GoalReached(address recipient, uint256 totalAmountRaised);
//event FundTransfer(address backer, uint256 amount, bool isContribution);
/**
* Constrctor function
*
* Setup the owner
*/
function GasCrowdsale() {
beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81;
fundingGoal = 8000 ether;
startdate = 1518134400;
deadline = startdate + 29 days;
price = 0.0003 ether;
tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7);
}
/**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/
function () payable {
require(!crowdsaleClosed);
uint256 bonus;
uint256 amount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
//add bounus for funders
if(now >= startdate && now <= startdate + 24 hours ){
amount = amount.div(price);
bonus = amount.mul(30).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours && now <= startdate + 24 hours + 1 weeks ){
amount = amount.div(price);
bonus = amount.mul(20).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours + 1 weeks && now <= startdate + 24 hours + 3 weeks ){
amount = amount.div(price);
bonus = amount.mul(10).div(100);
amount = amount.add(bonus);
} else {
amount = amount.div(price);
}
amount = amount.mul(100000000);
tokenReward.transfer(msg.sender, amount);
//FundTransfer(msg.sender, amount, true);
}
modifier afterDeadline() { if (now >= deadline) _; }
/**
*ends the campaign after deadline
*/
function endCrowdsale() afterDeadline {
crowdsaleClosed = true;
}
/**
* Withdraw the funds
*/
function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
}
} | function () payable {
require(!crowdsaleClosed);
uint256 bonus;
uint256 amount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
//add bounus for funders
if(now >= startdate && now <= startdate + 24 hours ){
amount = amount.div(price);
bonus = amount.mul(30).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours && now <= startdate + 24 hours + 1 weeks ){
amount = amount.div(price);
bonus = amount.mul(20).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours + 1 weeks && now <= startdate + 24 hours + 3 weeks ){
amount = amount.div(price);
bonus = amount.mul(10).div(100);
amount = amount.add(bonus);
} else {
amount = amount.div(price);
}
amount = amount.mul(100000000);
tokenReward.transfer(msg.sender, amount);
//FundTransfer(msg.sender, amount, true);
}
| /**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://937858ff8fc5d8ea4d04d4b76dca8d93b183c98bea4f5a3b9880dafe95e140d1 | {
"func_code_index": [
1166,
2340
]
} | 6,229 |
||||
GasCrowdsale | GasCrowdsale.sol | 0xa54a1b3a6203cef877b759b64c6d205421e9f86c | Solidity | GasCrowdsale | contract GasCrowdsale {
using SafeMath for uint256;
address public beneficiary;
uint256 public fundingGoal;
uint256 public amountRaised;
uint256 public startdate;
uint256 public deadline;
uint256 public price;
uint256 public fundTransferred;
token public tokenReward;
mapping(address => uint256) public balanceOf;
bool fundingGoalReached = false;
bool crowdsaleClosed = false;
//event GoalReached(address recipient, uint256 totalAmountRaised);
//event FundTransfer(address backer, uint256 amount, bool isContribution);
/**
* Constrctor function
*
* Setup the owner
*/
function GasCrowdsale() {
beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81;
fundingGoal = 8000 ether;
startdate = 1518134400;
deadline = startdate + 29 days;
price = 0.0003 ether;
tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7);
}
/**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/
function () payable {
require(!crowdsaleClosed);
uint256 bonus;
uint256 amount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
//add bounus for funders
if(now >= startdate && now <= startdate + 24 hours ){
amount = amount.div(price);
bonus = amount.mul(30).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours && now <= startdate + 24 hours + 1 weeks ){
amount = amount.div(price);
bonus = amount.mul(20).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours + 1 weeks && now <= startdate + 24 hours + 3 weeks ){
amount = amount.div(price);
bonus = amount.mul(10).div(100);
amount = amount.add(bonus);
} else {
amount = amount.div(price);
}
amount = amount.mul(100000000);
tokenReward.transfer(msg.sender, amount);
//FundTransfer(msg.sender, amount, true);
}
modifier afterDeadline() { if (now >= deadline) _; }
/**
*ends the campaign after deadline
*/
function endCrowdsale() afterDeadline {
crowdsaleClosed = true;
}
/**
* Withdraw the funds
*/
function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
}
} | endCrowdsale | function endCrowdsale() afterDeadline {
crowdsaleClosed = true;
}
| /**
*ends the campaign after deadline
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://937858ff8fc5d8ea4d04d4b76dca8d93b183c98bea4f5a3b9880dafe95e140d1 | {
"func_code_index": [
2468,
2552
]
} | 6,230 |
|||
GasCrowdsale | GasCrowdsale.sol | 0xa54a1b3a6203cef877b759b64c6d205421e9f86c | Solidity | GasCrowdsale | contract GasCrowdsale {
using SafeMath for uint256;
address public beneficiary;
uint256 public fundingGoal;
uint256 public amountRaised;
uint256 public startdate;
uint256 public deadline;
uint256 public price;
uint256 public fundTransferred;
token public tokenReward;
mapping(address => uint256) public balanceOf;
bool fundingGoalReached = false;
bool crowdsaleClosed = false;
//event GoalReached(address recipient, uint256 totalAmountRaised);
//event FundTransfer(address backer, uint256 amount, bool isContribution);
/**
* Constrctor function
*
* Setup the owner
*/
function GasCrowdsale() {
beneficiary = 0x007FB3e94dCd7C441CAA5b87621F275d199Dff81;
fundingGoal = 8000 ether;
startdate = 1518134400;
deadline = startdate + 29 days;
price = 0.0003 ether;
tokenReward = token(0x75c79b88facE8892E7043797570c390bc2Db52A7);
}
/**
* Fallback function
*
* The function without name is the default function that is called whenever anyone sends funds to a contract
*/
function () payable {
require(!crowdsaleClosed);
uint256 bonus;
uint256 amount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
//add bounus for funders
if(now >= startdate && now <= startdate + 24 hours ){
amount = amount.div(price);
bonus = amount.mul(30).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours && now <= startdate + 24 hours + 1 weeks ){
amount = amount.div(price);
bonus = amount.mul(20).div(100);
amount = amount.add(bonus);
}
else if(now > startdate + 24 hours + 1 weeks && now <= startdate + 24 hours + 3 weeks ){
amount = amount.div(price);
bonus = amount.mul(10).div(100);
amount = amount.add(bonus);
} else {
amount = amount.div(price);
}
amount = amount.mul(100000000);
tokenReward.transfer(msg.sender, amount);
//FundTransfer(msg.sender, amount, true);
}
modifier afterDeadline() { if (now >= deadline) _; }
/**
*ends the campaign after deadline
*/
function endCrowdsale() afterDeadline {
crowdsaleClosed = true;
}
/**
* Withdraw the funds
*/
function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
}
} | safeWithdrawal | function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
}
| /**
* Withdraw the funds
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://937858ff8fc5d8ea4d04d4b76dca8d93b183c98bea4f5a3b9880dafe95e140d1 | {
"func_code_index": [
2602,
2981
]
} | 6,231 |
|||
FourthBountyWPTpayoutCorrection | FourthBountyWPTpayoutCorrection.sol | 0x36c6a8126c64b74923a202ffa20dc9fb84afb587 | Solidity | FourthBountyWPTpayoutCorrection | contract FourthBountyWPTpayoutCorrection {
//storage
address public owner;
Token public company_token;
address[] public addressOfBountyMembers;
mapping(address => uint256) bountyMembersAmounts;
uint currentBatch;
uint addrPerStep;
//modifiers
modifier onlyOwner
{
require(owner == msg.sender);
_;
}
//Events
event Transfer(address indexed to, uint indexed value);
event OwnerChanged(address indexed owner);
//constructor
constructor (Token _company_token) public {
owner = msg.sender;
company_token = _company_token;
currentBatch = 0;
addrPerStep = 25;
setBountyAddresses();
setBountyAmounts();
}
/// @dev Fallback function: don't accept ETH
function()
public
payable
{
revert();
}
function setCountPerStep(uint _newValue) public onlyOwner {
addrPerStep = _newValue;
}
function setOwner(address _owner)
public
onlyOwner
{
require(_owner != 0);
owner = _owner;
emit OwnerChanged(owner);
}
function makePayout() public onlyOwner {
uint startIndex = currentBatch * addrPerStep;
uint endIndex = (currentBatch + 1 ) * addrPerStep;
for (uint i = startIndex; (i < endIndex && i < addressOfBountyMembers.length); i++)
{
company_token.mint(addressOfBountyMembers[i], bountyMembersAmounts[addressOfBountyMembers[i]]);
}
currentBatch++;
}
function setBountyAddresses() internal {
addressOfBountyMembers.push(0x00acB4E06Eb8F7ABcFfc1EC6384227cb206b5bd0);
addressOfBountyMembers.push(0x07f964aBfC00f9571B392d78D0E8D0a303f527E9);
addressOfBountyMembers.push(0x09e9811B51642049700D0900b5E5F909D6EaA978);
addressOfBountyMembers.push(0x17303918fF12fD503961EBa5db01848De658729d);
addressOfBountyMembers.push(0x17DEcde632980aB7a8FFC1bA698Da3b7719427E9);
addressOfBountyMembers.push(0x1981d82819C4d1acD3447ecbBaf7660c88a92F0F);
addressOfBountyMembers.push(0x1af50bD294BbDd99d6ac0e5CB1c067BfC7818CF3);
addressOfBountyMembers.push(0x1C2C923A8168b607276b422eC05bB101b5579b41);
addressOfBountyMembers.push(0x230a23A0756e7CC528021d2e4EFF54DCA2101427);
addressOfBountyMembers.push(0x239993c2d7F16a6F68bbbF398885ef92ec75C888);
addressOfBountyMembers.push(0x239F3F8f4f5BA293EE9e38308053FCaa43b37bC6);
addressOfBountyMembers.push(0x27561111Bb09D76368343a9c85339Db43D28Fc7D);
addressOfBountyMembers.push(0x2B61F3BcD23D37d962A707e231bF3C53d1E9cDA7);
addressOfBountyMembers.push(0x2ca0b69fc3f6d4286F70a3eEC55beF25c1018544);
addressOfBountyMembers.push(0x2e9f5bfb07067df44f31519a80799884431876e1);
addressOfBountyMembers.push(0x3077D925F4399514a3349b6e812e290CBD0a2154);
addressOfBountyMembers.push(0x309c76d1aD3d58D6eB77Ba6b573e0A5efA1d3323);
addressOfBountyMembers.push(0x34596458488dba489e4b56ddab91061c4850d29b);
addressOfBountyMembers.push(0x3AE92BC56A517cC7d378FF0e0714479A33C3a7BA);
addressOfBountyMembers.push(0x3D4Af5b6C97e16624981DB89300d3b32Be62f727);
addressOfBountyMembers.push(0x3ee870e86693703996e441f986caaac31d7a5181);
addressOfBountyMembers.push(0x42B4813d89c65683c8671Eccc5De1F9c3A122140);
addressOfBountyMembers.push(0x43D9dD1950a78a21c6E615ad7A739eCAbB2F6F23);
addressOfBountyMembers.push(0x45334470D78f87E2b6097Ef520cC949ef5d7573F);
addressOfBountyMembers.push(0x460BAA28e768d0C9D1BFc885ad91B253C3373048);
addressOfBountyMembers.push(0x4F2dED30C27C4A7926B34c697Edd726aE379c3cE);
addressOfBountyMembers.push(0x56ACb598e1B89CD6Ca7b10C214B9108C543B385e);
addressOfBountyMembers.push(0x5826fe6d87Bc3088EEaAA8687f8d3e4416e146E8);
addressOfBountyMembers.push(0x5843787775CF8320C79f9dd60Be228aB0FF51123);
addressOfBountyMembers.push(0x59C5c4b795E9DB078c74BAcC0Fcad5cee75D1050);
addressOfBountyMembers.push(0x5B3fE56B7cfC456A5E721Df4b2d4A6b7ce7e4710);
addressOfBountyMembers.push(0x5c50564cEEEb5B85CFeeC31572A748cC1185356c);
addressOfBountyMembers.push(0x60cf7c40148370579133Fcf4e2bAe9Deec18ffb2);
addressOfBountyMembers.push(0x6169852ed50B5E59E998279109dACF0882414A59);
addressOfBountyMembers.push(0x63515D455393dDc5F8F321dd084d1bd000545573);
addressOfBountyMembers.push(0x6e414d17eE6A80f9fAc326a0b79364Bde6Ae0B9f);
addressOfBountyMembers.push(0x6e9c261D10575c87fE8724c54ccD26e59F77101a);
addressOfBountyMembers.push(0x6ed8eb597f47079e03c5913f8a010c7dec4e9185);
addressOfBountyMembers.push(0x70141ba86851D8A611fA79718D088bbfE39C9954);
addressOfBountyMembers.push(0x73274282F25E91D0D1724e09e9fF9bd250e3377A);
addressOfBountyMembers.push(0x74Ee49Cd610553D3e7f83bEe1873020ae1ddB469);
addressOfBountyMembers.push(0x780e64F06c13525CD4F09d069622D95d4E82D66E);
addressOfBountyMembers.push(0x7A3c9Eb1F276d08A326962b1582008d057b51932);
addressOfBountyMembers.push(0x8025CE2efE37e68b1496Cb08A2Cc49Db36E57eCd);
addressOfBountyMembers.push(0x834997EEAD7B42445fc7A8e8c2139C8263e74b4E);
addressOfBountyMembers.push(0x8617A519B2AD3e45a667B1773c16D7e1c6f06b39);
addressOfBountyMembers.push(0x8965C5Db7f9BD3ffd1084aF569843bBbBE54fB4e);
addressOfBountyMembers.push(0x8bDcdbA236161FEf354b854dCCcbD462e6C1e634);
addressOfBountyMembers.push(0x8DBCbb91d0955DE114A99E801bC70C86DFC68016);
addressOfBountyMembers.push(0x8e65028a1b1f35bcfff35f97cb59c272a48012cf);
addressOfBountyMembers.push(0x8F0BC0B7c6bA6b7058760a11Ced07a1990a8ebCA);
addressOfBountyMembers.push(0x8f6f9a2BA2130989F51D08138bfb72c4bfe873bd);
addressOfBountyMembers.push(0x9278dc8aee744C7356cE19b7E7c7386183d38Be7);
addressOfBountyMembers.push(0x928Fb44829B702Dcc0092839d6e0E45af0EA9BD6);
addressOfBountyMembers.push(0x94c30dBB7EA6df4FCAd8c8864Edfc9c59cB8Db14);
addressOfBountyMembers.push(0x9725274C250ba4A1294ee21710ACF963d46FD65F);
addressOfBountyMembers.push(0x98219CF8479cE2D8529d5D0F4d78784fc5dbcAfe);
addressOfBountyMembers.push(0x9a8e2538f8270d252db6e759e297f5f3646188e5);
addressOfBountyMembers.push(0x9b1a9dc875C4c94C80C66acb8eaaD86d1c11EB9f);
addressOfBountyMembers.push(0xac39e59F403Fb4d7A02dd6E7251481fa17f37518);
addressOfBountyMembers.push(0xac4c9c0d2931Fa5e29Baafbcaf4e5dB1cE8A1758);
addressOfBountyMembers.push(0xAEbC205C50399a7EDf248f17e188E3EcB6a4911a);
addressOfBountyMembers.push(0xB0f07308B6bd41Ac47B756dB61eEBaeF57ae8CCC);
addressOfBountyMembers.push(0xB41CDf4Dc95870B4A662cB6b8A51B8AABcb16F58);
addressOfBountyMembers.push(0xb5752D9e772411B2C1D449F5C38B2Be703181281);
addressOfBountyMembers.push(0xB73F5d6fED57ef3b6A624c918882010B38d6FeF5);
addressOfBountyMembers.push(0xB7f6584D898Efa6487Df14bE91abe871f9bf3038);
addressOfBountyMembers.push(0xb95da9acee36B95A8f8748c378f3aF39b8AE7087);
addressOfBountyMembers.push(0xbB829cD884c75c2539A0A7Baa5574a4CE0658426);
addressOfBountyMembers.push(0xBeE6E6B078b48ba5AAcb98D7f57Dd78496Af38dF);
addressOfBountyMembers.push(0xC0f321feed4B3ccAD81E4ECB8b5589d0baeBF710);
addressOfBountyMembers.push(0xC158394aF351906e21Dc78d8a840ce8e2AF2F827);
addressOfBountyMembers.push(0xC1945c4872062CD0Dc7c59D5744C276d09a59a99);
addressOfBountyMembers.push(0xc1ee59265efa7d13f8592cddae514a5be4cdf4a8);
addressOfBountyMembers.push(0xc53167E7dFB4E98a98c193627C622680F6291ab5);
addressOfBountyMembers.push(0xCe241cb7ac5Aa67fd679EFffFF815E8A818B9319);
addressOfBountyMembers.push(0xcec52F799C80D75D4cEA2e281DA884c4129C67aA);
addressOfBountyMembers.push(0xd193466c05aae45f1C341447e8ee95BdBEa8297e);
addressOfBountyMembers.push(0xD382c8F5CFdfD9fd0246B1B6b4eb57249A567a74);
addressOfBountyMembers.push(0xD3E86478bF653C77f83737d831d1003ed447958c);
addressOfBountyMembers.push(0xD52c8572c1b7d831F4438d93DEF4b153bd221a79);
addressOfBountyMembers.push(0xD54C589E166D8A75374E985A580C00cA7936C7Be);
addressOfBountyMembers.push(0xD748a3fE50368D47163b3b1fDa780798970d99C1);
addressOfBountyMembers.push(0xd8A321513f1fdf6EE58f599159f3C2ea80349243);
addressOfBountyMembers.push(0xE26BDb9e61070b5d0816b1F027eB2D105B675093);
addressOfBountyMembers.push(0xe50817e5b1b36df3c9ad896a7548dce7ab52f6b3);
addressOfBountyMembers.push(0xe67464a674666e39E3EdB461549d4b91Ee430593);
addressOfBountyMembers.push(0xeA46A6BEb7CdA737dc49204424406cE6046297a6);
addressOfBountyMembers.push(0xecB40E29C0Ce2108305890BBdD6082D47a9Ddb5F);
addressOfBountyMembers.push(0xecdd6b136b186c0e59a159504eb6afbc8ab03fed);
addressOfBountyMembers.push(0xeEB9b9B40CCD80Fa3cCa2F2E3158482671f4D425);
addressOfBountyMembers.push(0xf22ca30049b37dc1b6650600549b0cd2bf5f3c64);
addressOfBountyMembers.push(0xf2418654Dd2e239EcBCF00aA2BC18aD8AF9bad52);
addressOfBountyMembers.push(0xf3415a0b9D0D1Ed2e666a07E090BE60957751832);
addressOfBountyMembers.push(0xF37bD5c2908ba069940a190b048E90696A91d89b);
}
function setBountyAmounts() internal {
bountyMembersAmounts[0x00acB4E06Eb8F7ABcFfc1EC6384227cb206b5bd0] = 876950000000000000000;
bountyMembersAmounts[0x07f964aBfC00f9571B392d78D0E8D0a303f527E9] = 1072000000000000000000;
bountyMembersAmounts[0x09e9811B51642049700D0900b5E5F909D6EaA978] = 206000000000000000000;
bountyMembersAmounts[0x17303918fF12fD503961EBa5db01848De658729d] = 2000000000000000000;
bountyMembersAmounts[0x17DEcde632980aB7a8FFC1bA698Da3b7719427E9] = 118000000000000000000;
bountyMembersAmounts[0x1981d82819C4d1acD3447ecbBaf7660c88a92F0F] = 137000000000000000000;
bountyMembersAmounts[0x1af50bD294BbDd99d6ac0e5CB1c067BfC7818CF3] = 31000000000000000000;
bountyMembersAmounts[0x1C2C923A8168b607276b422eC05bB101b5579b41] = 52000000000000000000;
bountyMembersAmounts[0x230a23A0756e7CC528021d2e4EFF54DCA2101427] = 605000000000000000000;
bountyMembersAmounts[0x239993c2d7F16a6F68bbbF398885ef92ec75C888] = 18000000000000000000;
bountyMembersAmounts[0x239F3F8f4f5BA293EE9e38308053FCaa43b37bC6] = 24000000000000000000;
bountyMembersAmounts[0x27561111Bb09D76368343a9c85339Db43D28Fc7D] = 52000000000000000000;
bountyMembersAmounts[0x2B61F3BcD23D37d962A707e231bF3C53d1E9cDA7] = 152000000000000000000;
bountyMembersAmounts[0x2ca0b69fc3f6d4286F70a3eEC55beF25c1018544] = 764000000000000000000;
bountyMembersAmounts[0x2e9f5bfb07067df44f31519a80799884431876e1] = 21000000000000000000;
bountyMembersAmounts[0x3077D925F4399514a3349b6e812e290CBD0a2154] = 283000000000000000000;
bountyMembersAmounts[0x309c76d1aD3d58D6eB77Ba6b573e0A5efA1d3323] = 18000000000000000000;
bountyMembersAmounts[0x34596458488dba489e4b56ddab91061c4850d29b] = 31000000000000000000;
bountyMembersAmounts[0x3AE92BC56A517cC7d378FF0e0714479A33C3a7BA] = 4279000000000000000000;
bountyMembersAmounts[0x3D4Af5b6C97e16624981DB89300d3b32Be62f727] = 381000000000000000000;
bountyMembersAmounts[0x3ee870e86693703996e441f986caaac31d7a5181] = 170000000000000000000;
bountyMembersAmounts[0x42B4813d89c65683c8671Eccc5De1F9c3A122140] = 11000000000000000000;
bountyMembersAmounts[0x43D9dD1950a78a21c6E615ad7A739eCAbB2F6F23] = 1293000000000000000000;
bountyMembersAmounts[0x45334470D78f87E2b6097Ef520cC949ef5d7573F] = 96000000000000000000;
bountyMembersAmounts[0x460BAA28e768d0C9D1BFc885ad91B253C3373048] = 2651000000000000000000;
bountyMembersAmounts[0x4F2dED30C27C4A7926B34c697Edd726aE379c3cE] = 47000000000000000000;
bountyMembersAmounts[0x56ACb598e1B89CD6Ca7b10C214B9108C543B385e] = 40296000000000000000000;
bountyMembersAmounts[0x5826fe6d87Bc3088EEaAA8687f8d3e4416e146E8] = 16000000000000000000;
bountyMembersAmounts[0x5843787775CF8320C79f9dd60Be228aB0FF51123] = 35000000000000000000;
bountyMembersAmounts[0x59C5c4b795E9DB078c74BAcC0Fcad5cee75D1050] = 15000000000000000000;
bountyMembersAmounts[0x5B3fE56B7cfC456A5E721Df4b2d4A6b7ce7e4710] = 5000000000000000000;
bountyMembersAmounts[0x5c50564cEEEb5B85CFeeC31572A748cC1185356c] = 22000000000000000000;
bountyMembersAmounts[0x60cf7c40148370579133Fcf4e2bAe9Deec18ffb2] = 72000000000000000000;
bountyMembersAmounts[0x6169852ed50B5E59E998279109dACF0882414A59] = 16000000000000000000;
bountyMembersAmounts[0x63515D455393dDc5F8F321dd084d1bd000545573] = 96000000000000000000;
bountyMembersAmounts[0x6e414d17eE6A80f9fAc326a0b79364Bde6Ae0B9f] = 458000000000000000000;
bountyMembersAmounts[0x6e9c261D10575c87fE8724c54ccD26e59F77101a] = 422000000000000000000;
bountyMembersAmounts[0x6ed8eb597f47079e03c5913f8a010c7dec4e9185] = 12000000000000000000;
bountyMembersAmounts[0x70141ba86851D8A611fA79718D088bbfE39C9954] = 24000000000000000000;
bountyMembersAmounts[0x73274282F25E91D0D1724e09e9fF9bd250e3377A] = 137000000000000000000;
bountyMembersAmounts[0x74Ee49Cd610553D3e7f83bEe1873020ae1ddB469] = 51000000000000000000;
bountyMembersAmounts[0x780e64F06c13525CD4F09d069622D95d4E82D66E] = 42000000000000000000;
bountyMembersAmounts[0x7A3c9Eb1F276d08A326962b1582008d057b51932] = 179000000000000000000;
bountyMembersAmounts[0x8025CE2efE37e68b1496Cb08A2Cc49Db36E57eCd] = 702000000000000000000;
bountyMembersAmounts[0x834997EEAD7B42445fc7A8e8c2139C8263e74b4E] = 74000000000000000000;
bountyMembersAmounts[0x8617A519B2AD3e45a667B1773c16D7e1c6f06b39] = 1764000000000000000000;
bountyMembersAmounts[0x8965C5Db7f9BD3ffd1084aF569843bBbBE54fB4e] = 1280000000000000000000;
bountyMembersAmounts[0x8bDcdbA236161FEf354b854dCCcbD462e6C1e634] = 898000000000000000000;
bountyMembersAmounts[0x8DBCbb91d0955DE114A99E801bC70C86DFC68016] = 60000000000000000000;
bountyMembersAmounts[0x8e65028a1b1f35bcfff35f97cb59c272a48012cf] = 35174326000000000000000;
bountyMembersAmounts[0x8F0BC0B7c6bA6b7058760a11Ced07a1990a8ebCA] = 504000000000000000000;
bountyMembersAmounts[0x8f6f9a2BA2130989F51D08138bfb72c4bfe873bd] = 89000000000000000000;
bountyMembersAmounts[0x9278dc8aee744C7356cE19b7E7c7386183d38Be7] = 114000000000000000000;
bountyMembersAmounts[0x928Fb44829B702Dcc0092839d6e0E45af0EA9BD6] = 995000000000000000000;
bountyMembersAmounts[0x94c30dBB7EA6df4FCAd8c8864Edfc9c59cB8Db14] = 9000000000000000000;
bountyMembersAmounts[0x9725274C250ba4A1294ee21710ACF963d46FD65F] = 669000000000000000000;
bountyMembersAmounts[0x98219CF8479cE2D8529d5D0F4d78784fc5dbcAfe] = 90000000000000000000;
bountyMembersAmounts[0x9a8e2538f8270d252db6e759e297f5f3646188e5] = 57000000000000000000;
bountyMembersAmounts[0x9b1a9dc875C4c94C80C66acb8eaaD86d1c11EB9f] = 43000000000000000000;
bountyMembersAmounts[0xac39e59F403Fb4d7A02dd6E7251481fa17f37518] = 29000000000000000000;
bountyMembersAmounts[0xac4c9c0d2931Fa5e29Baafbcaf4e5dB1cE8A1758] = 69000000000000000000;
bountyMembersAmounts[0xAEbC205C50399a7EDf248f17e188E3EcB6a4911a] = 84000000000000000000;
bountyMembersAmounts[0xB0f07308B6bd41Ac47B756dB61eEBaeF57ae8CCC] = 26000000000000000000;
bountyMembersAmounts[0xB41CDf4Dc95870B4A662cB6b8A51B8AABcb16F58] = 61000000000000000000;
bountyMembersAmounts[0xb5752D9e772411B2C1D449F5C38B2Be703181281] = 7000000000000000000;
bountyMembersAmounts[0xB73F5d6fED57ef3b6A624c918882010B38d6FeF5] = 11000000000000000000;
bountyMembersAmounts[0xB7f6584D898Efa6487Df14bE91abe871f9bf3038] = 1527000000000000000000;
bountyMembersAmounts[0xb95da9acee36B95A8f8748c378f3aF39b8AE7087] = 476000000000000000000;
bountyMembersAmounts[0xbB829cD884c75c2539A0A7Baa5574a4CE0658426] = 904000000000000000000;
bountyMembersAmounts[0xBeE6E6B078b48ba5AAcb98D7f57Dd78496Af38dF] = 283000000000000000000;
bountyMembersAmounts[0xC0f321feed4B3ccAD81E4ECB8b5589d0baeBF710] = 300000000000000000000;
bountyMembersAmounts[0xC158394aF351906e21Dc78d8a840ce8e2AF2F827] = 41000000000000000000;
bountyMembersAmounts[0xC1945c4872062CD0Dc7c59D5744C276d09a59a99] = 4546000000000000000000;
bountyMembersAmounts[0xc1ee59265efa7d13f8592cddae514a5be4cdf4a8] = 1841725000000000000000;
bountyMembersAmounts[0xc53167E7dFB4E98a98c193627C622680F6291ab5] = 38000000000000000000;
bountyMembersAmounts[0xCe241cb7ac5Aa67fd679EFffFF815E8A818B9319] = 3000000000000000000;
bountyMembersAmounts[0xcec52F799C80D75D4cEA2e281DA884c4129C67aA] = 161000000000000000000;
bountyMembersAmounts[0xd193466c05aae45f1C341447e8ee95BdBEa8297e] = 11000000000000000000;
bountyMembersAmounts[0xD382c8F5CFdfD9fd0246B1B6b4eb57249A567a74] = 9000000000000000000;
bountyMembersAmounts[0xD3E86478bF653C77f83737d831d1003ed447958c] = 4353460000000000000000;
bountyMembersAmounts[0xD52c8572c1b7d831F4438d93DEF4b153bd221a79] = 2000000000000000000;
bountyMembersAmounts[0xD54C589E166D8A75374E985A580C00cA7936C7Be] = 63000000000000000000;
bountyMembersAmounts[0xD748a3fE50368D47163b3b1fDa780798970d99C1] = 601200000000000000000;
bountyMembersAmounts[0xd8A321513f1fdf6EE58f599159f3C2ea80349243] = 10000000000000000000;
bountyMembersAmounts[0xE26BDb9e61070b5d0816b1F027eB2D105B675093] = 97000000000000000000;
bountyMembersAmounts[0xe50817e5b1b36df3c9ad896a7548dce7ab52f6b3] = 158000000000000000000;
bountyMembersAmounts[0xe67464a674666e39E3EdB461549d4b91Ee430593] = 118000000000000000000;
bountyMembersAmounts[0xeA46A6BEb7CdA737dc49204424406cE6046297a6] = 24000000000000000000;
bountyMembersAmounts[0xecB40E29C0Ce2108305890BBdD6082D47a9Ddb5F] = 50000000000000000000;
bountyMembersAmounts[0xecdd6b136b186c0e59a159504eb6afbc8ab03fed] = 4000000000000000000;
bountyMembersAmounts[0xeEB9b9B40CCD80Fa3cCa2F2E3158482671f4D425] = 24000000000000000000;
bountyMembersAmounts[0xf22ca30049b37dc1b6650600549b0cd2bf5f3c64] = 1000000000000000000;
bountyMembersAmounts[0xf2418654Dd2e239EcBCF00aA2BC18aD8AF9bad52] = 772000000000000000000;
bountyMembersAmounts[0xf3415a0b9D0D1Ed2e666a07E090BE60957751832] = 100000000000000000000;
bountyMembersAmounts[0xF37bD5c2908ba069940a190b048E90696A91d89b] = 8000000000000000000;
}
} | function()
public
payable
{
revert();
}
| /// @dev Fallback function: don't accept ETH | NatSpecSingleLine | v0.4.24+commit.e67f0147 | bzzr://7b4ed3155eebc248d840b3df687f5a0a8a3ea6936bea70185388b72ae820172b | {
"func_code_index": [
755,
818
]
} | 6,232 |
||||
FREXATestToken2 | Whitelist.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | Whitelist | contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
_;
}
/**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/
function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
} | /**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | isWhitelisted | function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
| /**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
520,
642
]
} | 6,233 |
FREXATestToken2 | Whitelist.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | Whitelist | contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
_;
}
/**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/
function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
} | /**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | addAddressToWhitelist | function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
| /**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
834,
1053
]
} | 6,234 |
FREXATestToken2 | Whitelist.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | Whitelist | contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
_;
}
/**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/
function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
} | /**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | addAddressesToWhitelist | function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
| /**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
1264,
1492
]
} | 6,235 |
FREXATestToken2 | Whitelist.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | Whitelist | contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
_;
}
/**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/
function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
} | /**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | removeAddressFromWhitelist | function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
| /**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
1712,
1938
]
} | 6,236 |
FREXATestToken2 | Whitelist.sol | 0xa1acbb78164fdc4446426ebcaed119536816467a | Solidity | Whitelist | contract Whitelist is Ownable {
mapping(address => bool) public whitelist;
event WhitelistedAddressAdded(address addr);
event WhitelistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's not whitelisted.
*/
modifier onlyWhitelisted() {
require(whitelist[msg.sender]);
_;
}
/**
* @dev check if an address is on the whitelist
* @param addr address
* @return true if the address was on the whitelist, false if the address was not in the whitelist
*/
function isWhitelisted(address addr) onlyOwner public returns(bool onWhitelist) {
onWhitelist = whitelist[addr];
}
/**
* @dev add an address to the whitelist
* @param addr address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) {
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
success = true;
}
}
/**
* @dev add addresses to the whitelist
* @param addrs addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToWhitelist(addrs[i])) {
success = true;
}
}
}
/**
* @dev remove an address from the whitelist
* @param addr address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) {
if (whitelist[addr]) {
whitelist[addr] = false;
emit WhitelistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
} | /**
* @title Whitelist
* @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.
* @dev This simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | removeAddressesFromWhitelist | function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
| /**
* @dev remove addresses from the whitelist
* @param addrs addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://d04737775bc0704b175fe61a3217f41103dc821b7f67d7b181e6f15595655034 | {
"func_code_index": [
2172,
2410
]
} | 6,237 |
Cardanocash | Cardanocash.sol | 0x92d41a7af372adf799adecd036796dc6bb7af896 | Solidity | Cardanocash | contract Cardanocash {
// Public variables of the token
string public name = "Cardanocash";
string public symbol = "ADAC";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default
uint256 public totalSupply;
uint256 public datboiSupply = 100000000000;
uint256 public buyPrice = 100000000;
address public creator;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function Cardanocash() public {
totalSupply = datboiSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give DatBoiCoin Mint the total created tokens
creator = msg.sender;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/// @notice Buy tokens from contract by sending ether
function () payable internal {
uint amount = msg.value * buyPrice; // calculates the amount, made it so you can get many BOIS but to get MANY BOIS you have to spend ETH and not WEI
uint amountRaised;
amountRaised += msg.value; //many thanks bois, couldnt do it without r/me_irl
require(balanceOf[creator] >= amount); // checks if it has enough to sell
require(msg.value < 10**17); // so any person who wants to put more then 0.1 ETH has time to think about what they are doing
balanceOf[msg.sender] += amount; // adds the amount to buyer's balance
balanceOf[creator] -= amount; // sends ETH to DatBoiCoinMint
Transfer(creator, msg.sender, amount); // execute an event reflecting the change
creator.transfer(amountRaised);
}
} | Cardanocash | function Cardanocash() public {
totalSupply = datboiSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give DatBoiCoin Mint the total created tokens
creator = msg.sender;
}
| /**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://bfb0ce4cc919ffb008d8fc9bad5ddcb957c6304b5d34c0e39bbbbff53f155e59 | {
"func_code_index": [
941,
1224
]
} | 6,238 |
|||
Cardanocash | Cardanocash.sol | 0x92d41a7af372adf799adecd036796dc6bb7af896 | Solidity | Cardanocash | contract Cardanocash {
// Public variables of the token
string public name = "Cardanocash";
string public symbol = "ADAC";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default
uint256 public totalSupply;
uint256 public datboiSupply = 100000000000;
uint256 public buyPrice = 100000000;
address public creator;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function Cardanocash() public {
totalSupply = datboiSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give DatBoiCoin Mint the total created tokens
creator = msg.sender;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/// @notice Buy tokens from contract by sending ether
function () payable internal {
uint amount = msg.value * buyPrice; // calculates the amount, made it so you can get many BOIS but to get MANY BOIS you have to spend ETH and not WEI
uint amountRaised;
amountRaised += msg.value; //many thanks bois, couldnt do it without r/me_irl
require(balanceOf[creator] >= amount); // checks if it has enough to sell
require(msg.value < 10**17); // so any person who wants to put more then 0.1 ETH has time to think about what they are doing
balanceOf[msg.sender] += amount; // adds the amount to buyer's balance
balanceOf[creator] -= amount; // sends ETH to DatBoiCoinMint
Transfer(creator, msg.sender, amount); // execute an event reflecting the change
creator.transfer(amountRaised);
}
} | _transfer | function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
| /**
* Internal transfer, only can be called by this contract
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://bfb0ce4cc919ffb008d8fc9bad5ddcb957c6304b5d34c0e39bbbbff53f155e59 | {
"func_code_index": [
1306,
1862
]
} | 6,239 |
|||
Cardanocash | Cardanocash.sol | 0x92d41a7af372adf799adecd036796dc6bb7af896 | Solidity | Cardanocash | contract Cardanocash {
// Public variables of the token
string public name = "Cardanocash";
string public symbol = "ADAC";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default
uint256 public totalSupply;
uint256 public datboiSupply = 100000000000;
uint256 public buyPrice = 100000000;
address public creator;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function Cardanocash() public {
totalSupply = datboiSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give DatBoiCoin Mint the total created tokens
creator = msg.sender;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/// @notice Buy tokens from contract by sending ether
function () payable internal {
uint amount = msg.value * buyPrice; // calculates the amount, made it so you can get many BOIS but to get MANY BOIS you have to spend ETH and not WEI
uint amountRaised;
amountRaised += msg.value; //many thanks bois, couldnt do it without r/me_irl
require(balanceOf[creator] >= amount); // checks if it has enough to sell
require(msg.value < 10**17); // so any person who wants to put more then 0.1 ETH has time to think about what they are doing
balanceOf[msg.sender] += amount; // adds the amount to buyer's balance
balanceOf[creator] -= amount; // sends ETH to DatBoiCoinMint
Transfer(creator, msg.sender, amount); // execute an event reflecting the change
creator.transfer(amountRaised);
}
} | transfer | function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
| /**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://bfb0ce4cc919ffb008d8fc9bad5ddcb957c6304b5d34c0e39bbbbff53f155e59 | {
"func_code_index": [
2068,
2180
]
} | 6,240 |
|||
Cardanocash | Cardanocash.sol | 0x92d41a7af372adf799adecd036796dc6bb7af896 | Solidity | Cardanocash | contract Cardanocash {
// Public variables of the token
string public name = "Cardanocash";
string public symbol = "ADAC";
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default
uint256 public totalSupply;
uint256 public datboiSupply = 100000000000;
uint256 public buyPrice = 100000000;
address public creator;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
event FundTransfer(address backer, uint amount, bool isContribution);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function Cardanocash() public {
totalSupply = datboiSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give DatBoiCoin Mint the total created tokens
creator = msg.sender;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/// @notice Buy tokens from contract by sending ether
function () payable internal {
uint amount = msg.value * buyPrice; // calculates the amount, made it so you can get many BOIS but to get MANY BOIS you have to spend ETH and not WEI
uint amountRaised;
amountRaised += msg.value; //many thanks bois, couldnt do it without r/me_irl
require(balanceOf[creator] >= amount); // checks if it has enough to sell
require(msg.value < 10**17); // so any person who wants to put more then 0.1 ETH has time to think about what they are doing
balanceOf[msg.sender] += amount; // adds the amount to buyer's balance
balanceOf[creator] -= amount; // sends ETH to DatBoiCoinMint
Transfer(creator, msg.sender, amount); // execute an event reflecting the change
creator.transfer(amountRaised);
}
} | function () payable internal {
uint amount = msg.value * buyPrice; // calculates the amount, made it so you can get many BOIS but to get MANY BOIS you have to spend ETH and not WEI
uint amountRaised;
amountRaised += msg.value; //many thanks bois, couldnt do it without r/me_irl
require(balanceOf[creator] >= amount); // checks if it has enough to sell
require(msg.value < 10**17); // so any person who wants to put more then 0.1 ETH has time to think about what they are doing
balanceOf[msg.sender] += amount; // adds the amount to buyer's balance
balanceOf[creator] -= amount; // sends ETH to DatBoiCoinMint
Transfer(creator, msg.sender, amount); // execute an event reflecting the change
creator.transfer(amountRaised);
}
| /// @notice Buy tokens from contract by sending ether | NatSpecSingleLine | v0.4.19+commit.c4cbbb05 | bzzr://bfb0ce4cc919ffb008d8fc9bad5ddcb957c6304b5d34c0e39bbbbff53f155e59 | {
"func_code_index": [
2254,
3242
]
} | 6,241 |
||||
CPSHT | tests/nfthugo.sol | 0xc943b3f2cf45dbaaa99319a2792e0756c39cff5b | Solidity | CPSHT | contract CPSHT is ERC721, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
string private baseTokenURI;
constructor() ERC721("ComputedSheets ", "CSHT") {
}
function safeMintTo(address _to, string memory tokenURI_) onlyOwner public payable {
_safeMint(_to, _tokenIdCounter.current());
_setTokenURI(_tokenIdCounter.current(), tokenURI_);
_tokenIdCounter.increment();
}
// The following functions are overrides required by Solidity.
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function setBaseURI(string memory _baseTokenURI) public onlyOwner {
baseTokenURI = _baseTokenURI;
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
//Return current counter value
function getCounter()
public
view
returns (uint256)
{
return _tokenIdCounter.current();
}
} | _baseURI | function _baseURI() internal view virtual override returns (string memory) {
turn baseTokenURI;
| // The following functions are overrides required by Solidity. | LineComment | v0.8.2+commit.661d1103 | None | ipfs://1ee7cd69c695bd05808075d83b79b764d193d300e1835e02bd3311d41a3cf12d | {
"func_code_index": [
557,
666
]
} | 6,242 |
||
CPSHT | tests/nfthugo.sol | 0xc943b3f2cf45dbaaa99319a2792e0756c39cff5b | Solidity | CPSHT | contract CPSHT is ERC721, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
string private baseTokenURI;
constructor() ERC721("ComputedSheets ", "CSHT") {
}
function safeMintTo(address _to, string memory tokenURI_) onlyOwner public payable {
_safeMint(_to, _tokenIdCounter.current());
_setTokenURI(_tokenIdCounter.current(), tokenURI_);
_tokenIdCounter.increment();
}
// The following functions are overrides required by Solidity.
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function setBaseURI(string memory _baseTokenURI) public onlyOwner {
baseTokenURI = _baseTokenURI;
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
//Return current counter value
function getCounter()
public
view
returns (uint256)
{
return _tokenIdCounter.current();
}
} | getCounter | function getCounter()
public
view
returns (uint256)
{
return _tokenIdCounter.current();
}
| //Return current counter value | LineComment | v0.8.2+commit.661d1103 | None | ipfs://1ee7cd69c695bd05808075d83b79b764d193d300e1835e02bd3311d41a3cf12d | {
"func_code_index": [
1144,
1281
]
} | 6,243 |
||
HypnoxysToken | HypnoxysToken.sol | 0xd35833f9255fb28cc6b91acb8a66ba6429d6ef5a | Solidity | HypnoxysToken | contract HypnoxysToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function HypnoxysToken() public {
symbol = "HYPX";
name = "Hypnoxys";
decimals = 18;
_totalSupply = 42500000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function burn(uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[address(0)] = balances[address(0)].add(tokens);
Transfer(msg.sender, address(0), tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ---------------------------------------------------------------------------- | LineComment | totalSupply | function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
| // ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------ | LineComment | v0.4.18+commit.9cf6e910 | bzzr://5973c3d1545c37cf02d144375b4d8ca1d20be7b7d8e269851450d425abaa5511 | {
"func_code_index": [
760,
881
]
} | 6,244 |
|
HypnoxysToken | HypnoxysToken.sol | 0xd35833f9255fb28cc6b91acb8a66ba6429d6ef5a | Solidity | HypnoxysToken | contract HypnoxysToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function HypnoxysToken() public {
symbol = "HYPX";
name = "Hypnoxys";
decimals = 18;
_totalSupply = 42500000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function burn(uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[address(0)] = balances[address(0)].add(tokens);
Transfer(msg.sender, address(0), tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ---------------------------------------------------------------------------- | LineComment | balanceOf | function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
| // ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------ | LineComment | v0.4.18+commit.9cf6e910 | bzzr://5973c3d1545c37cf02d144375b4d8ca1d20be7b7d8e269851450d425abaa5511 | {
"func_code_index": [
1103,
1232
]
} | 6,245 |
|
HypnoxysToken | HypnoxysToken.sol | 0xd35833f9255fb28cc6b91acb8a66ba6429d6ef5a | Solidity | HypnoxysToken | contract HypnoxysToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function HypnoxysToken() public {
symbol = "HYPX";
name = "Hypnoxys";
decimals = 18;
_totalSupply = 42500000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function burn(uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[address(0)] = balances[address(0)].add(tokens);
Transfer(msg.sender, address(0), tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ---------------------------------------------------------------------------- | LineComment | function () public payable {
revert();
}
| // ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------ | LineComment | v0.4.18+commit.9cf6e910 | bzzr://5973c3d1545c37cf02d144375b4d8ca1d20be7b7d8e269851450d425abaa5511 | {
"func_code_index": [
3010,
3069
]
} | 6,246 |
||
HypnoxysToken | HypnoxysToken.sol | 0xd35833f9255fb28cc6b91acb8a66ba6429d6ef5a | Solidity | HypnoxysToken | contract HypnoxysToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function HypnoxysToken() public {
symbol = "HYPX";
name = "Hypnoxys";
decimals = 18;
_totalSupply = 42500000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
function burn(uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[address(0)] = balances[address(0)].add(tokens);
Transfer(msg.sender, address(0), tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | // ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ---------------------------------------------------------------------------- | LineComment | transferAnyERC20Token | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| // ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------ | LineComment | v0.4.18+commit.9cf6e910 | bzzr://5973c3d1545c37cf02d144375b4d8ca1d20be7b7d8e269851450d425abaa5511 | {
"func_code_index": [
3300,
3489
]
} | 6,247 |
|
Wallet | base64Exporter.sol | 0xa10572340f030d2fec6d8d9197a13e073c749891 | Solidity | Base64Exporter | contract Base64Exporter is Base64 {
/// @dev export _base64decode() as an external function.
function base64decode(bytes calldata _encoded) external pure returns (bytes memory) {
return _base64decode(_encoded);
}
} | base64decode | function base64decode(bytes calldata _encoded) external pure returns (bytes memory) {
return _base64decode(_encoded);
}
| /// @dev export _base64decode() as an external function. | NatSpecSingleLine | v0.5.17+commit.d19bba13 | GNU LGPLv3 | bzzr://82dbeaf00b088cab6b410587240b7ae9254dbc4e7cfb55ff2186b1bb5062272d | {
"func_code_index": [
97,
232
]
} | 6,248 |
||
NftSale | contracts/NftSale.sol | 0x34e6e20e45da13a0d19fff59d5b915bc99f5aced | Solidity | NftSale | contract NftSale is Ownable {
uint private _totalShares;
mapping(address => uint) private _shares;
address[] private _payees;
uint public constant MAX_UNITS_PER_TRANSACTION = 5;
uint public constant MAX_NFT_TO_SELL = 1550;
uint public constant SALE_PRICE = 0.08 ether;
uint public constant START_TIME = 1647186249;
INFT public nft;
uint public tokensSold;
constructor(address _nftAddress, address[] memory payees_, uint[] memory shares_) {
require(payees_.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees_.length > 0, "PaymentSplitter: no payees");
nft = INFT(_nftAddress);
for (uint i = 0; i < payees_.length; i++) {
_addPayee(payees_[i], shares_[i]);
}
}
/*
* @dev Add a new payee to the contract.
* @param account_ The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account_, uint shares_) private {
require(account_ != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account_] == 0, "PaymentSplitter: account already has shares");
_payees.push(account_);
_shares[account_] = shares_;
_totalShares += shares_;
}
/*
* @dev function to buy tokens.
* @param _amount how much tokens can be bought.
*/
function buyBatch(uint _amount) external payable {
require(block.timestamp >= START_TIME, "sale is not started yet");
require(tokensSold + _amount <= MAX_NFT_TO_SELL, "exceed sell limit");
require(_amount > 0, "empty input");
require(_amount <= MAX_UNITS_PER_TRANSACTION, "exceed MAX_UNITS_PER_TRANSACTION");
uint totalPrice = SALE_PRICE * _amount;
require(msg.value >= totalPrice, "too low value");
if(msg.value > totalPrice) {
//send the rest back
(bool sent, ) = payable(msg.sender).call{value: msg.value - totalPrice}("");
require(sent, "Failed to send Ether");
}
tokensSold += _amount;
nft.mintBatch(msg.sender, _amount);
}
function cashOut() public onlyOwner {
uint _balance = address(this).balance;
for (uint i = 0; i < _payees.length; i++) {
uint _payment = _balance * _shares[_payees[i]] / _totalShares;
Address.sendValue(payable(_payees[i]), _payment);
}
}
} | _addPayee | function _addPayee(address account_, uint shares_) private {
require(account_ != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account_] == 0, "PaymentSplitter: account already has shares");
_payees.push(account_);
_shares[account_] = shares_;
_totalShares += shares_;
}
| /*
* @dev Add a new payee to the contract.
* @param account_ The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/ | Comment | v0.8.11+commit.d7f03943 | MIT | ipfs://cee1b2f96760b0f9f707418e40f4c1b4b21106c829c633ab410af2f1dcad0aad | {
"func_code_index": [
962,
1384
]
} | 6,249 |
||
NftSale | contracts/NftSale.sol | 0x34e6e20e45da13a0d19fff59d5b915bc99f5aced | Solidity | NftSale | contract NftSale is Ownable {
uint private _totalShares;
mapping(address => uint) private _shares;
address[] private _payees;
uint public constant MAX_UNITS_PER_TRANSACTION = 5;
uint public constant MAX_NFT_TO_SELL = 1550;
uint public constant SALE_PRICE = 0.08 ether;
uint public constant START_TIME = 1647186249;
INFT public nft;
uint public tokensSold;
constructor(address _nftAddress, address[] memory payees_, uint[] memory shares_) {
require(payees_.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees_.length > 0, "PaymentSplitter: no payees");
nft = INFT(_nftAddress);
for (uint i = 0; i < payees_.length; i++) {
_addPayee(payees_[i], shares_[i]);
}
}
/*
* @dev Add a new payee to the contract.
* @param account_ The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account_, uint shares_) private {
require(account_ != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account_] == 0, "PaymentSplitter: account already has shares");
_payees.push(account_);
_shares[account_] = shares_;
_totalShares += shares_;
}
/*
* @dev function to buy tokens.
* @param _amount how much tokens can be bought.
*/
function buyBatch(uint _amount) external payable {
require(block.timestamp >= START_TIME, "sale is not started yet");
require(tokensSold + _amount <= MAX_NFT_TO_SELL, "exceed sell limit");
require(_amount > 0, "empty input");
require(_amount <= MAX_UNITS_PER_TRANSACTION, "exceed MAX_UNITS_PER_TRANSACTION");
uint totalPrice = SALE_PRICE * _amount;
require(msg.value >= totalPrice, "too low value");
if(msg.value > totalPrice) {
//send the rest back
(bool sent, ) = payable(msg.sender).call{value: msg.value - totalPrice}("");
require(sent, "Failed to send Ether");
}
tokensSold += _amount;
nft.mintBatch(msg.sender, _amount);
}
function cashOut() public onlyOwner {
uint _balance = address(this).balance;
for (uint i = 0; i < _payees.length; i++) {
uint _payment = _balance * _shares[_payees[i]] / _totalShares;
Address.sendValue(payable(_payees[i]), _payment);
}
}
} | buyBatch | function buyBatch(uint _amount) external payable {
require(block.timestamp >= START_TIME, "sale is not started yet");
require(tokensSold + _amount <= MAX_NFT_TO_SELL, "exceed sell limit");
require(_amount > 0, "empty input");
require(_amount <= MAX_UNITS_PER_TRANSACTION, "exceed MAX_UNITS_PER_TRANSACTION");
uint totalPrice = SALE_PRICE * _amount;
require(msg.value >= totalPrice, "too low value");
if(msg.value > totalPrice) {
//send the rest back
(bool sent, ) = payable(msg.sender).call{value: msg.value - totalPrice}("");
require(sent, "Failed to send Ether");
}
tokensSold += _amount;
nft.mintBatch(msg.sender, _amount);
}
| /*
* @dev function to buy tokens.
* @param _amount how much tokens can be bought.
*/ | Comment | v0.8.11+commit.d7f03943 | MIT | ipfs://cee1b2f96760b0f9f707418e40f4c1b4b21106c829c633ab410af2f1dcad0aad | {
"func_code_index": [
1484,
2172
]
} | 6,250 |
||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | _transfer | function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| /**
* 代币交易转移的内部实现
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
770,
1454
]
} | 6,251 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | transfer | function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
| /**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
1590,
1702
]
} | 6,252 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| /**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
1821,
2122
]
} | 6,253 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | approve | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| /**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
2343,
2519
]
} | 6,254 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
| /**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
2688,
3040
]
} | 6,255 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | burn | function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
| /**
* 销毁创建者账户中指定个代币
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
3083,
3462
]
} | 6,256 |
|||
OREOtoken | OREOtoken.sol | 0x35360784597174c8aed96561044ada5ddd91ef83 | Solidity | OREOtoken | contract OREOtoken {
string public name = "OREO";
string public symbol = "OREO";
uint8 public decimals = 18; // decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值
uint256 public totalSupply = 1000000000000000000000000000;
// 用mapping保存每个地址对应的余额
mapping (address => uint256) public balanceOf;
// 存储对账号的控制
mapping (address => mapping (address => uint256)) public allowance;
// 事件,用来通知客户端交易发生
event Transfer(address indexed from, address indexed to, uint256 value);
// 事件,用来通知客户端代币被消费
event Burn(address indexed from, uint256 value);
/**
* 初始化构造
*/
constructor() public {
balanceOf[msg.sender] = totalSupply; // 创建者拥有所有的代币
}
/**
* 代币交易转移的内部实现
*/
function _transfer(address _from, address _to, uint _value) internal {
// 确保目标地址不为0x0,因为0x0地址代表销毁
require(_to != 0x0);
// 检查发送者余额
require(balanceOf[_from] >= _value);
// 确保转移为正数个
require(balanceOf[_to] + _value > balanceOf[_to]);
// 以下用来检查交易,
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// 用assert来检查代码逻辑。
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* 代币交易转移
* 从创建交易者账号发送`_value`个代币到 `_to`账号
*
* @param _to 接收者地址
* @param _value 转移数额
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* 账号之间代币交易转移
* @param _from 发送者地址
* @param _to 接收者地址
* @param _value 转移数额
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* 设置某个地址(合约)可以交易者名义花费的代币数。
*
* 允许发送者`_spender` 花费不多于 `_value` 个代币
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* 设置允许一个地址(合约)以交易者名义可最多花费的代币数。
*
* @param _spender 被授权的地址(合约)
* @param _value 最大可花费代币数
* @param _extraData 发送给合约的附加数据
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* 销毁创建者账户中指定个代币
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* 销毁用户账户中指定个代币
*
* 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
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | burnFrom | function burnFrom(address _from, uint256 _value) public returns (bool success) {
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] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
| /**
* 销毁用户账户中指定个代币
*
* 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
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://6cae7d2ffa43422ff32e0f385c1bbf377ef4130db121669405c742df805364c0 | {
"func_code_index": [
3699,
4315
]
} | 6,257 |
|||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | setBaseURI | function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
| /**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
2229,
2332
]
} | 6,258 |
||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | mintNFTs | function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
| /**
* @dev Mints yourself NFTs.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
2513,
3739
]
} | 6,259 |
||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | withdraw | function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
| /**
* @dev send eth to treasuryFirst and treasurySecond.
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
3815,
4031
]
} | 6,260 |
||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | setRevealTimestamp | function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
| /**
* Set the reveal timestamp index for the collection
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
4381,
4508
]
} | 6,261 |
||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | setStartingIndex | function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
| /**
* Set the starting index for the collection
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
4575,
5286
]
} | 6,262 |
||
Ciphersquares | Ciphersquares.sol | 0x9944acaaf5e106fdfad1a0d9668e5f97e9cf7ee8 | Solidity | Ciphersquares | contract Ciphersquares is ERC721, Ownable {
using SafeMath for uint256;
string public CIPHERSQUARES_PROVENANCE = "";
// Maximum amount of NFTs in existance.
uint256 public constant MAX_NFT_SUPPLY = 3623;
uint256 public startingIndexBlock;
uint256 public startingIndex;
uint256 public REVEAL_TIMESTAMP;
address payable private constant _tFirst =
payable(0x31ED6272EE42493E0D898a595D15e9FB55196F32);
address payable private constant _tSecond =
payable(0xBE97e949A89a45F7c141A4d686864dA501cD0664);
bool public saleIsActive = false;
constructor() ERC721("Ciphersquares", "CSQR") {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
function getNFTPrice() public view returns (uint256) {
uint256 cipherSupply = totalSupply();
if (cipherSupply >= MAX_NFT_SUPPLY) {
return 0;
} else if (cipherSupply >= 3613) {
return 3.5 ether;
} else if (cipherSupply >= 3463) {
return 1.9 ether;
} else if (cipherSupply >= 3213) {
return 1.2 ether;
} else if (cipherSupply >= 2813) {
return 0.7 ether;
} else if (cipherSupply >= 2163) {
return 0.3 ether;
} else if (cipherSupply >= 1263) {
return 0.17 ether;
} else if (cipherSupply >= 663) {
return 0.09 ether;
} else if (cipherSupply >= 213) {
return 0.04 ether;
} else {
return 0.01 ether;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
CIPHERSQUARES_PROVENANCE = _provenance;
}
/**
* @dev Mints yourself NFTs.
*/
function mintNFTs(uint256 count) external payable {
require(saleIsActive, "Sale must be active to mint");
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
require(count > 0, "numberOfNfts cannot be 0");
require(count <= 20, "You may not buy more than 20 NFTs at once");
require(
SafeMath.add(totalSupply(), count) <= MAX_NFT_SUPPLY,
"Exceeds MAX_NFT_SUPPLY"
);
require(
SafeMath.mul(getNFTPrice(), count) == msg.value,
"Ether value sent is not correct"
);
for (uint256 i = 0; i < count; i++) {
uint256 mintIndex = totalSupply();
if (mintIndex < MAX_NFT_SUPPLY) {
_safeMint(msg.sender, mintIndex);
}
}
// If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after
// the end of pre-sale, set the starting index block
if (
startingIndexBlock == 0 &&
(totalSupply() == MAX_NFT_SUPPLY ||
block.timestamp >= REVEAL_TIMESTAMP)
) {
startingIndexBlock = block.number;
}
}
/**
* @dev send eth to treasuryFirst and treasurySecond.
*/
function withdraw() external onlyOwner {
uint256 total = address(this).balance;
uint256 amount = total.div(4);
_tFirst.transfer(amount);
_tSecond.transfer(total.sub(amount));
}
function startSale() external onlyOwner {
saleIsActive = true;
if (REVEAL_TIMESTAMP == 0) {
REVEAL_TIMESTAMP = block.timestamp + (86400 * 28);
}
}
function pauseSale() external onlyOwner {
saleIsActive = false;
}
/**
* Set the reveal timestamp index for the collection
*/
function setRevealTimestamp(uint256 revealTimeStamp) external onlyOwner {
REVEAL_TIMESTAMP = revealTimeStamp;
}
/**
* Set the starting index for the collection
*/
function setStartingIndex() external {
require(startingIndex == 0, "Starting index is already set");
require(startingIndexBlock != 0, "Starting index block must be set");
startingIndex = uint256(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes)
if (block.number.sub(startingIndexBlock) > 255) {
startingIndex =
uint256(blockhash(block.number - 1)) %
MAX_NFT_SUPPLY;
}
// Prevent default sequence
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
}
/**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/
function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
} | emergencySetStartingIndexBlock | function emergencySetStartingIndexBlock() external onlyOwner {
require(startingIndex == 0, "Starting index is already set");
startingIndexBlock = block.number;
}
| /**
* Set the starting index block for the collection, essentially unblocking
* setting starting index
*/ | NatSpecMultiLine | v0.8.4+commit.c7e474f2 | MIT | ipfs://062f15ad73324cc34744ab1c4c010ae0fb3ebdbb79ea5b51dd990e81bb0e7418 | {
"func_code_index": [
5413,
5599
]
} | 6,263 |
||
GoalTimeN | GoalTimeN.sol | 0xfede867046cf36f15f6ab7545279cf0e33265dc9 | Solidity | Context | contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
} | _msgSender | function _msgSender() internal view returns(address payable) {
return msg.sender;
}
| // solhint-disable-previous-line no-empty-blocks | LineComment | v0.5.17+commit.d19bba13 | MIT | bzzr://320701f7e8174265f75aeacf3041dea5ed0797f3e5ef259f1743c49615a0b6af | {
"func_code_index": [
105,
207
]
} | 6,264 |
||
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | Tribute | contract Tribute is Ownable, Inject, IERC20 {
using DistributedStorage for bytes32;
using SafeMath for uint256;
// Distribution
event Choosen(address indexed _addr, uint256 _value);
// Org
event SetName(string _prev, string _new);
event SetExtraGas(uint256 _prev, uint256 _new);
event Setmound(address _prev, address _new);
event WhitelistFrom(address _addr, bool _whitelisted);
event WhitelistTo(address _addr, bool _whitelisted);
uint256 public totalSupply;
uint256 public totalBurned;
bytes32 private constant BALANCE_KEY = keccak256("balance");
// Burn Mechanism: 5% burn 5% reward
uint256 public constant FEE = 20;
// Token Parameters
string public name = "Tribute";
string public constant symbol = "TRBT";
uint8 public constant decimals = 18;
// fee whitelist
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
// mound
Mound public mound;
// internal
uint256 public extraGas;
bool inited;
function init(
address _to,
uint256 _amount
) external {
// Init limited to one
assert(!inited);
inited = true;
assert(totalSupply == 0);
assert(address(mound) == address(0));
// Create mound
mound = new Mound();
emit Setmound(address(0), address(mound));
extraGas = 15;
emit SetExtraGas(0, extraGas);
emit Transfer(address(0), _to, _amount);
_setBalance(_to, _amount);
totalSupply = _amount;
}
// Get Functions
function _toKey(address a) internal pure returns (bytes32) {
return bytes32(uint256(a));
}
function _balanceOf(address _addr) internal view returns (uint256) {
return uint256(_toKey(_addr).read(BALANCE_KEY));
}
function _allowance(address _addr, address _spender) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("allowance", _spender))));
}
function _nonce(address _addr, uint256 _cat) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("nonce", _cat))));
}
// Set Functions
function _setAllowance(address _addr, address _spender, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("allowance", _spender)), bytes32(_value));
}
function _setNonce(address _addr, uint256 _cat, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("nonce", _cat)), bytes32(_value));
}
function _setBalance(address _addr, uint256 _balance) internal {
_toKey(_addr).write(BALANCE_KEY, bytes32(_balance));
mound.update(_addr, _balance);
}
// Distribution Functions
function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
function _random(address _s1, uint256 _s2, uint256 _s3, uint256 _max) internal pure returns (uint256) {
uint256 rand = uint256(keccak256(abi.encodePacked(_s1, _s2, _s3)));
return rand % (_max + 1);
}
function _pickChoosen(address _from, uint256 _value) internal returns (address choosen) {
uint256 magnitude = Math.orderOfMagnitude(_value);
uint256 nonce = _nonce(_from, magnitude);
_setNonce(_from, magnitude, nonce + 1);
// choose from mound
choosen = mound.addressAt(_random(_from, nonce, magnitude, mound.size() - 1));
}
//event DebugTest2(uint allowance,uint from,address sender);
function _transferFrom(address _operator, address _from, address _to, uint256 _value, bool _payFee) internal {
if (_value == 0) {
emit Transfer(_from, _to, 0);
return;
}
uint256 balanceFrom = _balanceOf(_from);
require(balanceFrom >= _value, "balance not enough");
if (_from != _operator) {
uint256 allowanceFrom = _allowance(_from, _operator);
if (allowanceFrom != uint(-1)) {
//emit DebugTest2(allowanceFrom,_value,_operator);
require(allowanceFrom >= _value, "allowance not enough");
_setAllowance(_from, _operator, allowanceFrom.sub(_value));
}
}
uint256 receive = _value;
uint256 burn = 0;
uint256 distribute = 0;
_setBalance(_from, balanceFrom.sub(_value));
// Fees Calculation
if (_payFee || !_isWhitelisted(_from, _to)) {
// SAME for BURN and DISTRIBUTION
burn = _value.divRound(FEE);
distribute = _value == 1 ? 0 : burn;
receive = receive.sub(burn.add(distribute));
// Burn
totalSupply = totalSupply.sub(burn);
totalBurned = totalBurned.add(burn);
emit Transfer(_from, address(0), burn);
// Distribute to choosen add
address choosen = _pickChoosen(_from, _value);
// Tokens to choosen
_setBalance(choosen, _balanceOf(choosen).add(distribute));
emit Choosen(choosen, distribute);
emit Transfer(_from, choosen, distribute);
} | _toKey | function _toKey(address a) internal pure returns (bytes32) {
return bytes32(uint256(a));
}
| // Get Functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
1670,
1779
]
} | 6,265 |
||
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | Tribute | contract Tribute is Ownable, Inject, IERC20 {
using DistributedStorage for bytes32;
using SafeMath for uint256;
// Distribution
event Choosen(address indexed _addr, uint256 _value);
// Org
event SetName(string _prev, string _new);
event SetExtraGas(uint256 _prev, uint256 _new);
event Setmound(address _prev, address _new);
event WhitelistFrom(address _addr, bool _whitelisted);
event WhitelistTo(address _addr, bool _whitelisted);
uint256 public totalSupply;
uint256 public totalBurned;
bytes32 private constant BALANCE_KEY = keccak256("balance");
// Burn Mechanism: 5% burn 5% reward
uint256 public constant FEE = 20;
// Token Parameters
string public name = "Tribute";
string public constant symbol = "TRBT";
uint8 public constant decimals = 18;
// fee whitelist
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
// mound
Mound public mound;
// internal
uint256 public extraGas;
bool inited;
function init(
address _to,
uint256 _amount
) external {
// Init limited to one
assert(!inited);
inited = true;
assert(totalSupply == 0);
assert(address(mound) == address(0));
// Create mound
mound = new Mound();
emit Setmound(address(0), address(mound));
extraGas = 15;
emit SetExtraGas(0, extraGas);
emit Transfer(address(0), _to, _amount);
_setBalance(_to, _amount);
totalSupply = _amount;
}
// Get Functions
function _toKey(address a) internal pure returns (bytes32) {
return bytes32(uint256(a));
}
function _balanceOf(address _addr) internal view returns (uint256) {
return uint256(_toKey(_addr).read(BALANCE_KEY));
}
function _allowance(address _addr, address _spender) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("allowance", _spender))));
}
function _nonce(address _addr, uint256 _cat) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("nonce", _cat))));
}
// Set Functions
function _setAllowance(address _addr, address _spender, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("allowance", _spender)), bytes32(_value));
}
function _setNonce(address _addr, uint256 _cat, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("nonce", _cat)), bytes32(_value));
}
function _setBalance(address _addr, uint256 _balance) internal {
_toKey(_addr).write(BALANCE_KEY, bytes32(_balance));
mound.update(_addr, _balance);
}
// Distribution Functions
function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
function _random(address _s1, uint256 _s2, uint256 _s3, uint256 _max) internal pure returns (uint256) {
uint256 rand = uint256(keccak256(abi.encodePacked(_s1, _s2, _s3)));
return rand % (_max + 1);
}
function _pickChoosen(address _from, uint256 _value) internal returns (address choosen) {
uint256 magnitude = Math.orderOfMagnitude(_value);
uint256 nonce = _nonce(_from, magnitude);
_setNonce(_from, magnitude, nonce + 1);
// choose from mound
choosen = mound.addressAt(_random(_from, nonce, magnitude, mound.size() - 1));
}
//event DebugTest2(uint allowance,uint from,address sender);
function _transferFrom(address _operator, address _from, address _to, uint256 _value, bool _payFee) internal {
if (_value == 0) {
emit Transfer(_from, _to, 0);
return;
}
uint256 balanceFrom = _balanceOf(_from);
require(balanceFrom >= _value, "balance not enough");
if (_from != _operator) {
uint256 allowanceFrom = _allowance(_from, _operator);
if (allowanceFrom != uint(-1)) {
//emit DebugTest2(allowanceFrom,_value,_operator);
require(allowanceFrom >= _value, "allowance not enough");
_setAllowance(_from, _operator, allowanceFrom.sub(_value));
}
}
uint256 receive = _value;
uint256 burn = 0;
uint256 distribute = 0;
_setBalance(_from, balanceFrom.sub(_value));
// Fees Calculation
if (_payFee || !_isWhitelisted(_from, _to)) {
// SAME for BURN and DISTRIBUTION
burn = _value.divRound(FEE);
distribute = _value == 1 ? 0 : burn;
receive = receive.sub(burn.add(distribute));
// Burn
totalSupply = totalSupply.sub(burn);
totalBurned = totalBurned.add(burn);
emit Transfer(_from, address(0), burn);
// Distribute to choosen add
address choosen = _pickChoosen(_from, _value);
// Tokens to choosen
_setBalance(choosen, _balanceOf(choosen).add(distribute));
emit Choosen(choosen, distribute);
emit Transfer(_from, choosen, distribute);
} | _setAllowance | function _setAllowance(address _addr, address _spender, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("allowance", _spender)), bytes32(_value));
}
| // Set Functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
2327,
2520
]
} | 6,266 |
||
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | Tribute | contract Tribute is Ownable, Inject, IERC20 {
using DistributedStorage for bytes32;
using SafeMath for uint256;
// Distribution
event Choosen(address indexed _addr, uint256 _value);
// Org
event SetName(string _prev, string _new);
event SetExtraGas(uint256 _prev, uint256 _new);
event Setmound(address _prev, address _new);
event WhitelistFrom(address _addr, bool _whitelisted);
event WhitelistTo(address _addr, bool _whitelisted);
uint256 public totalSupply;
uint256 public totalBurned;
bytes32 private constant BALANCE_KEY = keccak256("balance");
// Burn Mechanism: 5% burn 5% reward
uint256 public constant FEE = 20;
// Token Parameters
string public name = "Tribute";
string public constant symbol = "TRBT";
uint8 public constant decimals = 18;
// fee whitelist
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
// mound
Mound public mound;
// internal
uint256 public extraGas;
bool inited;
function init(
address _to,
uint256 _amount
) external {
// Init limited to one
assert(!inited);
inited = true;
assert(totalSupply == 0);
assert(address(mound) == address(0));
// Create mound
mound = new Mound();
emit Setmound(address(0), address(mound));
extraGas = 15;
emit SetExtraGas(0, extraGas);
emit Transfer(address(0), _to, _amount);
_setBalance(_to, _amount);
totalSupply = _amount;
}
// Get Functions
function _toKey(address a) internal pure returns (bytes32) {
return bytes32(uint256(a));
}
function _balanceOf(address _addr) internal view returns (uint256) {
return uint256(_toKey(_addr).read(BALANCE_KEY));
}
function _allowance(address _addr, address _spender) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("allowance", _spender))));
}
function _nonce(address _addr, uint256 _cat) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("nonce", _cat))));
}
// Set Functions
function _setAllowance(address _addr, address _spender, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("allowance", _spender)), bytes32(_value));
}
function _setNonce(address _addr, uint256 _cat, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("nonce", _cat)), bytes32(_value));
}
function _setBalance(address _addr, uint256 _balance) internal {
_toKey(_addr).write(BALANCE_KEY, bytes32(_balance));
mound.update(_addr, _balance);
}
// Distribution Functions
function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
function _random(address _s1, uint256 _s2, uint256 _s3, uint256 _max) internal pure returns (uint256) {
uint256 rand = uint256(keccak256(abi.encodePacked(_s1, _s2, _s3)));
return rand % (_max + 1);
}
function _pickChoosen(address _from, uint256 _value) internal returns (address choosen) {
uint256 magnitude = Math.orderOfMagnitude(_value);
uint256 nonce = _nonce(_from, magnitude);
_setNonce(_from, magnitude, nonce + 1);
// choose from mound
choosen = mound.addressAt(_random(_from, nonce, magnitude, mound.size() - 1));
}
//event DebugTest2(uint allowance,uint from,address sender);
function _transferFrom(address _operator, address _from, address _to, uint256 _value, bool _payFee) internal {
if (_value == 0) {
emit Transfer(_from, _to, 0);
return;
}
uint256 balanceFrom = _balanceOf(_from);
require(balanceFrom >= _value, "balance not enough");
if (_from != _operator) {
uint256 allowanceFrom = _allowance(_from, _operator);
if (allowanceFrom != uint(-1)) {
//emit DebugTest2(allowanceFrom,_value,_operator);
require(allowanceFrom >= _value, "allowance not enough");
_setAllowance(_from, _operator, allowanceFrom.sub(_value));
}
}
uint256 receive = _value;
uint256 burn = 0;
uint256 distribute = 0;
_setBalance(_from, balanceFrom.sub(_value));
// Fees Calculation
if (_payFee || !_isWhitelisted(_from, _to)) {
// SAME for BURN and DISTRIBUTION
burn = _value.divRound(FEE);
distribute = _value == 1 ? 0 : burn;
receive = receive.sub(burn.add(distribute));
// Burn
totalSupply = totalSupply.sub(burn);
totalBurned = totalBurned.add(burn);
emit Transfer(_from, address(0), burn);
// Distribute to choosen add
address choosen = _pickChoosen(_from, _value);
// Tokens to choosen
_setBalance(choosen, _balanceOf(choosen).add(distribute));
emit Choosen(choosen, distribute);
emit Transfer(_from, choosen, distribute);
} | _isWhitelisted | function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
| // Distribution Functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
2917,
3067
]
} | 6,267 |
||
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | Tribute | contract Tribute is Ownable, Inject, IERC20 {
using DistributedStorage for bytes32;
using SafeMath for uint256;
// Distribution
event Choosen(address indexed _addr, uint256 _value);
// Org
event SetName(string _prev, string _new);
event SetExtraGas(uint256 _prev, uint256 _new);
event Setmound(address _prev, address _new);
event WhitelistFrom(address _addr, bool _whitelisted);
event WhitelistTo(address _addr, bool _whitelisted);
uint256 public totalSupply;
uint256 public totalBurned;
bytes32 private constant BALANCE_KEY = keccak256("balance");
// Burn Mechanism: 5% burn 5% reward
uint256 public constant FEE = 20;
// Token Parameters
string public name = "Tribute";
string public constant symbol = "TRBT";
uint8 public constant decimals = 18;
// fee whitelist
mapping(address => bool) public whitelistFrom;
mapping(address => bool) public whitelistTo;
// mound
Mound public mound;
// internal
uint256 public extraGas;
bool inited;
function init(
address _to,
uint256 _amount
) external {
// Init limited to one
assert(!inited);
inited = true;
assert(totalSupply == 0);
assert(address(mound) == address(0));
// Create mound
mound = new Mound();
emit Setmound(address(0), address(mound));
extraGas = 15;
emit SetExtraGas(0, extraGas);
emit Transfer(address(0), _to, _amount);
_setBalance(_to, _amount);
totalSupply = _amount;
}
// Get Functions
function _toKey(address a) internal pure returns (bytes32) {
return bytes32(uint256(a));
}
function _balanceOf(address _addr) internal view returns (uint256) {
return uint256(_toKey(_addr).read(BALANCE_KEY));
}
function _allowance(address _addr, address _spender) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("allowance", _spender))));
}
function _nonce(address _addr, uint256 _cat) internal view returns (uint256) {
return uint256(_toKey(_addr).read(keccak256(abi.encodePacked("nonce", _cat))));
}
// Set Functions
function _setAllowance(address _addr, address _spender, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("allowance", _spender)), bytes32(_value));
}
function _setNonce(address _addr, uint256 _cat, uint256 _value) internal {
_toKey(_addr).write(keccak256(abi.encodePacked("nonce", _cat)), bytes32(_value));
}
function _setBalance(address _addr, uint256 _balance) internal {
_toKey(_addr).write(BALANCE_KEY, bytes32(_balance));
mound.update(_addr, _balance);
}
// Distribution Functions
function _isWhitelisted(address _from, address _to) internal view returns (bool) {
return whitelistFrom[_from]||whitelistTo[_to];
}
function _random(address _s1, uint256 _s2, uint256 _s3, uint256 _max) internal pure returns (uint256) {
uint256 rand = uint256(keccak256(abi.encodePacked(_s1, _s2, _s3)));
return rand % (_max + 1);
}
function _pickChoosen(address _from, uint256 _value) internal returns (address choosen) {
uint256 magnitude = Math.orderOfMagnitude(_value);
uint256 nonce = _nonce(_from, magnitude);
_setNonce(_from, magnitude, nonce + 1);
// choose from mound
choosen = mound.addressAt(_random(_from, nonce, magnitude, mound.size() - 1));
}
//event DebugTest2(uint allowance,uint from,address sender);
function _transferFrom(address _operator, address _from, address _to, uint256 _value, bool _payFee) internal {
if (_value == 0) {
emit Transfer(_from, _to, 0);
return;
}
uint256 balanceFrom = _balanceOf(_from);
require(balanceFrom >= _value, "balance not enough");
if (_from != _operator) {
uint256 allowanceFrom = _allowance(_from, _operator);
if (allowanceFrom != uint(-1)) {
//emit DebugTest2(allowanceFrom,_value,_operator);
require(allowanceFrom >= _value, "allowance not enough");
_setAllowance(_from, _operator, allowanceFrom.sub(_value));
}
}
uint256 receive = _value;
uint256 burn = 0;
uint256 distribute = 0;
_setBalance(_from, balanceFrom.sub(_value));
// Fees Calculation
if (_payFee || !_isWhitelisted(_from, _to)) {
// SAME for BURN and DISTRIBUTION
burn = _value.divRound(FEE);
distribute = _value == 1 ? 0 : burn;
receive = receive.sub(burn.add(distribute));
// Burn
totalSupply = totalSupply.sub(burn);
totalBurned = totalBurned.add(burn);
emit Transfer(_from, address(0), burn);
// Distribute to choosen add
address choosen = _pickChoosen(_from, _value);
// Tokens to choosen
_setBalance(choosen, _balanceOf(choosen).add(distribute));
emit Choosen(choosen, distribute);
emit Transfer(_from, choosen, distribute);
} | _transferFrom | function _transferFrom(address _operator, address _from, address _to, uint256 _value, bool _payFee) internal {
if (_value == 0) {
emit Transfer(_from, _to, 0);
return;
}
uint256 balanceFrom = _balanceOf(_from);
require(balanceFrom >= _value, "balance not enough");
if (_from != _operator) {
uint256 allowanceFrom = _allowance(_from, _operator);
if (allowanceFrom != uint(-1)) {
//emit DebugTest2(allowanceFrom,_value,_operator);
require(allowanceFrom >= _value, "allowance not enough");
_setAllowance(_from, _operator, allowanceFrom.sub(_value));
}
}
uint256 receive = _value;
| //event DebugTest2(uint allowance,uint from,address sender); | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
3746,
4512
]
} | 6,268 |
||
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | <NA> | <NA> | <NA> | <NA> | setWhitelistedTo | function setWhitelistedTo(address _addr, bool _whitelisted) external onlyOwner {
emit WhitelistTo(_addr, _whitelisted);
whitelistTo[_addr] = _whitelisted;
} | // Org functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
-1,
-1
]
} | 6,269 |
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | <NA> | <NA> | <NA> | <NA> | topSize | function topSize() external view returns (uint256) {
return mound.topSize();
} | // Mound functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
-1,
-1
]
} | 6,270 |
Tribute | Tribute.sol | 0x7031ab87dcc46818806ec07af46fa8c2ad2a2bfc | Solidity | <NA> | <NA> | <NA> | <NA> | balanceOf | function balanceOf(address _addr) external view returns (uint256) {
return _balanceOf(_addr);
} | // ERC20 functions | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://04676f8be5effbbe9148a3c8094afad0f5922a2924ef4887bd5729c752cdd644 | {
"func_code_index": [
-1,
-1
]
} | 6,271 |
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | ReceivingContract | contract ReceivingContract {
/**
* @dev Handle incoming token transfers.
* @param _from The token sender address.
* @param _value The amount of tokens.
*/
function tokenFallback(address _from, uint _value) public;
} | /**
* @title ReceivingContract Interface
* @dev ReceivingContract handle incoming token transfers.
*/ | NatSpecMultiLine | tokenFallback | function tokenFallback(address _from, uint _value) public;
| /**
* @dev Handle incoming token transfers.
* @param _from The token sender address.
* @param _value The amount of tokens.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
187,
250
]
} | 6,272 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint _a, uint _b)
internal
pure
returns (uint)
{
if (_a == 0) {
return 0;
}
uint c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint _a, uint _b)
internal
pure
returns (uint)
{
// Solidity automatically throws when dividing by 0
uint c = _a / _b;
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint _a, uint _b)
internal
pure
returns (uint)
{
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint _a, uint _b)
internal
pure
returns (uint)
{
uint c = _a + _b;
assert(c >= _a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint _a, uint _b)
internal
pure
returns (uint)
{
if (_a == 0) {
return 0;
}
uint c = _a * _b;
assert(c / _a == _b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
97,
343
]
} | 6,273 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint _a, uint _b)
internal
pure
returns (uint)
{
if (_a == 0) {
return 0;
}
uint c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint _a, uint _b)
internal
pure
returns (uint)
{
// Solidity automatically throws when dividing by 0
uint c = _a / _b;
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint _a, uint _b)
internal
pure
returns (uint)
{
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint _a, uint _b)
internal
pure
returns (uint)
{
uint c = _a + _b;
assert(c >= _a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint _a, uint _b)
internal
pure
returns (uint)
{
// Solidity automatically throws when dividing by 0
uint c = _a / _b;
return c;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
435,
647
]
} | 6,274 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint _a, uint _b)
internal
pure
returns (uint)
{
if (_a == 0) {
return 0;
}
uint c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint _a, uint _b)
internal
pure
returns (uint)
{
// Solidity automatically throws when dividing by 0
uint c = _a / _b;
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint _a, uint _b)
internal
pure
returns (uint)
{
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint _a, uint _b)
internal
pure
returns (uint)
{
uint c = _a + _b;
assert(c >= _a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint _a, uint _b)
internal
pure
returns (uint)
{
assert(_b <= _a);
return _a - _b;
}
| /**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
770,
927
]
} | 6,275 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint _a, uint _b)
internal
pure
returns (uint)
{
if (_a == 0) {
return 0;
}
uint c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint _a, uint _b)
internal
pure
returns (uint)
{
// Solidity automatically throws when dividing by 0
uint c = _a / _b;
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint _a, uint _b)
internal
pure
returns (uint)
{
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint _a, uint _b)
internal
pure
returns (uint)
{
uint c = _a + _b;
assert(c >= _a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint _a, uint _b)
internal
pure
returns (uint)
{
uint c = _a + _b;
assert(c >= _a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
999,
1176
]
} | 6,276 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | Ownable | contract Ownable {
address public owner;
/**
* Events
*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Constructor
* Sets the original `owner` of the contract to the sender account.
*/
function Ownable() public {
owner = msg.sender;
OwnershipTransferred(0, owner);
}
/**
* @dev Allows the current owner to transfer control of the contract to a new owner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner)
public
onlyOwner
{
require(_newOwner != 0);
OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | Ownable | function Ownable() public {
owner = msg.sender;
OwnershipTransferred(0, owner);
}
| /**
* @dev Constructor
* Sets the original `owner` of the contract to the sender account.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
465,
574
]
} | 6,277 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | Ownable | contract Ownable {
address public owner;
/**
* Events
*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Constructor
* Sets the original `owner` of the contract to the sender account.
*/
function Ownable() public {
owner = msg.sender;
OwnershipTransferred(0, owner);
}
/**
* @dev Allows the current owner to transfer control of the contract to a new owner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner)
public
onlyOwner
{
require(_newOwner != 0);
OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
} | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address _newOwner)
public
onlyOwner
{
require(_newOwner != 0);
OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a new owner.
* @param _newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
748,
960
]
} | 6,278 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | changeTokenInformation | function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
| /**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
968,
1182
]
} | 6,279 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_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.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1354,
1704
]
} | 6,280 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
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 The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1972,
2404
]
} | 6,281 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| /**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
3064,
3290
]
} | 6,282 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
3749,
4089
]
} | 6,283 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | decreaseApproval | function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
4553,
5074
]
} | 6,284 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | StandardToken | contract StandardToken is Ownable {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) internal allowed;
/**
* Events
*/
event ChangeTokenInformation(string name, string symbol);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function changeTokenInformation(string _name, string _symbol)
public
onlyOwner
{
name = _name;
symbol = _symbol;
ChangeTokenInformation(_name, _symbol);
}
/**
* @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, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
require(_to != 0);
require(_value > 0);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
returns (bool)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
returns (bool)
{
require(_addedValue > 0);
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
returns (bool)
{
require(_subtractedValue > 0);
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
} | /**
* @title Standard ERC20 token
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender)
public
view
returns (uint)
{
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner The address which owns the funds.
* @param _spender The address which will spend the funds.
* @return A uint specifying the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
5391,
5559
]
} | 6,285 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | freezeTransfer | function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
| /**
* Disallow to transfer token from an address to other address
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
345,
480
]
} | 6,286 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | unfreezeTransfer | function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
| /**
* Allow to transfer token from an address to other address
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
566,
704
]
} | 6,287 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
| /**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
876,
1044
]
} | 6,288 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
| /**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1312,
1510
]
} | 6,289 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
| /**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
2170,
2346
]
} | 6,290 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
| /**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
2805,
3009
]
} | 6,291 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | PausableToken | contract PausableToken is StandardToken {
bool public isTradable = true;
/**
* Events
*/
event FreezeTransfer();
event UnfreezeTransfer();
modifier canTransfer() {
require(isTradable);
_;
}
/**
* Disallow to transfer token from an address to other address
*/
function freezeTransfer()
public
onlyOwner
{
isTradable = false;
FreezeTransfer();
}
/**
* Allow to transfer token from an address to other address
*/
function unfreezeTransfer()
public
onlyOwner
{
isTradable = true;
UnfreezeTransfer();
}
/**
* @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, uint _value)
public
canTransfer
returns (bool)
{
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from The address which you want to send tokens from
* @param _to The address which you want to transfer to
* @param _value The amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value)
public
canTransfer
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
/**
* @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 condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value)
public
canTransfer
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue)
public
canTransfer
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
/**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
} | /**
* @title Pausable token
* @dev Token that can be freeze "Transfer" function
*/ | NatSpecMultiLine | decreaseApproval | function decreaseApproval(address _spender, uint _subtractedValue)
public
canTransfer
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
| /**
* @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)
*
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
3473,
3687
]
} | 6,292 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | changeUpgradeMaster | function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
| /**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
862,
1080
]
} | 6,293 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | changeUpgradeAgent | function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
| /**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1179,
1461
]
} | 6,294 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | freezeUpgrade | function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
| /**
* Disallow to upgrade token to new smart contract
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1538,
1673
]
} | 6,295 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | unfreezeUpgrade | function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
| /**
* Allow to upgrade token to new smart contract
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1747,
1885
]
} | 6,296 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | upgrade | function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
| /**
* Token holder upgrade their tokens to a new smart contract.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
1973,
2171
]
} | 6,297 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | UpgradableToken | contract UpgradableToken is StandardToken {
address public upgradeMaster;
// The next contract where the tokens will be migrated.
UpgradeAgent public upgradeAgent;
bool public isUpgradable = false;
// How many tokens we have upgraded by now.
uint public totalUpgraded;
/**
* Events
*/
event ChangeUpgradeMaster(address newMaster);
event ChangeUpgradeAgent(address newAgent);
event FreezeUpgrade();
event UnfreezeUpgrade();
event Upgrade(address indexed from, address indexed to, uint value);
modifier onlyUpgradeMaster() {
require(msg.sender == upgradeMaster);
_;
}
modifier canUpgrade() {
require(isUpgradable);
_;
}
/**
* Change the upgrade master.
* @param _newMaster New upgrade master.
*/
function changeUpgradeMaster(address _newMaster)
public
onlyOwner
{
require(_newMaster != 0);
upgradeMaster = _newMaster;
ChangeUpgradeMaster(_newMaster);
}
/**
* Change the upgrade agent.
* @param _newAgent New upgrade agent.
*/
function changeUpgradeAgent(address _newAgent)
public
onlyOwner
{
require(totalUpgraded == 0);
upgradeAgent = UpgradeAgent(_newAgent);
require(upgradeAgent.isUpgradeAgent());
ChangeUpgradeAgent(_newAgent);
}
/**
* Disallow to upgrade token to new smart contract
*/
function freezeUpgrade()
public
onlyOwner
{
isUpgradable = false;
FreezeUpgrade();
}
/**
* Allow to upgrade token to new smart contract
*/
function unfreezeUpgrade()
public
onlyOwner
{
isUpgradable = true;
UnfreezeUpgrade();
}
/**
* Token holder upgrade their tokens to a new smart contract.
*/
function upgrade()
public
canUpgrade
{
uint amount = balanceOf[msg.sender];
require(amount > 0);
processUpgrade(msg.sender, amount);
}
/**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/
function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
function processUpgrade(address _holder, uint _amount)
private
{
balanceOf[_holder] = balanceOf[_holder].sub(_amount);
// Take tokens out from circulation
totalSupply = totalSupply.sub(_amount);
totalUpgraded = totalUpgraded.add(_amount);
// Upgrade agent reissues the tokens
upgradeAgent.upgradeFrom(_holder, _amount);
Upgrade(_holder, upgradeAgent, _amount);
}
} | /**
* @title Upgradable token
*/ | NatSpecMultiLine | forceUpgrade | function forceUpgrade(address[] _holders)
public
onlyUpgradeMaster
canUpgrade
{
uint amount;
for (uint i = 0; i < _holders.length; i++) {
amount = balanceOf[_holders[i]];
if (amount == 0) {
continue;
}
processUpgrade(_holders[i], amount);
}
}
| /**
* Upgrader upgrade tokens of holder to a new smart contract.
* @param _holders List of token holder.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
2305,
2691
]
} | 6,298 |
|
QNTU | QNTU.sol | 0x4234f63b1d202f6c016ca3b6a0d41d7d85f17716 | Solidity | QNTU | contract QNTU is UpgradableToken, PausableToken {
/**
* @dev Constructor
*/
function QNTU(address[] _wallets, uint[] _amount)
public
{
require(_wallets.length == _amount.length);
symbol = "QNTU";
name = "QNTU Token";
decimals = 18;
uint num = 0;
uint length = _wallets.length;
uint multiplier = 10 ** uint(decimals);
for (uint i = 0; i < length; i++) {
num = _amount[i] * multiplier;
balanceOf[_wallets[i]] = num;
Transfer(0, _wallets[i], num);
totalSupply += num;
}
}
/**
* @dev Transfer token for a specified contract
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transferToContract(address _to, uint _value)
public
canTransfer
returns (bool)
{
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ReceivingContract receiver = ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value);
Transfer(msg.sender, _to, _value);
return true;
}
} | /**
* @title QNTU 1.0 token
*/ | NatSpecMultiLine | QNTU | function QNTU(address[] _wallets, uint[] _amount)
public
{
require(_wallets.length == _amount.length);
symbol = "QNTU";
name = "QNTU Token";
decimals = 18;
uint num = 0;
uint length = _wallets.length;
uint multiplier = 10 ** uint(decimals);
for (uint i = 0; i < length; i++) {
num = _amount[i] * multiplier;
balanceOf[_wallets[i]] = num;
Transfer(0, _wallets[i], num);
totalSupply += num;
}
}
| /**
* @dev Constructor
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://7b2322c984aba8e3e0ec830a52d277a41c06b6784a66d81856018224b990ea68 | {
"func_code_index": [
96,
655
]
} | 6,299 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.