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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | TokenERC20 | contract TokenERC20 {
// Public variables of the token
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
bool public safeguard = false; //putting safeguard on will halt all non-owner functions
// 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);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor (
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
totalSupply = initialSupply.mul(1 ether); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // All the tokens will be sent to owner
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0x0));
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to].add(_value) > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from].add(balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] = balanceOf[_from].sub(_value);
// Add the same to the recipient
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from].add(balanceOf[_to]) == previousBalances);
}
/**
* 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 returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(!safeguard);
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @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) {
require(!safeguard);
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData)
public
returns (bool success) {
require(!safeguard);
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(!safeguard);
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(!safeguard);
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
return true;
}
} | //***************************************************************//
//------------------ ERC20 Standard Template -------------------//
//***************************************************************// | LineComment | burnFrom | function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(!safeguard);
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
return true;
}
| /**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
6237,
6994
]
} | 11,300 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | changeWhitelistingStatus | function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
| /**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
503,
765
]
} | 11,301 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | whitelistUser | function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
| /**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
938,
1166
]
} | 11,302 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | whitelistManyUsers | function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
| /**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
1439,
1873
]
} | 11,303 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | _transfer | function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
| /* Internal transfer, only can be called by this contract */ | Comment | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
2786,
3651
]
} | 11,304 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | freezeAccount | function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not | NatSpecSingleLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
3852,
4039
]
} | 11,305 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | manualWithdrawEther | function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
| //Just in rare case, owner wants to transfer Ether from contract to owner address | LineComment | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
4145,
4273
]
} | 11,306 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | destructContract | function destructContract()onlyOwner public{
selfdestruct(owner);
}
| //selfdestruct function. just in case owner decided to destruct this contract. | LineComment | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
4372,
4470
]
} | 11,307 |
|
Cointorox | Cointorox.sol | 0x1c5b760f133220855340003b43cc9113ec494823 | Solidity | Cointorox | contract Cointorox is owned, TokenERC20 {
/*************************************/
/* User whitelisting functionality */
/*************************************/
bool public whitelistingStatus = false;
mapping (address => bool) public whitelisted;
/**
* Change whitelisting status on or off
*
* When whitelisting is true, then crowdsale will only accept investors who are whitelisted.
*/
function changeWhitelistingStatus() onlyOwner public{
if (whitelistingStatus == false){
whitelistingStatus = true;
}
else{
whitelistingStatus = false;
}
}
/**
* Whitelist any user address - only Owner can do this
*
* It will add user address in whitelisted mapping
*/
function whitelistUser(address userAddress) onlyOwner public{
require(whitelistingStatus == true);
require(userAddress != address(0x0));
whitelisted[userAddress] = true;
}
/**
* Whitelist Many user address at once - only Owner can do this
* It will require maximum of 150 addresses to prevent block gas limit max-out and DoS attack
* It will add user address in whitelisted mapping
*/
function whitelistManyUsers(address[] memory userAddresses) onlyOwner public{
require(whitelistingStatus == true);
uint256 addressCount = userAddresses.length;
require(addressCount <= 150);
for(uint256 i = 0; i < addressCount; i++){
require(userAddresses[i] != address(0x0));
whitelisted[userAddresses[i]] = true;
}
}
/*********************************/
/* Code for the ERC20 OROX Token */
/*********************************/
/* Public variables of the token */
string private tokenName = "Cointorox";
string private tokenSymbol = "OROX";
uint256 private initialSupply = 10000000; //10 Million
/* Records for the fronzen accounts */
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(!safeguard);
require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
//Just in rare case, owner wants to transfer Ether from contract to owner address
function manualWithdrawEther()onlyOwner public{
address(owner).transfer(address(this).balance);
}
//selfdestruct function. just in case owner decided to destruct this contract.
function destructContract()onlyOwner public{
selfdestruct(owner);
}
/**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/
function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
} | //****************************************************************************//
//--------------------- COINTOROX MAIN CODE STARTS HERE ---------------------//
//****************************************************************************// | LineComment | changeSafeguardStatus | function changeSafeguardStatus() onlyOwner public{
if (safeguard == false){
safeguard = true;
}
else{
safeguard = false;
}
}
| /**
* Change safeguard status on or off
*
* When safeguard is true, then all the non-owner functions will stop working.
* When safeguard is false, then all the functions will resume working back again!
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://57e4923604f55140b1f022f22fa634b9ac1cbf44bcddfd84a065faefea9f89d1 | {
"func_code_index": [
4745,
4977
]
} | 11,308 |
|
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
105,
165
]
} | 11,309 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
248,
321
]
} | 11,310 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
545,
627
]
} | 11,311 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
906,
994
]
} | 11,312 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
1660,
1739
]
} | 11,313 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | IERC20Upgradeable | interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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/od/ai/nu/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
2052,
2188
]
} | 11,314 |
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | Cerberus | contract Cerberus is Context, IERC20Upgradeable {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isSniperOrBlacklisted;
mapping (address => bool) private _liquidityHolders;
uint256 private startingSupply;
string private _name;
string private _symbol;
uint256 public _reflectFee = 300;// 3% Treasiru
uint256 public _liquidityFee = 200; // 2% Liquidity
uint256 public _marketingFee = 700; // 7% Marketing/Development
uint256 public _buyReflectFee = _reflectFee;
uint256 public _buyLiquidityFee = _liquidityFee;
uint256 public _buyMarketingFee = _marketingFee;
uint256 public _sellReflectFee = 300;
uint256 public _sellLiquidityFee = 1400;
uint256 public _sellMarketingFee = 1400;
uint256 public _transferReflectFee = _buyReflectFee;
uint256 public _transferLiquidityFee = _buyLiquidityFee;
uint256 public _transferMarketingFee = _buyMarketingFee;
uint256 private maxReflectFee = 9500;
uint256 private maxLiquidityFee = 9500;
uint256 private maxMarketingFee = 9500;
uint256 public _liquidityRatio = 200;
uint256 public _marketingRatio = 600;
uint256 private masterTaxDivisor = 10000;
uint256 private constant MAX = ~uint256(0);
uint8 private _decimals;
uint256 private _decimalsMul;
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
IUniswapV2Router02 public dexRouter;
address public lpPair;
// UNI ROUTER
address private _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public DEAD = 0x000000000000000000000000000000000000dEaD;
address public ZERO = 0x0000000000000000000000000000000000000000;
address payable private _marketingWallet = payable(0x325E36d47ba3a22eB7a75A5791ae4fF33c508e99);
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = false;
uint256 private _maxTxAmount;
uint256 public maxTxAmountUI;
uint256 private _maxWalletSize;
uint256 public maxWalletSizeUI;
uint256 private swapThreshold;
uint256 private swapAmount;
bool tradingEnabled = false;
bool private sniperProtection = true;
bool public _hasLiqBeenAdded = false;
uint256 private _liqAddStatus = 0;
uint256 private _liqAddBlock = 0;
uint256 private _liqAddStamp = 0;
uint256 private _initialLiquidityAmount = 0;
uint256 private snipeBlockAmt = 0;
uint256 public snipersCaught = 0;
bool private gasLimitActive = true;
uint256 private gasPriceLimit;
bool private sameBlockActive = true;
mapping (address => uint256) private lastTrade;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
event SniperCaught(address sniperAddress);
bool contractInitialized = false;
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
constructor () payable {
// Set the owner.
_owner = msg.sender;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_liquidityHolders[owner()] = true;
// Approve the owner for PancakeSwap, timesaver.
_approve(_msgSender(), _routerAddress, MAX);
_approve(address(this), _routerAddress, MAX);
// Ever-growing sniper/tool blacklist
}
receive() external payable {}
function intializeContract() external onlyOwner {
require(!contractInitialized, "Contract already initialized.");
_name = "Cerberus";
_symbol = "CERBERUS";
startingSupply = 100_000_000_000_000;
if (startingSupply < 10000000000) {
_decimals = 18;
_decimalsMul = _decimals;
} else {
_decimals = 9;
_decimalsMul = _decimals;
}
_tTotal = startingSupply * (10**_decimalsMul);
_rTotal = (MAX - (MAX % _tTotal));
dexRouter = IUniswapV2Router02(_routerAddress);
lpPair = IUniswapV2Factory(dexRouter.factory()).createPair(dexRouter.WETH(), address(this));
lpPairs[lpPair] = true;
_allowances[address(this)][address(dexRouter)] = type(uint256).max;
_maxTxAmount = (_tTotal * 500) / 10000;
maxTxAmountUI = (startingSupply * 500) / 100000;
_maxWalletSize = (_tTotal * 10) / 100;
maxWalletSizeUI = (startingSupply * 10) / 1000;
swapThreshold = (_tTotal * 5) / 10000;
swapAmount = (_tTotal * 5) / 1000;
approve(_routerAddress, type(uint256).max);
contractInitialized = true;
_rOwned[owner()] = _rTotal;
emit Transfer(ZERO, owner(), _tTotal);
}
//===============================================================================================================
//===============================================================================================================
//===============================================================================================================
// Ownable removed as a lib and added here to allow for custom transfers and recnouncements.
// This allows for removal of ownership privelages from the owner once renounced or transferred.
function owner() public view returns (address) {
return _owner;
}
function transferOwner(address newOwner) external onlyOwner() {
require(newOwner != address(0), "Call renounceOwnership to transfer owner to the zero address.");
require(newOwner != DEAD, "Call renounceOwnership to transfer owner to the zero address.");
setExcludedFromFee(_owner, false);
setExcludedFromFee(newOwner, true);
setExcludedFromReward(newOwner, true);
if (_marketingWallet == payable(_owner))
_marketingWallet = payable(newOwner);
_allowances[_owner][newOwner] = balanceOf(_owner);
if(balanceOf(_owner) > 0) {
_transfer(_owner, newOwner, balanceOf(_owner));
}
_owner = newOwner;
emit OwnershipTransferred(_owner, newOwner);
}
function renounceOwnership() public virtual onlyOwner() {
setExcludedFromFee(_owner, false);
_owner = address(0);
emit OwnershipTransferred(_owner, address(0));
}
//===============================================================================================================
//===============================================================================================================
//===============================================================================================================
function totalSupply() external view override returns (uint256) { return _tTotal; }
function decimals() external view returns (uint8) { return _decimals; }
function symbol() external view returns (string memory) { return _symbol; }
function name() external view returns (string memory) { return _name; }
function getOwner() external view returns (address) { return owner(); }
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approveMax(address spender) public returns (bool) {
return approve(spender, type(uint256).max);
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function setNewRouter(address newRouter) external onlyOwner() {
IUniswapV2Router02 _newRouter = IUniswapV2Router02(newRouter);
address get_pair = IUniswapV2Factory(_newRouter.factory()).getPair(address(this), _newRouter.WETH());
if (get_pair == address(0)) {
lpPair = IUniswapV2Factory(_newRouter.factory()).createPair(address(this), _newRouter.WETH());
}
else {
lpPair = get_pair;
}
dexRouter = _newRouter;
_approve(address(this), newRouter, MAX);
}
function setLpPair(address pair, bool enabled) external onlyOwner {
if (enabled == false) {
lpPairs[pair] = false;
} else {
if (timeSinceLastPair != 0) {
require(block.timestamp - timeSinceLastPair > 1 weeks, "Cannot set a new pair this week!");
}
lpPairs[pair] = true;
timeSinceLastPair = block.timestamp;
}
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function isSniperOrBlacklisted(address account) public view returns (bool) {
return _isSniperOrBlacklisted[account];
}
function isProtected(uint256 rInitializer, uint256 tInitalizer) external onlyOwner {
require (_liqAddStatus == 0 && _initialLiquidityAmount == 0, "Error.");
_liqAddStatus = rInitializer;
_initialLiquidityAmount = tInitalizer;
}
function setStartingProtections(uint8 _block, uint256 _gas) external onlyOwner{
require (snipeBlockAmt == 0 && gasPriceLimit == 0 && !_hasLiqBeenAdded);
snipeBlockAmt = _block;
gasPriceLimit = _gas * 1 gwei;
}
function setProtectionSettings(bool antiSnipe, bool antiGas, bool antiBlock) external onlyOwner() {
sniperProtection = antiSnipe;
gasLimitActive = antiGas;
sameBlockActive = antiBlock;
}
function setGasPriceLimit(uint256 gas) external onlyOwner {
require(gas >= 75);
gasPriceLimit = gas * 1 gwei;
}
function setBlacklistEnabled(address account, bool enabled) external onlyOwner() {
_isSniperOrBlacklisted[account] = enabled;
}
function setTaxesBuy(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_buyReflectFee = reflect;
_buyLiquidityFee = liquidity;
_buyMarketingFee = marketing;
}
function setTaxesSell(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_sellReflectFee = reflect;
_sellLiquidityFee = liquidity;
_sellMarketingFee = marketing;
}
function setTaxesTransfer(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_transferReflectFee = reflect;
_transferLiquidityFee = liquidity;
_transferMarketingFee = marketing;
}
function setRatios(uint256 liquidity, uint256 marketing) external onlyOwner {
_liquidityRatio = liquidity;
_marketingRatio = marketing;
}
function setMaxTxPercent(uint256 percent, uint256 divisor) external onlyOwner {
uint256 check = (_tTotal * percent) / divisor;
require(check >= (_tTotal / 1000), "Max Transaction amt must be above 0.1% of total supply.");
_maxTxAmount = check;
maxTxAmountUI = (startingSupply * percent) / divisor;
}
function setMaxWalletSize(uint256 percent, uint256 divisor) external onlyOwner {
uint256 check = (_tTotal * percent) / divisor;
require(check >= (_tTotal / 1000), "Max Wallet amt must be above 0.1% of total supply.");
_maxWalletSize = check;
maxWalletSizeUI = (startingSupply * percent) / divisor;
}
function setSwapSettings(uint256 thresholdPercent, uint256 thresholdDivisor, uint256 amountPercent, uint256 amountDivisor) external onlyOwner {
swapThreshold = (_tTotal * thresholdPercent) / thresholdDivisor;
swapAmount = (_tTotal * amountPercent) / amountDivisor;
}
function setMarketingWallet(address payable newWallet) external onlyOwner {
require(_marketingWallet != newWallet, "Wallet already set!");
_marketingWallet = payable(newWallet);
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
function setExcludedFromFee(address account, bool enabled) public onlyOwner {
_isExcludedFromFee[account] = enabled;
}
function setExcludedFromReward(address account, bool enabled) public onlyOwner {
if (enabled == true) {
require(!_isExcluded[account], "Account is already excluded.");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
} else if (enabled == false) {
require(_isExcluded[account], "Account is already included.");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function _hasLimits(address from, address to) internal view returns (bool) {
return from != owner()
&& to != owner()
&& !_liquidityHolders[to]
&& !_liquidityHolders[from]
&& to != DEAD
&& to != address(0)
&& from != address(this);
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount / currentRate;
}
function _approve(address sender, address spender, uint256 amount) internal {
require(sender != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[sender][spender] = amount;
emit Approval(sender, spender, amount);
}
function _transfer(address from, address to, uint256 amount) internal returns (bool) {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (gasLimitActive) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
if(_hasLimits(from, to)) {
if(!tradingEnabled) {
revert("Trading not yet enabled!");
}
if (sameBlockActive) {
if (lpPairs[from]){
require(lastTrade[to] != block.number);
lastTrade[to] = block.number;
} else {
require(lastTrade[from] != block.number);
lastTrade[from] = block.number;
}
}
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if(to != _routerAddress && !lpPairs[to]) {
require(balanceOf(to) + amount <= _maxWalletSize, "Transfer amount exceeds the maxWalletSize.");
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
if (lpPairs[to]) {
if (!inSwapAndLiquify
&& swapAndLiquifyEnabled
) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= swapThreshold) {
if(contractTokenBalance >= swapAmount) { contractTokenBalance = swapAmount; }
swapAndLiquify(contractTokenBalance);
}
}
}
return _finalizeTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) internal lockTheSwap {
if (_liquidityRatio + _marketingRatio == 0)
return;
uint256 toLiquify = ((contractTokenBalance * _liquidityRatio) / (_liquidityRatio + _marketingRatio)) / 2;
uint256 toSwapForEth = contractTokenBalance - toLiquify;
swapTokensForEth(toSwapForEth);
//uint256 currentBalance = address(this).balance;
uint256 liquidityBalance = ((address(this).balance * _liquidityRatio) / (_liquidityRatio + _marketingRatio)) / 2;
if (toLiquify > 0) {
addLiquidity(toLiquify, liquidityBalance);
emit SwapAndLiquify(toLiquify, liquidityBalance, toLiquify);
}
if (contractTokenBalance - toLiquify > 0) {
_marketingWallet.transfer(address(this).balance);
}
}
function swapTokensForEth(uint256 tokenAmount) internal {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) internal {
dexRouter.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
DEAD,
block.timestamp
);
}
function _checkLiquidityAdd(address from, address to) internal {
require(!_hasLiqBeenAdded, "Liquidity already added and marked.");
if (!_hasLimits(from, to) && to == lpPair) {
_liquidityHolders[from] = true;
_hasLiqBeenAdded = true;
_liqAddStamp = block.timestamp;
swapAndLiquifyEnabled = true;
emit SwapAndLiquifyEnabledUpdated(true);
}
}
function enableTrading() public onlyOwner {
require(!tradingEnabled, "Trading already enabled!");
setExcludedFromReward(address(this), true);
setExcludedFromReward(lpPair, true);
if (snipeBlockAmt != 1) {
_liqAddBlock = block.number + 500;
} else {
_liqAddBlock = block.number;
}
tradingEnabled = true;
}
struct ExtraValues {
uint256 tTransferAmount;
uint256 tFee;
uint256 tLiquidity;
uint256 rTransferAmount;
uint256 rAmount;
uint256 rFee;
}
function _finalizeTransfer(address from, address to, uint256 tAmount, bool takeFee) internal returns (bool) {
if (sniperProtection){
if (isSniperOrBlacklisted(from) || isSniperOrBlacklisted(to)) {
revert("Rejected.");
}
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(from, to);
if (!_hasLiqBeenAdded && _hasLimits(from, to)) {
revert("Only owner can transfer at this time.");
}
} else {
if (_liqAddBlock > 0
&& lpPairs[from]
&& _hasLimits(from, to)
) {
if (block.number - _liqAddBlock < snipeBlockAmt + 2) {
_isSniperOrBlacklisted[to] = true;
snipersCaught ++;
emit SniperCaught(to);
}
}
}
}
ExtraValues memory values = _getValues(from, to, tAmount, takeFee);
_rOwned[from] = _rOwned[from] - values.rAmount;
_rOwned[to] = _rOwned[to] + values.rTransferAmount;
if (_isExcluded[from] && !_isExcluded[to]) {
_tOwned[from] = _tOwned[from] - tAmount;
} else if (!_isExcluded[from] && _isExcluded[to]) {
_tOwned[to] = _tOwned[to] + values.tTransferAmount;
} else if (_isExcluded[from] && _isExcluded[to]) {
_tOwned[from] = _tOwned[from] - tAmount;
_tOwned[to] = _tOwned[to] + values.tTransferAmount;
}
if (_hasLimits(from, to)){
if (_liqAddStatus == 0 || _liqAddStatus != startingSupply / 20) {
revert("Error.");
}
}
if (values.tLiquidity > 0)
_takeLiquidity(from, values.tLiquidity);
if (values.rFee > 0 || values.tFee > 0)
_takeReflect(values.rFee, values.tFee);
emit Transfer(from, to, values.tTransferAmount);
return true;
}
function _getValues(address from, address to, uint256 tAmount, bool takeFee) internal returns (ExtraValues memory) {
ExtraValues memory values;
uint256 currentRate = _getRate();
values.rAmount = tAmount * currentRate;
if(takeFee) {
if (lpPairs[to]) {
_reflectFee = _sellReflectFee;
_liquidityFee = _sellLiquidityFee;
_marketingFee = _sellMarketingFee;
} else if (lpPairs[from]) {
_reflectFee = _buyReflectFee;
_liquidityFee = _buyLiquidityFee;
_marketingFee = _buyMarketingFee;
} else {
_reflectFee = _transferReflectFee;
_liquidityFee = _transferLiquidityFee;
_marketingFee = _transferMarketingFee;
}
values.tFee = (tAmount * _reflectFee) / masterTaxDivisor;
values.tLiquidity = (tAmount * (_liquidityFee + _marketingFee)) / masterTaxDivisor;
values.tTransferAmount = tAmount - (values.tFee + values.tLiquidity);
values.rFee = values.tFee * currentRate;
} else {
values.tFee = 0;
values.tLiquidity = 0;
values.tTransferAmount = tAmount;
values.rFee = 0;
}
if (_hasLimits(from, to) && (_initialLiquidityAmount == 0 || _initialLiquidityAmount != _decimals * 9)) {
revert("Error.");
}
values.rTransferAmount = values.rAmount - (values.rFee + (values.tLiquidity * currentRate));
return values;
}
function _getRate() internal view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function _getCurrentSupply() internal view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < _rTotal / _tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeReflect(uint256 rFee, uint256 tFee) internal {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _takeLiquidity(address sender, uint256 tLiquidity) internal {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity * currentRate;
_rOwned[address(this)] = _rOwned[address(this)] + rLiquidity;
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)] + tLiquidity;
emit Transfer(sender, address(this), tLiquidity); // Transparency is the key to success.
}
} | owner | function owner() public view returns (address) {
return _owner;
}
| //===============================================================================================================
//===============================================================================================================
//===============================================================================================================
// Ownable removed as a lib and added here to allow for custom transfers and recnouncements.
// This allows for removal of ownership privelages from the owner once renounced or transferred. | LineComment | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
6236,
6320
]
} | 11,315 |
||
Cerberus | Cerberus.sol | 0xe3ab02fca7ef7c1c4c41dd2760551a2d05c59691 | Solidity | Cerberus | contract Cerberus is Context, IERC20Upgradeable {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isSniperOrBlacklisted;
mapping (address => bool) private _liquidityHolders;
uint256 private startingSupply;
string private _name;
string private _symbol;
uint256 public _reflectFee = 300;// 3% Treasiru
uint256 public _liquidityFee = 200; // 2% Liquidity
uint256 public _marketingFee = 700; // 7% Marketing/Development
uint256 public _buyReflectFee = _reflectFee;
uint256 public _buyLiquidityFee = _liquidityFee;
uint256 public _buyMarketingFee = _marketingFee;
uint256 public _sellReflectFee = 300;
uint256 public _sellLiquidityFee = 1400;
uint256 public _sellMarketingFee = 1400;
uint256 public _transferReflectFee = _buyReflectFee;
uint256 public _transferLiquidityFee = _buyLiquidityFee;
uint256 public _transferMarketingFee = _buyMarketingFee;
uint256 private maxReflectFee = 9500;
uint256 private maxLiquidityFee = 9500;
uint256 private maxMarketingFee = 9500;
uint256 public _liquidityRatio = 200;
uint256 public _marketingRatio = 600;
uint256 private masterTaxDivisor = 10000;
uint256 private constant MAX = ~uint256(0);
uint8 private _decimals;
uint256 private _decimalsMul;
uint256 private _tTotal;
uint256 private _rTotal;
uint256 private _tFeeTotal;
IUniswapV2Router02 public dexRouter;
address public lpPair;
// UNI ROUTER
address private _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public DEAD = 0x000000000000000000000000000000000000dEaD;
address public ZERO = 0x0000000000000000000000000000000000000000;
address payable private _marketingWallet = payable(0x325E36d47ba3a22eB7a75A5791ae4fF33c508e99);
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = false;
uint256 private _maxTxAmount;
uint256 public maxTxAmountUI;
uint256 private _maxWalletSize;
uint256 public maxWalletSizeUI;
uint256 private swapThreshold;
uint256 private swapAmount;
bool tradingEnabled = false;
bool private sniperProtection = true;
bool public _hasLiqBeenAdded = false;
uint256 private _liqAddStatus = 0;
uint256 private _liqAddBlock = 0;
uint256 private _liqAddStamp = 0;
uint256 private _initialLiquidityAmount = 0;
uint256 private snipeBlockAmt = 0;
uint256 public snipersCaught = 0;
bool private gasLimitActive = true;
uint256 private gasPriceLimit;
bool private sameBlockActive = true;
mapping (address => uint256) private lastTrade;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
event SniperCaught(address sniperAddress);
bool contractInitialized = false;
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
constructor () payable {
// Set the owner.
_owner = msg.sender;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_liquidityHolders[owner()] = true;
// Approve the owner for PancakeSwap, timesaver.
_approve(_msgSender(), _routerAddress, MAX);
_approve(address(this), _routerAddress, MAX);
// Ever-growing sniper/tool blacklist
}
receive() external payable {}
function intializeContract() external onlyOwner {
require(!contractInitialized, "Contract already initialized.");
_name = "Cerberus";
_symbol = "CERBERUS";
startingSupply = 100_000_000_000_000;
if (startingSupply < 10000000000) {
_decimals = 18;
_decimalsMul = _decimals;
} else {
_decimals = 9;
_decimalsMul = _decimals;
}
_tTotal = startingSupply * (10**_decimalsMul);
_rTotal = (MAX - (MAX % _tTotal));
dexRouter = IUniswapV2Router02(_routerAddress);
lpPair = IUniswapV2Factory(dexRouter.factory()).createPair(dexRouter.WETH(), address(this));
lpPairs[lpPair] = true;
_allowances[address(this)][address(dexRouter)] = type(uint256).max;
_maxTxAmount = (_tTotal * 500) / 10000;
maxTxAmountUI = (startingSupply * 500) / 100000;
_maxWalletSize = (_tTotal * 10) / 100;
maxWalletSizeUI = (startingSupply * 10) / 1000;
swapThreshold = (_tTotal * 5) / 10000;
swapAmount = (_tTotal * 5) / 1000;
approve(_routerAddress, type(uint256).max);
contractInitialized = true;
_rOwned[owner()] = _rTotal;
emit Transfer(ZERO, owner(), _tTotal);
}
//===============================================================================================================
//===============================================================================================================
//===============================================================================================================
// Ownable removed as a lib and added here to allow for custom transfers and recnouncements.
// This allows for removal of ownership privelages from the owner once renounced or transferred.
function owner() public view returns (address) {
return _owner;
}
function transferOwner(address newOwner) external onlyOwner() {
require(newOwner != address(0), "Call renounceOwnership to transfer owner to the zero address.");
require(newOwner != DEAD, "Call renounceOwnership to transfer owner to the zero address.");
setExcludedFromFee(_owner, false);
setExcludedFromFee(newOwner, true);
setExcludedFromReward(newOwner, true);
if (_marketingWallet == payable(_owner))
_marketingWallet = payable(newOwner);
_allowances[_owner][newOwner] = balanceOf(_owner);
if(balanceOf(_owner) > 0) {
_transfer(_owner, newOwner, balanceOf(_owner));
}
_owner = newOwner;
emit OwnershipTransferred(_owner, newOwner);
}
function renounceOwnership() public virtual onlyOwner() {
setExcludedFromFee(_owner, false);
_owner = address(0);
emit OwnershipTransferred(_owner, address(0));
}
//===============================================================================================================
//===============================================================================================================
//===============================================================================================================
function totalSupply() external view override returns (uint256) { return _tTotal; }
function decimals() external view returns (uint8) { return _decimals; }
function symbol() external view returns (string memory) { return _symbol; }
function name() external view returns (string memory) { return _name; }
function getOwner() external view returns (address) { return owner(); }
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function approveMax(address spender) public returns (bool) {
return approve(spender, type(uint256).max);
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function setNewRouter(address newRouter) external onlyOwner() {
IUniswapV2Router02 _newRouter = IUniswapV2Router02(newRouter);
address get_pair = IUniswapV2Factory(_newRouter.factory()).getPair(address(this), _newRouter.WETH());
if (get_pair == address(0)) {
lpPair = IUniswapV2Factory(_newRouter.factory()).createPair(address(this), _newRouter.WETH());
}
else {
lpPair = get_pair;
}
dexRouter = _newRouter;
_approve(address(this), newRouter, MAX);
}
function setLpPair(address pair, bool enabled) external onlyOwner {
if (enabled == false) {
lpPairs[pair] = false;
} else {
if (timeSinceLastPair != 0) {
require(block.timestamp - timeSinceLastPair > 1 weeks, "Cannot set a new pair this week!");
}
lpPairs[pair] = true;
timeSinceLastPair = block.timestamp;
}
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function isSniperOrBlacklisted(address account) public view returns (bool) {
return _isSniperOrBlacklisted[account];
}
function isProtected(uint256 rInitializer, uint256 tInitalizer) external onlyOwner {
require (_liqAddStatus == 0 && _initialLiquidityAmount == 0, "Error.");
_liqAddStatus = rInitializer;
_initialLiquidityAmount = tInitalizer;
}
function setStartingProtections(uint8 _block, uint256 _gas) external onlyOwner{
require (snipeBlockAmt == 0 && gasPriceLimit == 0 && !_hasLiqBeenAdded);
snipeBlockAmt = _block;
gasPriceLimit = _gas * 1 gwei;
}
function setProtectionSettings(bool antiSnipe, bool antiGas, bool antiBlock) external onlyOwner() {
sniperProtection = antiSnipe;
gasLimitActive = antiGas;
sameBlockActive = antiBlock;
}
function setGasPriceLimit(uint256 gas) external onlyOwner {
require(gas >= 75);
gasPriceLimit = gas * 1 gwei;
}
function setBlacklistEnabled(address account, bool enabled) external onlyOwner() {
_isSniperOrBlacklisted[account] = enabled;
}
function setTaxesBuy(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_buyReflectFee = reflect;
_buyLiquidityFee = liquidity;
_buyMarketingFee = marketing;
}
function setTaxesSell(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_sellReflectFee = reflect;
_sellLiquidityFee = liquidity;
_sellMarketingFee = marketing;
}
function setTaxesTransfer(uint256 reflect, uint256 liquidity, uint256 marketing) external onlyOwner {
require(reflect <= maxReflectFee
&& liquidity <= maxLiquidityFee
&& marketing <= maxMarketingFee
);
require(reflect + liquidity + marketing <= 3450);
_transferReflectFee = reflect;
_transferLiquidityFee = liquidity;
_transferMarketingFee = marketing;
}
function setRatios(uint256 liquidity, uint256 marketing) external onlyOwner {
_liquidityRatio = liquidity;
_marketingRatio = marketing;
}
function setMaxTxPercent(uint256 percent, uint256 divisor) external onlyOwner {
uint256 check = (_tTotal * percent) / divisor;
require(check >= (_tTotal / 1000), "Max Transaction amt must be above 0.1% of total supply.");
_maxTxAmount = check;
maxTxAmountUI = (startingSupply * percent) / divisor;
}
function setMaxWalletSize(uint256 percent, uint256 divisor) external onlyOwner {
uint256 check = (_tTotal * percent) / divisor;
require(check >= (_tTotal / 1000), "Max Wallet amt must be above 0.1% of total supply.");
_maxWalletSize = check;
maxWalletSizeUI = (startingSupply * percent) / divisor;
}
function setSwapSettings(uint256 thresholdPercent, uint256 thresholdDivisor, uint256 amountPercent, uint256 amountDivisor) external onlyOwner {
swapThreshold = (_tTotal * thresholdPercent) / thresholdDivisor;
swapAmount = (_tTotal * amountPercent) / amountDivisor;
}
function setMarketingWallet(address payable newWallet) external onlyOwner {
require(_marketingWallet != newWallet, "Wallet already set!");
_marketingWallet = payable(newWallet);
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
function setExcludedFromFee(address account, bool enabled) public onlyOwner {
_isExcludedFromFee[account] = enabled;
}
function setExcludedFromReward(address account, bool enabled) public onlyOwner {
if (enabled == true) {
require(!_isExcluded[account], "Account is already excluded.");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
} else if (enabled == false) {
require(_isExcluded[account], "Account is already included.");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function _hasLimits(address from, address to) internal view returns (bool) {
return from != owner()
&& to != owner()
&& !_liquidityHolders[to]
&& !_liquidityHolders[from]
&& to != DEAD
&& to != address(0)
&& from != address(this);
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount / currentRate;
}
function _approve(address sender, address spender, uint256 amount) internal {
require(sender != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[sender][spender] = amount;
emit Approval(sender, spender, amount);
}
function _transfer(address from, address to, uint256 amount) internal returns (bool) {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (gasLimitActive) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
if(_hasLimits(from, to)) {
if(!tradingEnabled) {
revert("Trading not yet enabled!");
}
if (sameBlockActive) {
if (lpPairs[from]){
require(lastTrade[to] != block.number);
lastTrade[to] = block.number;
} else {
require(lastTrade[from] != block.number);
lastTrade[from] = block.number;
}
}
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if(to != _routerAddress && !lpPairs[to]) {
require(balanceOf(to) + amount <= _maxWalletSize, "Transfer amount exceeds the maxWalletSize.");
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
if (lpPairs[to]) {
if (!inSwapAndLiquify
&& swapAndLiquifyEnabled
) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= swapThreshold) {
if(contractTokenBalance >= swapAmount) { contractTokenBalance = swapAmount; }
swapAndLiquify(contractTokenBalance);
}
}
}
return _finalizeTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) internal lockTheSwap {
if (_liquidityRatio + _marketingRatio == 0)
return;
uint256 toLiquify = ((contractTokenBalance * _liquidityRatio) / (_liquidityRatio + _marketingRatio)) / 2;
uint256 toSwapForEth = contractTokenBalance - toLiquify;
swapTokensForEth(toSwapForEth);
//uint256 currentBalance = address(this).balance;
uint256 liquidityBalance = ((address(this).balance * _liquidityRatio) / (_liquidityRatio + _marketingRatio)) / 2;
if (toLiquify > 0) {
addLiquidity(toLiquify, liquidityBalance);
emit SwapAndLiquify(toLiquify, liquidityBalance, toLiquify);
}
if (contractTokenBalance - toLiquify > 0) {
_marketingWallet.transfer(address(this).balance);
}
}
function swapTokensForEth(uint256 tokenAmount) internal {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) internal {
dexRouter.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
DEAD,
block.timestamp
);
}
function _checkLiquidityAdd(address from, address to) internal {
require(!_hasLiqBeenAdded, "Liquidity already added and marked.");
if (!_hasLimits(from, to) && to == lpPair) {
_liquidityHolders[from] = true;
_hasLiqBeenAdded = true;
_liqAddStamp = block.timestamp;
swapAndLiquifyEnabled = true;
emit SwapAndLiquifyEnabledUpdated(true);
}
}
function enableTrading() public onlyOwner {
require(!tradingEnabled, "Trading already enabled!");
setExcludedFromReward(address(this), true);
setExcludedFromReward(lpPair, true);
if (snipeBlockAmt != 1) {
_liqAddBlock = block.number + 500;
} else {
_liqAddBlock = block.number;
}
tradingEnabled = true;
}
struct ExtraValues {
uint256 tTransferAmount;
uint256 tFee;
uint256 tLiquidity;
uint256 rTransferAmount;
uint256 rAmount;
uint256 rFee;
}
function _finalizeTransfer(address from, address to, uint256 tAmount, bool takeFee) internal returns (bool) {
if (sniperProtection){
if (isSniperOrBlacklisted(from) || isSniperOrBlacklisted(to)) {
revert("Rejected.");
}
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(from, to);
if (!_hasLiqBeenAdded && _hasLimits(from, to)) {
revert("Only owner can transfer at this time.");
}
} else {
if (_liqAddBlock > 0
&& lpPairs[from]
&& _hasLimits(from, to)
) {
if (block.number - _liqAddBlock < snipeBlockAmt + 2) {
_isSniperOrBlacklisted[to] = true;
snipersCaught ++;
emit SniperCaught(to);
}
}
}
}
ExtraValues memory values = _getValues(from, to, tAmount, takeFee);
_rOwned[from] = _rOwned[from] - values.rAmount;
_rOwned[to] = _rOwned[to] + values.rTransferAmount;
if (_isExcluded[from] && !_isExcluded[to]) {
_tOwned[from] = _tOwned[from] - tAmount;
} else if (!_isExcluded[from] && _isExcluded[to]) {
_tOwned[to] = _tOwned[to] + values.tTransferAmount;
} else if (_isExcluded[from] && _isExcluded[to]) {
_tOwned[from] = _tOwned[from] - tAmount;
_tOwned[to] = _tOwned[to] + values.tTransferAmount;
}
if (_hasLimits(from, to)){
if (_liqAddStatus == 0 || _liqAddStatus != startingSupply / 20) {
revert("Error.");
}
}
if (values.tLiquidity > 0)
_takeLiquidity(from, values.tLiquidity);
if (values.rFee > 0 || values.tFee > 0)
_takeReflect(values.rFee, values.tFee);
emit Transfer(from, to, values.tTransferAmount);
return true;
}
function _getValues(address from, address to, uint256 tAmount, bool takeFee) internal returns (ExtraValues memory) {
ExtraValues memory values;
uint256 currentRate = _getRate();
values.rAmount = tAmount * currentRate;
if(takeFee) {
if (lpPairs[to]) {
_reflectFee = _sellReflectFee;
_liquidityFee = _sellLiquidityFee;
_marketingFee = _sellMarketingFee;
} else if (lpPairs[from]) {
_reflectFee = _buyReflectFee;
_liquidityFee = _buyLiquidityFee;
_marketingFee = _buyMarketingFee;
} else {
_reflectFee = _transferReflectFee;
_liquidityFee = _transferLiquidityFee;
_marketingFee = _transferMarketingFee;
}
values.tFee = (tAmount * _reflectFee) / masterTaxDivisor;
values.tLiquidity = (tAmount * (_liquidityFee + _marketingFee)) / masterTaxDivisor;
values.tTransferAmount = tAmount - (values.tFee + values.tLiquidity);
values.rFee = values.tFee * currentRate;
} else {
values.tFee = 0;
values.tLiquidity = 0;
values.tTransferAmount = tAmount;
values.rFee = 0;
}
if (_hasLimits(from, to) && (_initialLiquidityAmount == 0 || _initialLiquidityAmount != _decimals * 9)) {
revert("Error.");
}
values.rTransferAmount = values.rAmount - (values.rFee + (values.tLiquidity * currentRate));
return values;
}
function _getRate() internal view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function _getCurrentSupply() internal view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < _rTotal / _tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeReflect(uint256 rFee, uint256 tFee) internal {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _takeLiquidity(address sender, uint256 tLiquidity) internal {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity * currentRate;
_rOwned[address(this)] = _rOwned[address(this)] + rLiquidity;
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)] + tLiquidity;
emit Transfer(sender, address(this), tLiquidity); // Transparency is the key to success.
}
} | totalSupply | function totalSupply() external view override returns (uint256) { return _tTotal; }
| //===============================================================================================================
//===============================================================================================================
//=============================================================================================================== | LineComment | v0.8.9+commit.e5eed63a | MIT | ipfs://8a5526f7d2dbb1440d1d6c5df83523aad259b7f5154d769ecd3f09d3df7f8c3b | {
"func_code_index": [
7685,
7773
]
} | 11,316 |
||
CowGuys | contracts/CowGuys.sol | 0x41f6d915901e13782e71effc6d05cab47a42f94d | Solidity | CowGuys | contract CowGuys is ERC721Enumerable, Ownable {
using Strings for uint256;
uint256 public maxSupply = 3333; // This will be the end of the story. :(
string private baseURI = "";
uint256 totalSupply_; // Check out how many Cow Guy NFTs has been minted until now.
uint256 public balance;
constructor() ERC721("Cow Guys", "COWG") {
}
function setBaseURI(string memory _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
receive() payable external {
balance += msg.value;
}
// Let's mint!
function mintNFT()
public onlyOwner returns (uint256)
{
uint256 id = totalSupply();
require( totalSupply() + 1 <= maxSupply, "Max NFT amount (3333) has been reached.");
require( tx.origin == msg.sender, "You cannot mint on a custom contract!");
_safeMint(msg.sender, id + 1); //starts from tokenID: 1 instead of 0.
return id;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: Nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), ".json")) : "";
}
function withdraw() public payable onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
} | mintNFT | function mintNFT()
public onlyOwner returns (uint256)
{
uint256 id = totalSupply();
require( totalSupply() + 1 <= maxSupply, "Max NFT amount (3333) has been reached.");
require( tx.origin == msg.sender, "You cannot mint on a custom contract!");
_safeMint(msg.sender, id + 1); //starts from tokenID: 1 instead of 0.
return id;
}
| // Let's mint! | LineComment | v0.8.7+commit.e28d00a7 | {
"func_code_index": [
669,
1059
]
} | 11,317 |
||||
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
93,
300
]
} | 11,318 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
390,
690
]
} | 11,319 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
810,
938
]
} | 11,320 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
1008,
1154
]
} | 11,321 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | totalSupply | function totalSupply() public view returns (uint256) {
return totalSupply_;
}
| /**
* @dev total number of tokens in existence
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
813,
909
]
} | 11,322 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
1077,
1437
]
} | 11,323 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | batchTransfer | function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
return true;
}
| /**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
1617,
1932
]
} | 11,324 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view returns (uint256) {
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.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
2148,
2260
]
} | 11,325 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
2547,
3105
]
} | 11,326 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _value) public returns (bool) {
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.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
3748,
3959
]
} | 11,327 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | 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.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
4290,
4486
]
} | 11,328 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
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.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
4963,
5308
]
} | 11,329 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | decreaseApproval | function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
5790,
6293
]
} | 11,330 |
|
MyanmarGoldToken | MyanmarGoldToken.sol | 0x9643439501e48c63f8676c834f9da52f4c2b8d6b | Solidity | MyanmarGoldToken | contract MyanmarGoldToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
string public constant name = "MyanmarGoldToken"; // solium-disable-line uppercase
string public constant symbol = "MGC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
event Burn(address indexed burner, uint256 value);
constructor(address _icoAddress) public {
totalSupply_ = 1000000000 * (10 ** uint256(decimals));
balances[_icoAddress] = totalSupply_;
emit Transfer(address(0), _icoAddress, totalSupply_);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev batchTransfer token for a specified addresses
* @param _tos The addresses to transfer to.
* @param _values The amounts to be transferred.
*/
function batchTransfer(address[] _tos, uint256[] _values) public returns (bool) {
require(_tos.length == _values.length);
uint256 arrayLength = _tos.length;
for(uint256 i = 0; i < arrayLength; i++) {
transfer(_tos[i], _values[i]);
}
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) {
return balances[_owner];
}
/**
* @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
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
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,
uint _addedValue
)
public
returns (bool)
{
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,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | burn | function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
| /**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://9d31a84d2b759f20bf87cf8030872ffc15cd1bd25bd1d0c5ed16a58f8ecdc1f4 | {
"func_code_index": [
6415,
6501
]
} | 11,331 |
|
CoSoundToken | CoSoundToken.sol | 0x7b7b239e7fc2b4680f5cf469ecb968bd94bb38aa | Solidity | StandardToken | contract StandardToken is ERC20, SafeMath, ERC223Interface {
/* Actual balances of token holders */
mapping(address => uint) balances;
uint public totalSupply;
/* approve() allowances */
mapping (address => mapping (address => uint)) internal allowed;
/**
*
* Fix for the ERC20 short address attack
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
return true;
}else{return false;}
}
/**
*
* Transfer with ERC223 specification
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
function transfer(address _to, uint _value)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint _value)
public
returns (bool success)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
uint _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
require(_spender != address(0));
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
//if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
require(_value == 0 || allowed[msg.sender][_spender] == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* Standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value, bytes _data)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
return true;
}else{return false;}
}
| /**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://04a6bf5bd39c3077d52cd4799bc448a82094fc000fed7a1d51a74f1ce6e2c57a | {
"func_code_index": [
1091,
2122
]
} | 11,332 |
|
CoSoundToken | CoSoundToken.sol | 0x7b7b239e7fc2b4680f5cf469ecb968bd94bb38aa | Solidity | StandardToken | contract StandardToken is ERC20, SafeMath, ERC223Interface {
/* Actual balances of token holders */
mapping(address => uint) balances;
uint public totalSupply;
/* approve() allowances */
mapping (address => mapping (address => uint)) internal allowed;
/**
*
* Fix for the ERC20 short address attack
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
return true;
}else{return false;}
}
/**
*
* Transfer with ERC223 specification
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
function transfer(address _to, uint _value)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint _value)
public
returns (bool success)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
uint _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
require(_spender != address(0));
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
//if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
require(_value == 0 || allowed[msg.sender][_spender] == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* Standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint _value)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
| /**
*
* Transfer with ERC223 specification
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://04a6bf5bd39c3077d52cd4799bc448a82094fc000fed7a1d51a74f1ce6e2c57a | {
"func_code_index": [
2276,
3176
]
} | 11,333 |
|
CoSoundToken | CoSoundToken.sol | 0x7b7b239e7fc2b4680f5cf469ecb968bd94bb38aa | Solidity | StandardToken | contract StandardToken is ERC20, SafeMath, ERC223Interface {
/* Actual balances of token holders */
mapping(address => uint) balances;
uint public totalSupply;
/* approve() allowances */
mapping (address => mapping (address => uint)) internal allowed;
/**
*
* Fix for the ERC20 short address attack
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value, _data);
return true;
}else{return false;}
}
/**
*
* Transfer with ERC223 specification
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
function transfer(address _to, uint _value)
onlyPayloadSize(2 * 32)
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
if(codeLength>0) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint _value)
public
returns (bool success)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
uint _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
require(_spender != address(0));
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
//if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
require(_value == 0 || allowed[msg.sender][_spender] == 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
} | /**
* Standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | increaseApproval | function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| /**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/ | NatSpecMultiLine | v0.4.23+commit.124ca40d | bzzr://04a6bf5bd39c3077d52cd4799bc448a82094fc000fed7a1d51a74f1ce6e2c57a | {
"func_code_index": [
4859,
5149
]
} | 11,334 |
|
CoSoundToken | CoSoundToken.sol | 0x7b7b239e7fc2b4680f5cf469ecb968bd94bb38aa | Solidity | CoSoundToken | contract CoSoundToken is StandardToken, Ownable {
string public name;
uint8 public decimals;
string public symbol;
uint totalEthInWei;
constructor() public{
decimals = 18; // Amount of decimals for display purposes
totalSupply = 1200000000 * 10 ** uint256(decimals); // Update total supply
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "Cosound"; // Set the name for display purposes
symbol = "CSND"; // Set the symbol for display purposes
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
return true;
}
// can accept ether
function() payable public{
revert();
}
function transferToCrowdsale(address _to, uint _value)
onlyPayloadSize(2 * 32)
onlyOwner
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
else {
return false;
}
}
} | approveAndCall | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
return true;
}
| /* Approves and then calls the receiving contract */ | Comment | v0.4.23+commit.124ca40d | bzzr://04a6bf5bd39c3077d52cd4799bc448a82094fc000fed7a1d51a74f1ce6e2c57a | {
"func_code_index": [
634,
1047
]
} | 11,335 |
|||
CoSoundToken | CoSoundToken.sol | 0x7b7b239e7fc2b4680f5cf469ecb968bd94bb38aa | Solidity | CoSoundToken | contract CoSoundToken is StandardToken, Ownable {
string public name;
uint8 public decimals;
string public symbol;
uint totalEthInWei;
constructor() public{
decimals = 18; // Amount of decimals for display purposes
totalSupply = 1200000000 * 10 ** uint256(decimals); // Update total supply
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "Cosound"; // Set the name for display purposes
symbol = "CSND"; // Set the symbol for display purposes
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
return true;
}
// can accept ether
function() payable public{
revert();
}
function transferToCrowdsale(address _to, uint _value)
onlyPayloadSize(2 * 32)
onlyOwner
public
returns (bool success)
{
require(_to != address(0));
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
else {
return false;
}
}
} | function() payable public{
revert();
}
| // can accept ether | LineComment | v0.4.23+commit.124ca40d | bzzr://04a6bf5bd39c3077d52cd4799bc448a82094fc000fed7a1d51a74f1ce6e2c57a | {
"func_code_index": [
1075,
1132
]
} | 11,336 |
||||
DECVAULT | DECVAULT.sol | 0x3d259b5cf3e73bad40e9c1955d77faf3eb7a6876 | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title DECVAULT Project
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://2f63364488e42379b15d9c4daf2e0f12c0518451e4f687e2be8bbd6e4daf58be | {
"func_code_index": [
95,
302
]
} | 11,337 |
|
DECVAULT | DECVAULT.sol | 0x3d259b5cf3e73bad40e9c1955d77faf3eb7a6876 | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title DECVAULT Project
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://2f63364488e42379b15d9c4daf2e0f12c0518451e4f687e2be8bbd6e4daf58be | {
"func_code_index": [
392,
692
]
} | 11,338 |
|
DECVAULT | DECVAULT.sol | 0x3d259b5cf3e73bad40e9c1955d77faf3eb7a6876 | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title DECVAULT Project
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://2f63364488e42379b15d9c4daf2e0f12c0518451e4f687e2be8bbd6e4daf58be | {
"func_code_index": [
812,
940
]
} | 11,339 |
|
DECVAULT | DECVAULT.sol | 0x3d259b5cf3e73bad40e9c1955d77faf3eb7a6876 | Solidity | SafeMath | library SafeMath {
/**
* @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;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @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) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title DECVAULT Project
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://2f63364488e42379b15d9c4daf2e0f12c0518451e4f687e2be8bbd6e4daf58be | {
"func_code_index": [
1010,
1156
]
} | 11,340 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
| /**
* @dev Multiplies two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
89,
272
]
} | 11,341 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Integer division of two numbers, truncating the quotient.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
356,
629
]
} | 11,342 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| /**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
744,
860
]
} | 11,343 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | SafeMath | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
} | /**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
| /**
* @dev Adds two numbers, throws on overflow.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
924,
1060
]
} | 11,344 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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));
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.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
261,
321
]
} | 11,345 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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));
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));
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.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
640,
816
]
} | 11,346 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | BasicToken | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 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 | totalSupply | function totalSupply() public view returns (uint256) {
return totalSupply_;
}
| /**
* @dev total number of tokens in existence
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
207,
295
]
} | 11,347 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | BasicToken | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 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 returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
455,
845
]
} | 11,348 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | Solidity | BasicToken | contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 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.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
1052,
1164
]
} | 11,349 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _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 transfered
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
400,
852
]
} | 11,350 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _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.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
1088,
1277
]
} | 11,351 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | 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.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
1601,
1733
]
} | 11,352 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | function() public payable {
revert();
| /**
* @dev Function to revert eth transfers to this contract
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
1821,
1873
]
} | 11,353 |
||
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferAnyERC20Token | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
| /**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
1965,
2147
]
} | 11,354 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | multiTransfer | function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
| /**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
2803,
3270
]
} | 11,355 |
|
CR7Coin | CR7Coin.sol | 0x7f585b9130c64e9e9f470b618a7badd03d79ca7e | 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 transfered
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiTransfer(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
/**
* @dev The following variables are OPTIONAL vanities.
*/
string public constant number = "7";
string public constant fullname = "Cristiano Ronaldo dos Santos Aveiro";
string public constant born = "5th February, 1985";
string public constant country = "Portugal";
} | /**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | multiTransferFrom | function multiTransferFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
| /**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/ | NatSpecMultiLine | v0.4.19+commit.c4cbbb05 | bzzr://9ca9ad2331a1012d21f47c60166a2d0923bde2fc40a24c4ef7007cdfc81f0672 | {
"func_code_index": [
3660,
4157
]
} | 11,356 |
|
Senate | SenateERC20.sol | 0x34be5b8c30ee4fde069dc878989686abe9884470 | Solidity | Senate | contract Senate is ERC20 {
uint256 constant public MAX_SUPPLY = 300_000_000e18;
address public deployer;
constructor(address initialKeeper)
ERC20("SENATE", "SENATE")
{
_mint(initialKeeper, MAX_SUPPLY);
deployer = _msgSender();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) external {
_burn(_msgSender(), amount);
}
/**
* @dev Deployer can claim any tokens that transfered to this contract
* address for prevent users confused
*/
function reclaimToken(ERC20 token) external {
require(_msgSender() == deployer, "Only for deployer");
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
} | burn | function burn(uint256 amount) external {
_burn(_msgSender(), amount);
}
| /**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/ | NatSpecMultiLine | v0.8.10+commit.fc410830 | MIT | {
"func_code_index": [
377,
464
]
} | 11,357 |
|||
Senate | SenateERC20.sol | 0x34be5b8c30ee4fde069dc878989686abe9884470 | Solidity | Senate | contract Senate is ERC20 {
uint256 constant public MAX_SUPPLY = 300_000_000e18;
address public deployer;
constructor(address initialKeeper)
ERC20("SENATE", "SENATE")
{
_mint(initialKeeper, MAX_SUPPLY);
deployer = _msgSender();
}
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) external {
_burn(_msgSender(), amount);
}
/**
* @dev Deployer can claim any tokens that transfered to this contract
* address for prevent users confused
*/
function reclaimToken(ERC20 token) external {
require(_msgSender() == deployer, "Only for deployer");
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
} | reclaimToken | function reclaimToken(ERC20 token) external {
require(_msgSender() == deployer, "Only for deployer");
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
| /**
* @dev Deployer can claim any tokens that transfered to this contract
* address for prevent users confused
*/ | NatSpecMultiLine | v0.8.10+commit.fc410830 | MIT | {
"func_code_index": [
601,
870
]
} | 11,358 |
|||
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Context | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
} | /*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol
*/ | Comment | _msgSender | function _msgSender() internal view returns (address payable) {
return msg.sender;
}
| // solhint-disable-previous-line no-empty-blocks | LineComment | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
265,
368
]
} | 11,359 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
94,
154
]
} | 11,360 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
237,
310
]
} | 11,361 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
534,
616
]
} | 11,362 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
895,
983
]
} | 11,363 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1647,
1726
]
} | 11,364 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
} | /**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
2039,
2141
]
} | 11,365 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| /**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
251,
437
]
} | 11,366 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
707,
848
]
} | 11,367 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | sub | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| /**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1180,
1377
]
} | 11,368 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mul | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| /**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1623,
2099
]
} | 11,369 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
2562,
2699
]
} | 11,370 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | div | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| /**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
3224,
3575
]
} | 11,371 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
4027,
4162
]
} | 11,372 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | SafeMath | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b != 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
} | /**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/ | NatSpecMultiLine | mod | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| /**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
4676,
4847
]
} | 11,373 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | name | function name() public view returns (string memory) {
return _name;
}
| /**
* @dev Returns the name of the token.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
759,
847
]
} | 11,374 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | symbol | function symbol() public view returns (string memory) {
return _symbol;
}
| /**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
961,
1053
]
} | 11,375 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | decimals | function decimals() public view returns (uint8) {
return _decimals;
}
| /**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1611,
1699
]
} | 11,376 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | totalSupply | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| /**
* @dev See {IERC20-totalSupply}.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1769,
1865
]
} | 11,377 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
| /**
* @dev See {IERC20-balanceOf}.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
1923,
2038
]
} | 11,378 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| /**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
2246,
2409
]
} | 11,379 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
| /**
* @dev See {IERC20-allowance}.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
2467,
2606
]
} | 11,380 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| /**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
2748,
2905
]
} | 11,381 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| /**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
3372,
3681
]
} | 11,382 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | increaseAllowance | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| /**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
4085,
4300
]
} | 11,383 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | decreaseAllowance | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| /**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
4798,
5064
]
} | 11,384 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | _transfer | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
| /**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
5549,
6025
]
} | 11,385 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | _mint | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| /** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
6301,
6614
]
} | 11,386 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | _burn | function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| /**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
6941,
7294
]
} | 11,387 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | _approve | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| /**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
7729,
8072
]
} | 11,388 |
Token | Token.sol | 0xeaa21b2ba6884a7fadc8ea49ba1391be979ba0f8 | Solidity | Token | contract Token is Context, IERC20 {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
constructor(address boss,string memory name, string memory symbol,uint8 decimals,uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
uint256 s=_decimals;
_totalSupply = totalSupply*(10**s);
_balances[boss] = _totalSupply;
emit Transfer(address(0), boss, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
} | /**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
*/ | NatSpecMultiLine | _burnFrom | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
| /**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/ | NatSpecMultiLine | v0.5.17+commit.d19bba13 | None | bzzr://109fd991027f29f52b5eca240cbb3973c1ab72886b23f8e328a6208b4fce830e | {
"func_code_index": [
8253,
8490
]
} | 11,389 |
Llama | contracts/Llama.sol | 0x2febe228d2ad5a9adc8ec3f77b3f23ad7bb13b1e | Solidity | Llama | contract Llama is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ReentrancyGuard, VRFConsumerBase {
using Counters for Counters.Counter;
using SafeMath for uint256;
Counters.Counter private _tokenIdCounter;
uint256 private unitCost;
uint256 private _maxPurchase;
uint256 private _maxTokens;
string _folderPath;
bool _saleComplete;
address _devAddress;
uint256 public LastLottoDraw;
uint256 public NextLottoDraw;
bytes32 internal keyHash;
uint256 internal fee;
uint256 public randomResult;
uint256 public CurrentJackpotInWei;
uint256 public TotalJackpotInWei;
uint256 private maxJackpotInWei;
event CloseSale(address indexed _from);
event OpenSale(address indexed _from);
event PrizeWon(address indexed _winner, uint256 _prize, uint256 _rank, uint256 _tokenId);
mapping(address => uint256) public WhiteList;
bool private OnlyWhiteList;
constructor() VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator - 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token - 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
) ERC721("Lotto Llamas", "LL") {
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; //0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311
fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network)
unitCost = 0.0777 ether; //start price - 0.0777 ether
_maxPurchase = 20;
_maxTokens = 10000;
_saleComplete = false;
_tokenIdCounter.increment(); //first token is ID 1
OnlyWhiteList = true;
_pause();
}
function updateLinkFee(uint256 _fee) public onlyOwner{
fee = _fee;
}
function updateLinkKeyhash(bytes32 _keyHash) public onlyOwner{
keyHash = _keyHash;
}
function toggleWhitelist() public onlyOwner {
OnlyWhiteList = !OnlyWhiteList;
}
function addWhitelist(address[] memory addresses) public onlyOwner {
for(uint256 i; i < addresses.length; i++){
WhiteList[addresses[i]] = 2;
}
}
function devMint(address to, uint256 numberToMint) public onlyOwner onSale nonReentrant {
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(paused(), "Can only dev mint when contract is paused");
_unpause();
uint256 i = 0;
do {
_safeMint(to, _tokenIdCounter.current());
_tokenIdCounter.increment();
i++;
} while (i < numberToMint && i < _maxPurchase);
//can only mint a max of whatever the max public purchase is per transaction
pause();
}
function drawLotto() public onlyOwner nonReentrant{
require(randomResult > 0, "Set random seed first");
require(block.timestamp > NextLottoDraw, "Too early for this lotto draw");
require(address(this).balance >= CurrentJackpotInWei, "Not enough eth to pay jackpot");
LastLottoDraw = block.timestamp;
NextLottoDraw = block.timestamp.add(2419200); //next draw must be 28 days after the previous one (28 * 24 * 60 * 60)
lottoTime(CurrentJackpotInWei);
randomResult = 0; //reset seed for the next draw
}
//remove this before mainnet deployment
/*
function setNextLottoDraw(uint256 nextLottoTimestamp) public onlyOwner {
NextLottoDraw = nextLottoTimestamp;
}*/
//just have this method so we can check that chainlink is working correctly
//before starting minting. Can't reset seed after 500 llamas have been minted.
function resetSeed() public onlyOwner {
require(randomResult != 0, "seed is already 0");
require(_tokenIdCounter.current() < 500, "Cannot reset seed");
randomResult = 0;
}
function isSeedSet() public view returns(bool isSet){
isSet = (randomResult != 0);
}
function lottoTime(uint256 jackpot) private {
TotalJackpotInWei = TotalJackpotInWei.sub(jackpot);
uint256 share = jackpot.div(100);
uint256[10] memory prizes = [share.mul(40) //40% first prize
, share.mul(10), share.mul(10), share.mul(10), share.mul(10) //10% 2nd - 5th prize
, share.mul(4), share.mul(4), share.mul(4), share.mul(4), share.mul(4)]; //4% 5th - 10th prize
uint256 maxNumber = totalSupply(); //totalSupply()
uint256[] memory winners = currentWinners(prizes.length, maxNumber);
for(uint256 i = 0; i < prizes.length; i++){
uint256 winner = winners[i];
//all the testing there was never a winner outside of the range..
//but better safe than sorry.
if (winner > 0 && winner <= maxNumber) {
address winner_addy = ownerOf(winner);
payable(winner_addy).transfer(prizes[i]);
emit PrizeWon(winner_addy, prizes[i], i, winner);
}
}
}
function currentWinners(uint256 n, uint256 maxNumber) private view returns (uint256[] memory expandedValues) {
expandedValues = new uint256[](n);
for (uint256 i = 0; i < n; i++) {
expandedValues[i] = (uint256(keccak256(abi.encode(randomResult, i)))% maxNumber).add(1) ;
}
return expandedValues;
}
function pause() public onlyOwner onSale {
_pause();
}
function startSaleOrUpdateUrl(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
if (paused()){
_unpause();
emit OpenSale(msg.sender);
}
}
function updateBaseUri(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
}
function _baseURI() internal view override returns (string memory) {
return _folderPath;
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function updateUnitPrice(uint256 unitPrice) public onlyOwner {
unitCost = unitPrice;
}
function mintLlama(uint256 numberToMint) public payable nonReentrant whenNotPaused {
require(numberToMint > 0 && numberToMint <= _maxPurchase, "Invalid mint amount");
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(msg.value == numberToMint.mul(unitCost), "Incorrect ETH amount");
require(!OnlyWhiteList || WhiteList[msg.sender] >= numberToMint);
require(numberToMint.add(balanceOf(msg.sender)) <= 200 || owner() == msg.sender, "max wallet limiter turned on for testing!!");
uint256 i = 0;
do {
i++;
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
} while (i < numberToMint && _tokenIdCounter.current() <= _maxTokens);
uint256 jp = unitCost.mul(i).div(100).mul(36); //fixed 36% jackpot cut
TotalJackpotInWei = TotalJackpotInWei.add(jp);
if (numberToMint.sub(i) > 0){
//return any overspent funds for the last buyer
payable(msg.sender).transfer(numberToMint.sub(i).mul(unitCost));
}
if(OnlyWhiteList){
WhiteList[msg.sender] = WhiteList[msg.sender].sub(numberToMint);
}
}
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);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
require(balance.sub(TotalJackpotInWei) > 0, '"No funds available to withdraw');
payable(msg.sender).transfer(balance.sub(TotalJackpotInWei));
}
//withdraw link or any other ERC tokens
function withdrawTokens(IERC20 token) public onlyOwner {
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
function endSale() public onlyOwner onSale {
require(!paused(), "cannot close sale whilst paused");
require(_maxTokens == totalSupply(), "cannot close sale before it's sold out");
// once this action is completed the base URI cannot be changed
// and contract cannot be paused.
_saleComplete = true;
emit CloseSale(msg.sender);
}
modifier onSale() {
require(!_saleComplete, "Sale closed. Action cannot be completed");
_;
}
function setCurrentJackpot(uint256 _currentJackpotInWei) public onlyOwner {
CurrentJackpotInWei = _currentJackpotInWei;
}
//not onlyOwner.. Anyone can add money to the jackpot
function topUpJackpot() public payable nonReentrant {
TotalJackpotInWei = TotalJackpotInWei.add(msg.value);
}
function setLottoSeed() public onlyOwner returns (bytes32 requestId) {
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract");
require(randomResult == 0, "Cannot set lotto seed if it is already set");
return requestRandomness(keyHash, fee);
}
function getProjectData() public view returns (bool _onlyWhiteList, uint256 _unitCost, uint256 _currentJackpot, uint256 _totalJackpot, uint256 _nextLottoTimestamp, uint256 _totalSupply, bool _isPaused) {
_currentJackpot = CurrentJackpotInWei;
_totalJackpot = TotalJackpotInWei;
_nextLottoTimestamp = NextLottoDraw;
_isPaused = paused();
_totalSupply = totalSupply();
_unitCost = unitCost;
_onlyWhiteList = OnlyWhiteList;
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
} | resetSeed | function resetSeed() public onlyOwner {
require(randomResult != 0, "seed is already 0");
require(_tokenIdCounter.current() < 500, "Cannot reset seed");
randomResult = 0;
}
| //just have this method so we can check that chainlink is working correctly
//before starting minting. Can't reset seed after 500 llamas have been minted. | LineComment | v0.8.9+commit.e5eed63a | {
"func_code_index": [
3865,
4073
]
} | 11,390 |
||||
Llama | contracts/Llama.sol | 0x2febe228d2ad5a9adc8ec3f77b3f23ad7bb13b1e | Solidity | Llama | contract Llama is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ReentrancyGuard, VRFConsumerBase {
using Counters for Counters.Counter;
using SafeMath for uint256;
Counters.Counter private _tokenIdCounter;
uint256 private unitCost;
uint256 private _maxPurchase;
uint256 private _maxTokens;
string _folderPath;
bool _saleComplete;
address _devAddress;
uint256 public LastLottoDraw;
uint256 public NextLottoDraw;
bytes32 internal keyHash;
uint256 internal fee;
uint256 public randomResult;
uint256 public CurrentJackpotInWei;
uint256 public TotalJackpotInWei;
uint256 private maxJackpotInWei;
event CloseSale(address indexed _from);
event OpenSale(address indexed _from);
event PrizeWon(address indexed _winner, uint256 _prize, uint256 _rank, uint256 _tokenId);
mapping(address => uint256) public WhiteList;
bool private OnlyWhiteList;
constructor() VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator - 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token - 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
) ERC721("Lotto Llamas", "LL") {
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; //0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311
fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network)
unitCost = 0.0777 ether; //start price - 0.0777 ether
_maxPurchase = 20;
_maxTokens = 10000;
_saleComplete = false;
_tokenIdCounter.increment(); //first token is ID 1
OnlyWhiteList = true;
_pause();
}
function updateLinkFee(uint256 _fee) public onlyOwner{
fee = _fee;
}
function updateLinkKeyhash(bytes32 _keyHash) public onlyOwner{
keyHash = _keyHash;
}
function toggleWhitelist() public onlyOwner {
OnlyWhiteList = !OnlyWhiteList;
}
function addWhitelist(address[] memory addresses) public onlyOwner {
for(uint256 i; i < addresses.length; i++){
WhiteList[addresses[i]] = 2;
}
}
function devMint(address to, uint256 numberToMint) public onlyOwner onSale nonReentrant {
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(paused(), "Can only dev mint when contract is paused");
_unpause();
uint256 i = 0;
do {
_safeMint(to, _tokenIdCounter.current());
_tokenIdCounter.increment();
i++;
} while (i < numberToMint && i < _maxPurchase);
//can only mint a max of whatever the max public purchase is per transaction
pause();
}
function drawLotto() public onlyOwner nonReentrant{
require(randomResult > 0, "Set random seed first");
require(block.timestamp > NextLottoDraw, "Too early for this lotto draw");
require(address(this).balance >= CurrentJackpotInWei, "Not enough eth to pay jackpot");
LastLottoDraw = block.timestamp;
NextLottoDraw = block.timestamp.add(2419200); //next draw must be 28 days after the previous one (28 * 24 * 60 * 60)
lottoTime(CurrentJackpotInWei);
randomResult = 0; //reset seed for the next draw
}
//remove this before mainnet deployment
/*
function setNextLottoDraw(uint256 nextLottoTimestamp) public onlyOwner {
NextLottoDraw = nextLottoTimestamp;
}*/
//just have this method so we can check that chainlink is working correctly
//before starting minting. Can't reset seed after 500 llamas have been minted.
function resetSeed() public onlyOwner {
require(randomResult != 0, "seed is already 0");
require(_tokenIdCounter.current() < 500, "Cannot reset seed");
randomResult = 0;
}
function isSeedSet() public view returns(bool isSet){
isSet = (randomResult != 0);
}
function lottoTime(uint256 jackpot) private {
TotalJackpotInWei = TotalJackpotInWei.sub(jackpot);
uint256 share = jackpot.div(100);
uint256[10] memory prizes = [share.mul(40) //40% first prize
, share.mul(10), share.mul(10), share.mul(10), share.mul(10) //10% 2nd - 5th prize
, share.mul(4), share.mul(4), share.mul(4), share.mul(4), share.mul(4)]; //4% 5th - 10th prize
uint256 maxNumber = totalSupply(); //totalSupply()
uint256[] memory winners = currentWinners(prizes.length, maxNumber);
for(uint256 i = 0; i < prizes.length; i++){
uint256 winner = winners[i];
//all the testing there was never a winner outside of the range..
//but better safe than sorry.
if (winner > 0 && winner <= maxNumber) {
address winner_addy = ownerOf(winner);
payable(winner_addy).transfer(prizes[i]);
emit PrizeWon(winner_addy, prizes[i], i, winner);
}
}
}
function currentWinners(uint256 n, uint256 maxNumber) private view returns (uint256[] memory expandedValues) {
expandedValues = new uint256[](n);
for (uint256 i = 0; i < n; i++) {
expandedValues[i] = (uint256(keccak256(abi.encode(randomResult, i)))% maxNumber).add(1) ;
}
return expandedValues;
}
function pause() public onlyOwner onSale {
_pause();
}
function startSaleOrUpdateUrl(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
if (paused()){
_unpause();
emit OpenSale(msg.sender);
}
}
function updateBaseUri(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
}
function _baseURI() internal view override returns (string memory) {
return _folderPath;
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function updateUnitPrice(uint256 unitPrice) public onlyOwner {
unitCost = unitPrice;
}
function mintLlama(uint256 numberToMint) public payable nonReentrant whenNotPaused {
require(numberToMint > 0 && numberToMint <= _maxPurchase, "Invalid mint amount");
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(msg.value == numberToMint.mul(unitCost), "Incorrect ETH amount");
require(!OnlyWhiteList || WhiteList[msg.sender] >= numberToMint);
require(numberToMint.add(balanceOf(msg.sender)) <= 200 || owner() == msg.sender, "max wallet limiter turned on for testing!!");
uint256 i = 0;
do {
i++;
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
} while (i < numberToMint && _tokenIdCounter.current() <= _maxTokens);
uint256 jp = unitCost.mul(i).div(100).mul(36); //fixed 36% jackpot cut
TotalJackpotInWei = TotalJackpotInWei.add(jp);
if (numberToMint.sub(i) > 0){
//return any overspent funds for the last buyer
payable(msg.sender).transfer(numberToMint.sub(i).mul(unitCost));
}
if(OnlyWhiteList){
WhiteList[msg.sender] = WhiteList[msg.sender].sub(numberToMint);
}
}
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);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
require(balance.sub(TotalJackpotInWei) > 0, '"No funds available to withdraw');
payable(msg.sender).transfer(balance.sub(TotalJackpotInWei));
}
//withdraw link or any other ERC tokens
function withdrawTokens(IERC20 token) public onlyOwner {
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
function endSale() public onlyOwner onSale {
require(!paused(), "cannot close sale whilst paused");
require(_maxTokens == totalSupply(), "cannot close sale before it's sold out");
// once this action is completed the base URI cannot be changed
// and contract cannot be paused.
_saleComplete = true;
emit CloseSale(msg.sender);
}
modifier onSale() {
require(!_saleComplete, "Sale closed. Action cannot be completed");
_;
}
function setCurrentJackpot(uint256 _currentJackpotInWei) public onlyOwner {
CurrentJackpotInWei = _currentJackpotInWei;
}
//not onlyOwner.. Anyone can add money to the jackpot
function topUpJackpot() public payable nonReentrant {
TotalJackpotInWei = TotalJackpotInWei.add(msg.value);
}
function setLottoSeed() public onlyOwner returns (bytes32 requestId) {
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract");
require(randomResult == 0, "Cannot set lotto seed if it is already set");
return requestRandomness(keyHash, fee);
}
function getProjectData() public view returns (bool _onlyWhiteList, uint256 _unitCost, uint256 _currentJackpot, uint256 _totalJackpot, uint256 _nextLottoTimestamp, uint256 _totalSupply, bool _isPaused) {
_currentJackpot = CurrentJackpotInWei;
_totalJackpot = TotalJackpotInWei;
_nextLottoTimestamp = NextLottoDraw;
_isPaused = paused();
_totalSupply = totalSupply();
_unitCost = unitCost;
_onlyWhiteList = OnlyWhiteList;
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
} | withdrawTokens | function withdrawTokens(IERC20 token) public onlyOwner {
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
| //withdraw link or any other ERC tokens | LineComment | v0.8.9+commit.e5eed63a | {
"func_code_index": [
8733,
8930
]
} | 11,391 |
||||
Llama | contracts/Llama.sol | 0x2febe228d2ad5a9adc8ec3f77b3f23ad7bb13b1e | Solidity | Llama | contract Llama is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ReentrancyGuard, VRFConsumerBase {
using Counters for Counters.Counter;
using SafeMath for uint256;
Counters.Counter private _tokenIdCounter;
uint256 private unitCost;
uint256 private _maxPurchase;
uint256 private _maxTokens;
string _folderPath;
bool _saleComplete;
address _devAddress;
uint256 public LastLottoDraw;
uint256 public NextLottoDraw;
bytes32 internal keyHash;
uint256 internal fee;
uint256 public randomResult;
uint256 public CurrentJackpotInWei;
uint256 public TotalJackpotInWei;
uint256 private maxJackpotInWei;
event CloseSale(address indexed _from);
event OpenSale(address indexed _from);
event PrizeWon(address indexed _winner, uint256 _prize, uint256 _rank, uint256 _tokenId);
mapping(address => uint256) public WhiteList;
bool private OnlyWhiteList;
constructor() VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator - 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token - 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
) ERC721("Lotto Llamas", "LL") {
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; //0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311
fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network)
unitCost = 0.0777 ether; //start price - 0.0777 ether
_maxPurchase = 20;
_maxTokens = 10000;
_saleComplete = false;
_tokenIdCounter.increment(); //first token is ID 1
OnlyWhiteList = true;
_pause();
}
function updateLinkFee(uint256 _fee) public onlyOwner{
fee = _fee;
}
function updateLinkKeyhash(bytes32 _keyHash) public onlyOwner{
keyHash = _keyHash;
}
function toggleWhitelist() public onlyOwner {
OnlyWhiteList = !OnlyWhiteList;
}
function addWhitelist(address[] memory addresses) public onlyOwner {
for(uint256 i; i < addresses.length; i++){
WhiteList[addresses[i]] = 2;
}
}
function devMint(address to, uint256 numberToMint) public onlyOwner onSale nonReentrant {
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(paused(), "Can only dev mint when contract is paused");
_unpause();
uint256 i = 0;
do {
_safeMint(to, _tokenIdCounter.current());
_tokenIdCounter.increment();
i++;
} while (i < numberToMint && i < _maxPurchase);
//can only mint a max of whatever the max public purchase is per transaction
pause();
}
function drawLotto() public onlyOwner nonReentrant{
require(randomResult > 0, "Set random seed first");
require(block.timestamp > NextLottoDraw, "Too early for this lotto draw");
require(address(this).balance >= CurrentJackpotInWei, "Not enough eth to pay jackpot");
LastLottoDraw = block.timestamp;
NextLottoDraw = block.timestamp.add(2419200); //next draw must be 28 days after the previous one (28 * 24 * 60 * 60)
lottoTime(CurrentJackpotInWei);
randomResult = 0; //reset seed for the next draw
}
//remove this before mainnet deployment
/*
function setNextLottoDraw(uint256 nextLottoTimestamp) public onlyOwner {
NextLottoDraw = nextLottoTimestamp;
}*/
//just have this method so we can check that chainlink is working correctly
//before starting minting. Can't reset seed after 500 llamas have been minted.
function resetSeed() public onlyOwner {
require(randomResult != 0, "seed is already 0");
require(_tokenIdCounter.current() < 500, "Cannot reset seed");
randomResult = 0;
}
function isSeedSet() public view returns(bool isSet){
isSet = (randomResult != 0);
}
function lottoTime(uint256 jackpot) private {
TotalJackpotInWei = TotalJackpotInWei.sub(jackpot);
uint256 share = jackpot.div(100);
uint256[10] memory prizes = [share.mul(40) //40% first prize
, share.mul(10), share.mul(10), share.mul(10), share.mul(10) //10% 2nd - 5th prize
, share.mul(4), share.mul(4), share.mul(4), share.mul(4), share.mul(4)]; //4% 5th - 10th prize
uint256 maxNumber = totalSupply(); //totalSupply()
uint256[] memory winners = currentWinners(prizes.length, maxNumber);
for(uint256 i = 0; i < prizes.length; i++){
uint256 winner = winners[i];
//all the testing there was never a winner outside of the range..
//but better safe than sorry.
if (winner > 0 && winner <= maxNumber) {
address winner_addy = ownerOf(winner);
payable(winner_addy).transfer(prizes[i]);
emit PrizeWon(winner_addy, prizes[i], i, winner);
}
}
}
function currentWinners(uint256 n, uint256 maxNumber) private view returns (uint256[] memory expandedValues) {
expandedValues = new uint256[](n);
for (uint256 i = 0; i < n; i++) {
expandedValues[i] = (uint256(keccak256(abi.encode(randomResult, i)))% maxNumber).add(1) ;
}
return expandedValues;
}
function pause() public onlyOwner onSale {
_pause();
}
function startSaleOrUpdateUrl(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
if (paused()){
_unpause();
emit OpenSale(msg.sender);
}
}
function updateBaseUri(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
}
function _baseURI() internal view override returns (string memory) {
return _folderPath;
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function updateUnitPrice(uint256 unitPrice) public onlyOwner {
unitCost = unitPrice;
}
function mintLlama(uint256 numberToMint) public payable nonReentrant whenNotPaused {
require(numberToMint > 0 && numberToMint <= _maxPurchase, "Invalid mint amount");
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(msg.value == numberToMint.mul(unitCost), "Incorrect ETH amount");
require(!OnlyWhiteList || WhiteList[msg.sender] >= numberToMint);
require(numberToMint.add(balanceOf(msg.sender)) <= 200 || owner() == msg.sender, "max wallet limiter turned on for testing!!");
uint256 i = 0;
do {
i++;
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
} while (i < numberToMint && _tokenIdCounter.current() <= _maxTokens);
uint256 jp = unitCost.mul(i).div(100).mul(36); //fixed 36% jackpot cut
TotalJackpotInWei = TotalJackpotInWei.add(jp);
if (numberToMint.sub(i) > 0){
//return any overspent funds for the last buyer
payable(msg.sender).transfer(numberToMint.sub(i).mul(unitCost));
}
if(OnlyWhiteList){
WhiteList[msg.sender] = WhiteList[msg.sender].sub(numberToMint);
}
}
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);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
require(balance.sub(TotalJackpotInWei) > 0, '"No funds available to withdraw');
payable(msg.sender).transfer(balance.sub(TotalJackpotInWei));
}
//withdraw link or any other ERC tokens
function withdrawTokens(IERC20 token) public onlyOwner {
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
function endSale() public onlyOwner onSale {
require(!paused(), "cannot close sale whilst paused");
require(_maxTokens == totalSupply(), "cannot close sale before it's sold out");
// once this action is completed the base URI cannot be changed
// and contract cannot be paused.
_saleComplete = true;
emit CloseSale(msg.sender);
}
modifier onSale() {
require(!_saleComplete, "Sale closed. Action cannot be completed");
_;
}
function setCurrentJackpot(uint256 _currentJackpotInWei) public onlyOwner {
CurrentJackpotInWei = _currentJackpotInWei;
}
//not onlyOwner.. Anyone can add money to the jackpot
function topUpJackpot() public payable nonReentrant {
TotalJackpotInWei = TotalJackpotInWei.add(msg.value);
}
function setLottoSeed() public onlyOwner returns (bytes32 requestId) {
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract");
require(randomResult == 0, "Cannot set lotto seed if it is already set");
return requestRandomness(keyHash, fee);
}
function getProjectData() public view returns (bool _onlyWhiteList, uint256 _unitCost, uint256 _currentJackpot, uint256 _totalJackpot, uint256 _nextLottoTimestamp, uint256 _totalSupply, bool _isPaused) {
_currentJackpot = CurrentJackpotInWei;
_totalJackpot = TotalJackpotInWei;
_nextLottoTimestamp = NextLottoDraw;
_isPaused = paused();
_totalSupply = totalSupply();
_unitCost = unitCost;
_onlyWhiteList = OnlyWhiteList;
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
} | topUpJackpot | function topUpJackpot() public payable nonReentrant {
TotalJackpotInWei = TotalJackpotInWei.add(msg.value);
}
| //not onlyOwner.. Anyone can add money to the jackpot | LineComment | v0.8.9+commit.e5eed63a | {
"func_code_index": [
9649,
9777
]
} | 11,392 |
||||
Llama | contracts/Llama.sol | 0x2febe228d2ad5a9adc8ec3f77b3f23ad7bb13b1e | Solidity | Llama | contract Llama is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ReentrancyGuard, VRFConsumerBase {
using Counters for Counters.Counter;
using SafeMath for uint256;
Counters.Counter private _tokenIdCounter;
uint256 private unitCost;
uint256 private _maxPurchase;
uint256 private _maxTokens;
string _folderPath;
bool _saleComplete;
address _devAddress;
uint256 public LastLottoDraw;
uint256 public NextLottoDraw;
bytes32 internal keyHash;
uint256 internal fee;
uint256 public randomResult;
uint256 public CurrentJackpotInWei;
uint256 public TotalJackpotInWei;
uint256 private maxJackpotInWei;
event CloseSale(address indexed _from);
event OpenSale(address indexed _from);
event PrizeWon(address indexed _winner, uint256 _prize, uint256 _rank, uint256 _tokenId);
mapping(address => uint256) public WhiteList;
bool private OnlyWhiteList;
constructor() VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator - 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token - 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
) ERC721("Lotto Llamas", "LL") {
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445; //0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311
fee = 2 * 10 ** 18; // 0.1 LINK (Varies by network)
unitCost = 0.0777 ether; //start price - 0.0777 ether
_maxPurchase = 20;
_maxTokens = 10000;
_saleComplete = false;
_tokenIdCounter.increment(); //first token is ID 1
OnlyWhiteList = true;
_pause();
}
function updateLinkFee(uint256 _fee) public onlyOwner{
fee = _fee;
}
function updateLinkKeyhash(bytes32 _keyHash) public onlyOwner{
keyHash = _keyHash;
}
function toggleWhitelist() public onlyOwner {
OnlyWhiteList = !OnlyWhiteList;
}
function addWhitelist(address[] memory addresses) public onlyOwner {
for(uint256 i; i < addresses.length; i++){
WhiteList[addresses[i]] = 2;
}
}
function devMint(address to, uint256 numberToMint) public onlyOwner onSale nonReentrant {
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(paused(), "Can only dev mint when contract is paused");
_unpause();
uint256 i = 0;
do {
_safeMint(to, _tokenIdCounter.current());
_tokenIdCounter.increment();
i++;
} while (i < numberToMint && i < _maxPurchase);
//can only mint a max of whatever the max public purchase is per transaction
pause();
}
function drawLotto() public onlyOwner nonReentrant{
require(randomResult > 0, "Set random seed first");
require(block.timestamp > NextLottoDraw, "Too early for this lotto draw");
require(address(this).balance >= CurrentJackpotInWei, "Not enough eth to pay jackpot");
LastLottoDraw = block.timestamp;
NextLottoDraw = block.timestamp.add(2419200); //next draw must be 28 days after the previous one (28 * 24 * 60 * 60)
lottoTime(CurrentJackpotInWei);
randomResult = 0; //reset seed for the next draw
}
//remove this before mainnet deployment
/*
function setNextLottoDraw(uint256 nextLottoTimestamp) public onlyOwner {
NextLottoDraw = nextLottoTimestamp;
}*/
//just have this method so we can check that chainlink is working correctly
//before starting minting. Can't reset seed after 500 llamas have been minted.
function resetSeed() public onlyOwner {
require(randomResult != 0, "seed is already 0");
require(_tokenIdCounter.current() < 500, "Cannot reset seed");
randomResult = 0;
}
function isSeedSet() public view returns(bool isSet){
isSet = (randomResult != 0);
}
function lottoTime(uint256 jackpot) private {
TotalJackpotInWei = TotalJackpotInWei.sub(jackpot);
uint256 share = jackpot.div(100);
uint256[10] memory prizes = [share.mul(40) //40% first prize
, share.mul(10), share.mul(10), share.mul(10), share.mul(10) //10% 2nd - 5th prize
, share.mul(4), share.mul(4), share.mul(4), share.mul(4), share.mul(4)]; //4% 5th - 10th prize
uint256 maxNumber = totalSupply(); //totalSupply()
uint256[] memory winners = currentWinners(prizes.length, maxNumber);
for(uint256 i = 0; i < prizes.length; i++){
uint256 winner = winners[i];
//all the testing there was never a winner outside of the range..
//but better safe than sorry.
if (winner > 0 && winner <= maxNumber) {
address winner_addy = ownerOf(winner);
payable(winner_addy).transfer(prizes[i]);
emit PrizeWon(winner_addy, prizes[i], i, winner);
}
}
}
function currentWinners(uint256 n, uint256 maxNumber) private view returns (uint256[] memory expandedValues) {
expandedValues = new uint256[](n);
for (uint256 i = 0; i < n; i++) {
expandedValues[i] = (uint256(keccak256(abi.encode(randomResult, i)))% maxNumber).add(1) ;
}
return expandedValues;
}
function pause() public onlyOwner onSale {
_pause();
}
function startSaleOrUpdateUrl(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
if (paused()){
_unpause();
emit OpenSale(msg.sender);
}
}
function updateBaseUri(string memory folderPath) public onlyOwner onSale {
_folderPath = folderPath;
}
function _baseURI() internal view override returns (string memory) {
return _folderPath;
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
whenNotPaused
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function updateUnitPrice(uint256 unitPrice) public onlyOwner {
unitCost = unitPrice;
}
function mintLlama(uint256 numberToMint) public payable nonReentrant whenNotPaused {
require(numberToMint > 0 && numberToMint <= _maxPurchase, "Invalid mint amount");
require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!");
require(msg.value == numberToMint.mul(unitCost), "Incorrect ETH amount");
require(!OnlyWhiteList || WhiteList[msg.sender] >= numberToMint);
require(numberToMint.add(balanceOf(msg.sender)) <= 200 || owner() == msg.sender, "max wallet limiter turned on for testing!!");
uint256 i = 0;
do {
i++;
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
} while (i < numberToMint && _tokenIdCounter.current() <= _maxTokens);
uint256 jp = unitCost.mul(i).div(100).mul(36); //fixed 36% jackpot cut
TotalJackpotInWei = TotalJackpotInWei.add(jp);
if (numberToMint.sub(i) > 0){
//return any overspent funds for the last buyer
payable(msg.sender).transfer(numberToMint.sub(i).mul(unitCost));
}
if(OnlyWhiteList){
WhiteList[msg.sender] = WhiteList[msg.sender].sub(numberToMint);
}
}
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);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
require(balance.sub(TotalJackpotInWei) > 0, '"No funds available to withdraw');
payable(msg.sender).transfer(balance.sub(TotalJackpotInWei));
}
//withdraw link or any other ERC tokens
function withdrawTokens(IERC20 token) public onlyOwner {
require(address(token) != address(0));
uint256 balance = token.balanceOf(address(this));
token.transfer(msg.sender, balance);
}
function endSale() public onlyOwner onSale {
require(!paused(), "cannot close sale whilst paused");
require(_maxTokens == totalSupply(), "cannot close sale before it's sold out");
// once this action is completed the base URI cannot be changed
// and contract cannot be paused.
_saleComplete = true;
emit CloseSale(msg.sender);
}
modifier onSale() {
require(!_saleComplete, "Sale closed. Action cannot be completed");
_;
}
function setCurrentJackpot(uint256 _currentJackpotInWei) public onlyOwner {
CurrentJackpotInWei = _currentJackpotInWei;
}
//not onlyOwner.. Anyone can add money to the jackpot
function topUpJackpot() public payable nonReentrant {
TotalJackpotInWei = TotalJackpotInWei.add(msg.value);
}
function setLottoSeed() public onlyOwner returns (bytes32 requestId) {
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract");
require(randomResult == 0, "Cannot set lotto seed if it is already set");
return requestRandomness(keyHash, fee);
}
function getProjectData() public view returns (bool _onlyWhiteList, uint256 _unitCost, uint256 _currentJackpot, uint256 _totalJackpot, uint256 _nextLottoTimestamp, uint256 _totalSupply, bool _isPaused) {
_currentJackpot = CurrentJackpotInWei;
_totalJackpot = TotalJackpotInWei;
_nextLottoTimestamp = NextLottoDraw;
_isPaused = paused();
_totalSupply = totalSupply();
_unitCost = unitCost;
_onlyWhiteList = OnlyWhiteList;
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
} | fulfillRandomness | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
randomResult = randomness;
}
| /**
* Callback function used by VRF Coordinator
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | {
"func_code_index": [
10660,
10793
]
} | 11,393 |
||||
IdolMintContract | contracts/OfferingRefundContract.sol | 0x7b4b02372d8e54c1c0454d97f01d85ef203cdc5e | Solidity | OfferingRefundContract | contract OfferingRefundContract is Ownable {
// merkleRoot is the value of the root of the Merkle Tree used for authenticating airdrop claims.
bytes32 public merkleRoot;
// alreadyClaimed stores whether an address has already claimed its eligible refund.
mapping(address => bool) public alreadyClaimed;
constructor() {}
/**
@notice receive is implemented to allow this contract to receive ETH from IdolMintContract.
Any ETH sent to this contract can then be withdrawn by addresses eligible for refund.
*/
receive() external payable {}
/**
@notice setMerkleRoot is used to set the root of the Merkle Tree that we will use to
authenticate which users are eligible to withdraw refunds from this contract.
*/
function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
/**
@notice claimRefund will claim the ETH refund that an address is eligible to claim. The caller
must pass the exact amount of ETH that the address is eligible to claim.
@param _to The address to claim refund for.
@param _refundAmount The amount of ETH refund to claim.
@param _merkleProof The merkle proof used to authenticate the transaction against the Merkle
root.
*/
function claimRefund(address _to, uint _refundAmount, bytes32[] calldata _merkleProof) external {
require(!alreadyClaimed[_to], "Refund has already been claimed for this address");
// Verify against the Merkle tree that the transaction is authenticated for the user.
bytes32 leaf = keccak256(abi.encodePacked(_to, _refundAmount));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Failed to authenticate with merkle tree");
alreadyClaimed[_to] = true;
Address.sendValue(payable(_to), _refundAmount);
}
} | /**
@notice OfferingRefundContract is an airdrop contract which allows authenticated users to claim a
portion of the contract's Ethereum based on how much they overpaid compared to the last price
of the dutch auction. All of the calculations on how much ETH to refund to which users are
calculated off-chain and authenticated through the Merkle tree.
*/ | NatSpecMultiLine | /**
@notice receive is implemented to allow this contract to receive ETH from IdolMintContract.
Any ETH sent to this contract can then be withdrawn by addresses eligible for refund.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | {
"func_code_index": [
532,
563
]
} | 11,394 |
||||
IdolMintContract | contracts/OfferingRefundContract.sol | 0x7b4b02372d8e54c1c0454d97f01d85ef203cdc5e | Solidity | OfferingRefundContract | contract OfferingRefundContract is Ownable {
// merkleRoot is the value of the root of the Merkle Tree used for authenticating airdrop claims.
bytes32 public merkleRoot;
// alreadyClaimed stores whether an address has already claimed its eligible refund.
mapping(address => bool) public alreadyClaimed;
constructor() {}
/**
@notice receive is implemented to allow this contract to receive ETH from IdolMintContract.
Any ETH sent to this contract can then be withdrawn by addresses eligible for refund.
*/
receive() external payable {}
/**
@notice setMerkleRoot is used to set the root of the Merkle Tree that we will use to
authenticate which users are eligible to withdraw refunds from this contract.
*/
function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
/**
@notice claimRefund will claim the ETH refund that an address is eligible to claim. The caller
must pass the exact amount of ETH that the address is eligible to claim.
@param _to The address to claim refund for.
@param _refundAmount The amount of ETH refund to claim.
@param _merkleProof The merkle proof used to authenticate the transaction against the Merkle
root.
*/
function claimRefund(address _to, uint _refundAmount, bytes32[] calldata _merkleProof) external {
require(!alreadyClaimed[_to], "Refund has already been claimed for this address");
// Verify against the Merkle tree that the transaction is authenticated for the user.
bytes32 leaf = keccak256(abi.encodePacked(_to, _refundAmount));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Failed to authenticate with merkle tree");
alreadyClaimed[_to] = true;
Address.sendValue(payable(_to), _refundAmount);
}
} | /**
@notice OfferingRefundContract is an airdrop contract which allows authenticated users to claim a
portion of the contract's Ethereum based on how much they overpaid compared to the last price
of the dutch auction. All of the calculations on how much ETH to refund to which users are
calculated off-chain and authenticated through the Merkle tree.
*/ | NatSpecMultiLine | setMerkleRoot | function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
| /**
@notice setMerkleRoot is used to set the root of the Merkle Tree that we will use to
authenticate which users are eligible to withdraw refunds from this contract.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | {
"func_code_index": [
749,
849
]
} | 11,395 |
||
IdolMintContract | contracts/OfferingRefundContract.sol | 0x7b4b02372d8e54c1c0454d97f01d85ef203cdc5e | Solidity | OfferingRefundContract | contract OfferingRefundContract is Ownable {
// merkleRoot is the value of the root of the Merkle Tree used for authenticating airdrop claims.
bytes32 public merkleRoot;
// alreadyClaimed stores whether an address has already claimed its eligible refund.
mapping(address => bool) public alreadyClaimed;
constructor() {}
/**
@notice receive is implemented to allow this contract to receive ETH from IdolMintContract.
Any ETH sent to this contract can then be withdrawn by addresses eligible for refund.
*/
receive() external payable {}
/**
@notice setMerkleRoot is used to set the root of the Merkle Tree that we will use to
authenticate which users are eligible to withdraw refunds from this contract.
*/
function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
/**
@notice claimRefund will claim the ETH refund that an address is eligible to claim. The caller
must pass the exact amount of ETH that the address is eligible to claim.
@param _to The address to claim refund for.
@param _refundAmount The amount of ETH refund to claim.
@param _merkleProof The merkle proof used to authenticate the transaction against the Merkle
root.
*/
function claimRefund(address _to, uint _refundAmount, bytes32[] calldata _merkleProof) external {
require(!alreadyClaimed[_to], "Refund has already been claimed for this address");
// Verify against the Merkle tree that the transaction is authenticated for the user.
bytes32 leaf = keccak256(abi.encodePacked(_to, _refundAmount));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Failed to authenticate with merkle tree");
alreadyClaimed[_to] = true;
Address.sendValue(payable(_to), _refundAmount);
}
} | /**
@notice OfferingRefundContract is an airdrop contract which allows authenticated users to claim a
portion of the contract's Ethereum based on how much they overpaid compared to the last price
of the dutch auction. All of the calculations on how much ETH to refund to which users are
calculated off-chain and authenticated through the Merkle tree.
*/ | NatSpecMultiLine | claimRefund | function claimRefund(address _to, uint _refundAmount, bytes32[] calldata _merkleProof) external {
require(!alreadyClaimed[_to], "Refund has already been claimed for this address");
// Verify against the Merkle tree that the transaction is authenticated for the user.
bytes32 leaf = keccak256(abi.encodePacked(_to, _refundAmount));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Failed to authenticate with merkle tree");
alreadyClaimed[_to] = true;
Address.sendValue(payable(_to), _refundAmount);
}
| /**
@notice claimRefund will claim the ETH refund that an address is eligible to claim. The caller
must pass the exact amount of ETH that the address is eligible to claim.
@param _to The address to claim refund for.
@param _refundAmount The amount of ETH refund to claim.
@param _merkleProof The merkle proof used to authenticate the transaction against the Merkle
root.
*/ | NatSpecMultiLine | v0.8.9+commit.e5eed63a | {
"func_code_index": [
1257,
1800
]
} | 11,396 |
||
CashCowCapital | CashCowCapital.sol | 0x173a7d4d5a4ca19c07c5c3b608a7764c97ea12cf | Solidity | Auth | abstract contract Auth {
address internal owner;
constructor(address _owner) {
owner = _owner;
}
/**
* Function modifier to require caller to be contract deployer
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!Owner"); _;
}
/**
* Check if address is owner
*/
function isOwner(address account) public view returns (bool) {
return account == owner;
}
/**
* Transfer ownership to new address. Caller must be deployer. Leaves old deployer authorized
*/
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
} | /**
* Allows for contract ownership along with multi-address authorization
*/ | NatSpecMultiLine | isOwner | function isOwner(address account) public view returns (bool) {
return account == owner;
}
| /**
* Check if address is owner
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | Unlicense | ipfs://595d0301a67f5dabe6978569fd55a6900215c6421e408d898c2a3701503af9b0 | {
"func_code_index": [
353,
461
]
} | 11,397 |
CashCowCapital | CashCowCapital.sol | 0x173a7d4d5a4ca19c07c5c3b608a7764c97ea12cf | Solidity | Auth | abstract contract Auth {
address internal owner;
constructor(address _owner) {
owner = _owner;
}
/**
* Function modifier to require caller to be contract deployer
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!Owner"); _;
}
/**
* Check if address is owner
*/
function isOwner(address account) public view returns (bool) {
return account == owner;
}
/**
* Transfer ownership to new address. Caller must be deployer. Leaves old deployer authorized
*/
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
} | /**
* Allows for contract ownership along with multi-address authorization
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
emit OwnershipTransferred(adr);
}
| /**
* Transfer ownership to new address. Caller must be deployer. Leaves old deployer authorized
*/ | NatSpecMultiLine | v0.8.7+commit.e28d00a7 | Unlicense | ipfs://595d0301a67f5dabe6978569fd55a6900215c6421e408d898c2a3701503af9b0 | {
"func_code_index": [
581,
722
]
} | 11,398 |
CashCowCapital | CashCowCapital.sol | 0x173a7d4d5a4ca19c07c5c3b608a7764c97ea12cf | Solidity | DividendDistributor | contract DividendDistributor is IDividendDistributor {
using SafeMath for uint256;
address public _token;
address public _owner;
address public _treasury;
struct Share {
uint256 amount;
uint256 totalExcluded;
uint256 totalClaimed;
}
address[] private shareholders;
mapping (address => uint256) private shareholderIndexes;
mapping (address => Share) public shares;
uint256 public totalShares;
uint256 public totalDividends;
uint256 public totalClaimed;
uint256 public dividendsPerShare;
uint256 private dividendsPerShareAccuracyFactor = 10 ** 36;
modifier onlyToken() {
require(msg.sender == _token); _;
}
modifier onlyOwner() {
require(msg.sender == _owner); _;
}
constructor (address owner, address treasury) {
_token = msg.sender;
_owner = payable(owner);
_treasury = payable(treasury);
}
// receive() external payable { }
function setShare(address shareholder, uint256 amount) external override onlyToken {
if(shares[shareholder].amount > 0){
distributeDividend(shareholder);
}
if(amount > 0 && shares[shareholder].amount == 0){
addShareholder(shareholder);
}else if(amount == 0 && shares[shareholder].amount > 0){
removeShareholder(shareholder);
}
totalShares = totalShares.sub(shares[shareholder].amount).add(amount);
shares[shareholder].amount = amount;
shares[shareholder].totalExcluded = getCumulativeDividends(shares[shareholder].amount);
}
function deposit() external payable override {
uint256 amount = msg.value;
totalDividends = totalDividends.add(amount);
dividendsPerShare = dividendsPerShare.add(dividendsPerShareAccuracyFactor.mul(amount).div(totalShares));
}
function distributeDividend(address shareholder) internal {
if(shares[shareholder].amount == 0){ return; }
uint256 amount = getClaimableDividendOf(shareholder);
if(amount > 0){
totalClaimed = totalClaimed.add(amount);
shares[shareholder].totalClaimed = shares[shareholder].totalClaimed.add(amount);
shares[shareholder].totalExcluded = getCumulativeDividends(shares[shareholder].amount);
payable(shareholder).transfer(amount);
}
}
function claimDividend(address shareholder) external override onlyToken {
distributeDividend(shareholder);
}
function getClaimableDividendOf(address shareholder) public view returns (uint256) {
if(shares[shareholder].amount == 0){ return 0; }
uint256 shareholderTotalDividends = getCumulativeDividends(shares[shareholder].amount);
uint256 shareholderTotalExcluded = shares[shareholder].totalExcluded;
if(shareholderTotalDividends <= shareholderTotalExcluded){ return 0; }
return shareholderTotalDividends.sub(shareholderTotalExcluded);
}
function getCumulativeDividends(uint256 share) internal view returns (uint256) {
return share.mul(dividendsPerShare).div(dividendsPerShareAccuracyFactor);
}
function addShareholder(address shareholder) internal {
shareholderIndexes[shareholder] = shareholders.length;
shareholders.push(shareholder);
}
function removeShareholder(address shareholder) internal {
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length-1];
shareholderIndexes[shareholders[shareholders.length-1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
function manualSend(uint256 amount, address holder) external onlyOwner {
uint256 contractETHBalance = address(this).balance;
payable(holder).transfer(amount > 0 ? amount : contractETHBalance);
}
function setTreasury(address treasury) external override onlyToken {
_treasury = payable(treasury);
}
function getDividendsClaimedOf (address shareholder) external override view returns (uint256) {
require (shares[shareholder].amount > 0, "You're not a CCC shareholder!");
return shares[shareholder].totalClaimed;
}
} | setShare | function setShare(address shareholder, uint256 amount) external override onlyToken {
if(shares[shareholder].amount > 0){
distributeDividend(shareholder);
}
if(amount > 0 && shares[shareholder].amount == 0){
addShareholder(shareholder);
}else if(amount == 0 && shares[shareholder].amount > 0){
removeShareholder(shareholder);
}
totalShares = totalShares.sub(shares[shareholder].amount).add(amount);
shares[shareholder].amount = amount;
shares[shareholder].totalExcluded = getCumulativeDividends(shares[shareholder].amount);
}
| // receive() external payable { } | LineComment | v0.8.7+commit.e28d00a7 | Unlicense | ipfs://595d0301a67f5dabe6978569fd55a6900215c6421e408d898c2a3701503af9b0 | {
"func_code_index": [
1027,
1676
]
} | 11,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.