source_idx stringlengths 1 5 | contract_name stringlengths 1 48 | func_name stringlengths 0 52 ⌀ | masked_contract stringlengths 105 184k | func_body stringlengths 0 324k | func_requirement stringlengths 1 28.3k |
|---|---|---|---|---|---|
85503 | TokenERC20 | transferFrom | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _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 |
85503 | TokenERC20 | approve | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
allowance[msg.sender][_spender] = _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 |
85503 | TokenERC20 | approveAndCall | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
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 s... |
85503 | TokenERC20 | burn | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
| *
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn |
85503 | TokenERC20 | burnFrom | contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (addre... |
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender... | *
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn |
85503 | EOCSToken | EOCSToken | contract EOCSToken is TokenERC20 {
/* Initializes contract with initial supply tokens to the creator of the contract */
function EOCSToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {<FILL_FUNCTION_B... | Initializes contract with initial supply tokens to the creator of the contract | |
85504 | Ownable | null | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... |
owner = msg.sender;
| *
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account. |
85504 | Ownable | renounceOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... |
emit OwnershipRenounced(owner);
owner = address(0);
| *
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore. |
85504 | Ownable | transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... |
_transferOwnership(_newOwner);
| *
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85504 | Ownable | _transferOwnership | contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... |
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
| *
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to. |
85504 | Pausable | pause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modif... |
paused = true;
emit Pause();
| *
* @dev called by the owner to pause, triggers stopped state |
85504 | Pausable | unpause | contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modif... |
paused = false;
emit Unpause();
| *
* @dev called by the owner to unpause, returns to normal state |
85504 | StandardToken | totalSupply | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
return totalSupply_;
| *
* @dev Total number of tokens in existence |
85504 | StandardToken | balanceOf | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
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. |
85504 | StandardToken | allowance | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
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. |
85504 | StandardToken | transfer | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
require(_value <= balances[msg.sender]);
require(_to != address(0));
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. |
85504 | StandardToken | approve | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
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
... |
85504 | StandardToken | transferFrom | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_v... | *
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred |
85504 | StandardToken | increaseApproval | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
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
* @... |
85504 | StandardToken | decreaseApproval | contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public vi... |
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.send... | *
* @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
* @... |
85504 | BurnablePausableERC20Token | burn | contract BurnablePausableERC20Token is PausableERC20Token {
mapping (address => mapping (address => uint256)) internal allowedBurn;
event Burn(address indexed burner, uint256 value);
event ApprovalBurn(
address indexed owner,
address indexed spender,
uint256 value
);... |
_burn(msg.sender, _value);
| *
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned. |
85504 | BurnablePausableERC20Token | burnFrom | contract BurnablePausableERC20Token is PausableERC20Token {
mapping (address => mapping (address => uint256)) internal allowedBurn;
event Burn(address indexed burner, uint256 value);
event ApprovalBurn(
address indexed owner,
address indexed spender,
uint256 value
);... |
require(_value <= allowedBurn[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowedBurn[_from][msg.sender] = allowedBurn[_from][msg.sender].sub(_value);
... | *
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned |
85504 | MMP | null | contract MMP is FreezableBurnablePausableERC20Token {
/** Token Setting: You are free to change any of these
* @param name string The name of your token (can be not unique)
* @param symbol string The symbol of your token (can be not unique, can be more than three characters)
* @param decimals uint... |
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
| *
* @dev Constructor that gives msg.sender all of existing tokens.
* Literally put all the issued money in your pocket |
85505 | yInsure | buyCover | contract yInsure is
ERC721Full("yInsureNFT", "yNFT"),
Ownable,
ReentrancyGuard {
struct Token {
uint expirationTimestamp;
bytes4 coverCurrency;
uint coverAmount;
uint coverPrice;
uint coverPriceNXM;
uint expireTime;
uint generation... |
uint coverPrice = coverDetails[1];
uint requiredValue = distributorFeePercentage.mul(coverPrice).div(100).add(coverPrice);
if (coverCurrency == "ETH") {
require(msg.value == requiredValue, "Incorrect value sent");
} else {
IERC20 erc20 = IERC20(_getCu... | Arguments to be passed as coverDetails, from the quote api:
coverDetails[0] = coverAmount;
coverDetails[1] = coverPrice;
coverDetails[2] = coverPriceNXM;
coverDetails[3] = expireTime;
coverDetails[4] = generationTime; |
85506 | EthPenis | balanceOf | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return tokenBalance[_owner];
| The following functions are used by the front-end for display purposes.
Returns the number of tokens currently held by _owner. |
85506 | EthPenis | withdraw | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase the total amount that's been paid out... | Withdraws all dividends held by the caller sending the transaction, updates
the requisite global variables, and transfers Ether back to the caller. |
85506 | EthPenis | reinvestDividends | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
// Since this is essentially a shortcut to withdrawing and reinvesting, this step still holds.
payouts[msg.sen... | Converts the Ether accrued as dividends back into PNS tokens without having to
withdraw it first. Saves on gas and potential price spike loss. |
85506 | EthPenis | sellMyTokens | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
var balance = balanceOf(msg.sender);
sell(balance);
| Sells your tokens for Ether. This Ether is assigned to the callers entry
in the tokenBalance array, and therefore is shown as a dividend. A second
call to withdraw() must be made to invoke the transfer of Ether back to your address. |
85506 | EthPenis | getMeOutOfHere | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
sellMyTokens();
withdraw();
| The slam-the-button escape hatch. Sells the callers tokens for Ether, then immediately
invokes the withdraw() function, sending the resulting Ether to the callers address. |
85506 | EthPenis | fund | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// Don't allow for funding if the amount of Ether sent is less than 1 szabo.
if (msg.value > 0.000001 ether) {
contractBalance = add(contractBalance, msg.value);
buy();
} else {
revert();
}
| Gatekeeper function to check if the amount of Ether being sent isn't either
too small or too large. If it passes, goes direct to buy(). |
85506 | EthPenis | buyPrice | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return getTokensForEther(1 finney);
| Function that returns the (dynamic) price of buying a finney worth of tokens. |
85506 | EthPenis | sellPrice | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
var eth = getEtherForTokens(1 finney);
var fee = div(eth, 10);
return eth - fee;
| Function that returns the (dynamic) price of selling a single token. |
85506 | EthPenis | dividends | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return (uint256) ((int256)(earningsPerToken * tokenBalance[_owner]) - payouts[_owner]) / scaleFactor;
| Calculate the current dividends associated with the caller address. This is the net result
of multiplying the number of tokens held by their current value in Ether and subtracting the
Ether that has already been paid out. |
85506 | EthPenis | withdrawOld | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase the total amount that's been paid out... | Version of withdraw that extracts the dividends and sends the Ether to the caller.
This is only used in the case when there is no transaction data, and that should be
quite rare unless interacting directly with the smart contract. |
85506 | EthPenis | balance | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// msg.value is the amount of Ether sent by the transaction.
return contractBalance - msg.value;
| Internal balance function, used to calculate the dynamic reserve value. |
85506 | EthPenis | sell | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// Calculate the amount of Ether that the holders tokens sell for at the current sell price.
var numEthersBeforeFee = getEtherForTokens(amount);
// 10% of the resulting Ether is used to pay remaining holders.
var fee = div(numEthersBeforeFee, 10);
// Net Ether for the seller after the f... | Sell function that takes tokens and converts them into Ether. Also comes with a 10% fee
to discouraging dumping, and means that if someone near the top sells, the fee distributed
will be *significant*. |
85506 | EthPenis | reserve | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return sub(balance(),
((uint256) ((int256) (earningsPerToken * totalSupply) - totalPayouts) / scaleFactor));
| Dynamic value of Ether in reserve, according to the CRR requirement. |
85506 | EthPenis | getTokensForEther | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return sub(fixedExp(fixedLog(reserve() + ethervalue)*crr_n/crr_d + price_coeff), totalSupply);
| Calculates the number of tokens that can be bought for a given amount of Ether, according to the
dynamic reserve and totalSupply values (derived from the buy and sell prices). |
85506 | EthPenis | calculateDividendTokens | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
return sub(fixedExp(fixedLog(reserve() - subvalue + ethervalue)*crr_n/crr_d + price_coeff), totalSupply);
| Semantically similar to getTokensForEther, but subtracts the callers balance from the amount of Ether returned for conversion. |
85506 | EthPenis | getEtherForTokens | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// How much reserve Ether do we have left in the contract?
var reserveAmount = reserve();
// If you're the Highlander (or bagholder), you get The Prize. Everything left in the vault.
if (tokens == totalSupply)
return reserveAmount;
// If there would be excess Ether left after the transaction thi... | Converts a number tokens into an Ether value. |
85506 | EthPenis | fixedLog | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
int32 scale = 0;
while (a > sqrt2) {
a /= 2;
scale++;
}
while (a <= sqrtdot5) {
a *= 2;
scale--;
}
int256 s = (((int256)(a) - one) * one) / ((int256)(a) + one);
var z = (s*s) / one;
return scale * ln2 +
(s*(c1 + (z*(c3 + (z*(c5 + (z*(c7 + (z*(c9 + (z*c11/one))
/one))/on... | The polynomial R = c1*x + c3*x^3 + ... + c11 * x^11
approximates the function log(1+x)-log(1-x)
Hence R(s) = log((1+s)/(1-s)) = log(a) |
85506 | EthPenis | fixedExp | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
int256 scale = (a + (ln2_64dot5)) / ln2 - 64;
a -= scale*ln2;
int256 z = (a*a) / one;
int256 R = ((int256)(2) * one) +
(z*(c2 + (z*(c4 + (z*(c6 + (z*c8/one))/one))/one))/one);
exp = (uint256) (((R + a) * one) / (R - a));
if (scale >= 0)
exp <<= scale;
else
exp >>= -scale;
return exp... | The polynomial R = 2 + c2*x^2 + c4*x^4 + ...
approximates the function x*(exp(x)+1)/(exp(x)-1)
Hence exp(x) = (R(x)+x)/(R(x)-x) |
85506 | EthPenis | mul | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
| The below are safemath implementations of the four arithmetic operators
designed to explicitly prevent over- and under-flows of integer values. |
85506 | EthPenis | contract EthPenis {
// scaleFactor is used to convert Ether into tokens and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000; // 2^64
// CRR = 50%
// CRR is Cash Reserve Ratio (in this case Crypto Reserve... |
// msg.value is the amount of Ether sent by the transaction.
if (msg.value > 0) {
fund();
} else {
if(msg.sender == owner && contractBalance <= 1 ether){ //if it didn't work out and nobody bought in
if(contractBalance == 1 ether)
owner.transfer(1 ether);
else
... | This allows you to buy tokens by sending Ether directly to the smart contract
without including any transaction data (useful for, say, mobile wallet apps). | |
85507 | GOKU | name | contract GOKU is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _initialSupply = 1e15*1e18;
string private _name = "G... |
return _name;
| *
* @dev Returns the name of the token. |
85508 | PITOKEN | null | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
symbol = "PIT";
name = "Pi Token";
decimals = 18;
_totalSupply = 1000000000000000000000000000;
balances[0xe1c38876fC6e87a009FBf5475267341F5659143B] = _totalSupply;
emit Transfer(address(0), 0xe1c38876fC6e87a009FBf5475267341F5659143B, _totalSupply);
| ------------------------------------------------------------------------
Constructor
------------------------------------------------------------------------ |
85508 | PITOKEN | totalSupply | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
return _totalSupply - balances[address(0)];
| ------------------------------------------------------------------------
Total supply
------------------------------------------------------------------------ |
85508 | PITOKEN | balanceOf | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
return balances[tokenOwner];
| ------------------------------------------------------------------------
Get the token balance for account tokenOwner
------------------------------------------------------------------------ |
85508 | PITOKEN | transfer | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
| ------------------------------------------------------------------------
Transfer the balance from token owner's account to to account
- Owner's account must have sufficient balance to transfer
- 0 value transfers are allowed
------------------------------------------------------------------------ |
85508 | PITOKEN | approve | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
| https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
recommends that there are no checks for the approval double-spend attack
as this should be implemented in user interfaces
------------------------------------------------------------------------ |
85508 | PITOKEN | transferFrom | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
| The calling account must already have sufficient tokens approve(...)-d
for spending from the from account and
- From account must have sufficient balance to transfer
- Spender must have sufficient allowance to transfer
- 0 value transfers are allowed
---------------------------------------------------------------------... |
85508 | PITOKEN | allowance | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
return allowed[tokenOwner][spender];
| ------------------------------------------------------------------------
Returns the amount of tokens approved by the owner that can be
transferred to the spender's account
------------------------------------------------------------------------ |
85508 | PITOKEN | approveAndCall | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
| ------------------------------------------------------------------------
Token owner can approve for spender to transferFrom(...) tokens
from the token owner's account. The spender contract function
receiveApproval(...) is then executed
------------------------------------------------------------------------ |
85508 | PITOKEN | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
revert();
| ------------------------------------------------------------------------
Don't accept ETH
------------------------------------------------------------------------ | |
85508 | PITOKEN | transferAnyERC20Token | contract PITOKEN is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// -----------------------------------------... |
return ERC20Interface(tokenAddress).transfer(owner, tokens);
| ------------------------------------------------------------------------
Owner can transfer out any accidentally sent ERC20 tokens
------------------------------------------------------------------------ |
85510 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 bal... | / @return total amount of tokens | |
85510 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {<FILL_FUNCTIO... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
85510 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `msg.sender`
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85510 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/ @param _from The address of the sender
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85510 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice `msg.sender` approves `_addr` to spend `_value` tokens
/ @param _spender The address of the account able to transfer the tokens
/ @param _value The amount of wei to be approved for transfer
/ @return Whether the approval was successful or not | |
85510 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @param _owner The address of the account owning tokens
/ @param _spender The address of the account able to transfer the tokens
/ @return Amount of remaining tokens allowed to spent | |
85510 | ICOBlaster | ICOBlaster | contract ICOBlaster is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces m... |
balances[msg.sender] = 10000000000000000000000000000000; // Give the creator all initial tokens.
totalSupply = 10000000000000000000000000000000; // Update total supply
name = "ICOBlaster"; // Set the name fo... | Where should the raised ETH go?
This is a constructor function
which means the following function name has to match the contract name declared above |
85510 | ICOBlaster | approveAndCall | contract ICOBlaster is StandardToken {
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces m... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
85512 | Token | totalSupply | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {<FILL_FUNCTION_BODY>}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 bal... | / @return total amount of tokens | |
85512 | Token | balanceOf | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {<FILL_FUNCTIO... | / @param _owner The address from which the balance will be retrieved
/ @return The balance | |
85512 | Token | transfer | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `msg.sender`
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85512 | Token | transferFrom | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/ @param _from The address of the sender
/ @param _to The address of the recipient
/ @param _value The amount of token to be transferred
/ @return Whether the transfer was successful or not | |
85512 | Token | approve | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @notice `msg.sender` approves `_addr` to spend `_value` tokens
/ @param _spender The address of the account able to transfer the tokens
/ @param _value The amount of wei to be approved for transfer
/ @return Whether the approval was successful or not | |
85512 | Token | allowance | contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// ... | / @param _owner The address of the account owning tokens
/ @param _spender The address of the account able to transfer the tokens
/ @return Amount of remaining tokens allowed to spent | |
85512 | SCFToken | SCFToken | contract SCFToken is StandardToken { // CHANGE THIS. Update the contract name.
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functi... |
balances[msg.sender] = 1000000000000; // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS)
totalSupply = 1000000000000; // Update total s... | Where should the raised ETH go?
This is a constructor function
which means the following function name has to match the contract name declared above |
85512 | SCFToken | approveAndCall | contract SCFToken is StandardToken { // CHANGE THIS. Update the contract name.
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functi... |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApprov... | Approves and then calls the receiving contract |
85513 | CasInu | owner | contract CasInu is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) pr... |
return _owner;
| ===============================================================================================================
===============================================================================================================
================================================================================================... |
85513 | CasInu | totalSupply | contract CasInu is Context, IERC20 {
// Ownership moved to in-contract for customizability.
address private _owner;
mapping (address => uint256) private _tOwned;
mapping (address => bool) lpPairs;
uint256 private timeSinceLastPair = 0;
mapping (address => mapping (address => uint256)) pr... | return _tTotal; | ===============================================================================================================
===============================================================================================================
================================================================================================... |
85515 | Ownable | Ownable | contract Ownable {
address public owner; //owner's address
function Ownable() public
{<FILL_FUNCTION_BODY>}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/*
* Funtion: Transfer owner's authority
* Type:Public and onlyOwner
* Parameters:
@newOwner: address of ne... |
owner = msg.sender;
| owner's address |
85515 | Ownable | transferOwnership | contract Ownable {
address public owner; //owner's address
function Ownable() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/*
* Funtion: Transfer owner's authority
* Type:Public and onlyOwner
* Parameters:
@newOwner: address... |
if (newOwner != address(0)) {
owner = newOwner;
}
| * Funtion: Transfer owner's authority
* Type:Public and onlyOwner
* Parameters:
@newOwner: address of newOwner |
85515 | XiaomiToken | XiaomiToken | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
... | Event on blockchain which notify client
===================events definition end==================
===================Contract Initialization Sequence Definition start=================== |
85515 | XiaomiToken | _transfer | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
//Fault-tolerant processing
require(_to != 0x0); //
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
//Execute transaction
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf... | ===================Contract Initialization Sequence definition end===================
===================Contract behavior & funtions definition start===================
* Funtion: Transfer funtions
* Type:Internal
* Parameters:
@_from: address of sender's account
@_to: address of recipient's account
@_... |
85515 | XiaomiToken | transfer | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
_transfer(msg.sender, _to, _value);
| * Funtion: Transfer tokens
* Type:Public
* Parameters:
@_to: address of recipient's account
@_value:transaction amount |
85515 | XiaomiToken | transferFrom | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
require(_value <= allowance[_from][msg.sender]); //Allowance verification
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
| * Funtion: Transfer tokens from other address
* Type:Public
* Parameters:
@_from: address of sender's account
@_to: address of recipient's account
@_value:transaction amount |
85515 | XiaomiToken | approve | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
allowance[msg.sender][_spender] = _value;
return true;
| * Funtion: Approve usable amount for an account
* Type:Public
* Parameters:
@_spender: address of spender's account
@_value: approve amount |
85515 | XiaomiToken | approveAndCall | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
| * Funtion: Approve usable amount for other address and then notify the contract
* Type:Public
* Parameters:
@_spender: address of other account
@_value: approve amount
@_extraData:additional information to send to the approved contract |
85515 | XiaomiToken | transferOwnershipWithBalance | contract XiaomiToken is Ownable{
//===================public variables definition start==================
string public name; //Name of your Token
string public symbol; //Symbol of your Token
uint8 public decimals = 18; //Decimals of your Token
uint256 pu... |
if (newOwner != address(0)) {
_transfer(owner,newOwner,balanceOf[owner]);
owner = newOwner;
}
| * Funtion: Transfer owner's authority and account balance
* Type:Public and onlyOwner
* Parameters:
@newOwner: address of newOwner |
85516 | Ownable | null | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85516 | Ownable | owner | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85516 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
85516 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85516 | Ownable | lock | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
_previousOwner = _owner;
_owner = address(0);
_lockTime = block.timestamp + time;
emit OwnershipTransferred(_owner, address(0));
| Locks the contract for owner for the amount of time provided |
85516 | Ownable | unlock | contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as th... |
require(
_previousOwner == msg.sender,
"You don't have permission to unlock"
);
require(block.timestamp > _lockTime, "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
| Unlocks the contract for owner when _lockTime is exceeds |
85516 | NIL | null | contract NIL is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) priv... | to recieve ETH from uniswapV2Router when swaping | |
85516 | NIL | _tokenTransfer | contract NIL is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) priv... |
if (!canTrade) {
// only whitelisted accounts buy or sender can trade
if (!(whitelist[sender] || whitelist[recipient])) {
require(sender == owner());
}
}
if (!takeFee) removeAllFee();
if (_isExcluded[sender] && !_isExcluded... | this method is responsible for taking all fee, if takeFee is true |
85517 | MerkleTreeGenerator | ReceiptsToLeaves | contract MerkleTreeGenerator is Owned {
using SafeMath for uint256;
event Log(bytes data);
LockMapping candyReceipt = LockMapping(0x91517330816D4727EDc7C3F5Ae4CC5beF02Ec70f);
uint256 constant pathMaximalLength = 7;
uint256 constant public MerkleTreeMaximalLeafCount = 1 << pathMaximalLength;
uint256... |
bytes32[] memory leaves = new bytes32[](_leafCount);
for(uint256 i = _start; i< _start + _leafCount; i++) {
(
,
,
string memory targetAddress,
uint256 amount,
,
,
bool finished
) = candyReceipt.receipts(i);
... | fetch receipts |
85517 | MerkleTreeGenerator | GenerateMerkleTree | contract MerkleTreeGenerator is Owned {
using SafeMath for uint256;
event Log(bytes data);
LockMapping candyReceipt = LockMapping(0x91517330816D4727EDc7C3F5Ae4CC5beF02Ec70f);
uint256 constant pathMaximalLength = 7;
uint256 constant public MerkleTreeMaximalLeafCount = 1 << pathMaximalLength;
uint256... |
uint256 receiptCount = candyReceipt.receiptCount() - ReceiptCountInTree;
require(receiptCount > 0);
uint256 leafCount = receiptCount < MerkleTreeMaximalLeafCount ? receiptCount : MerkleTreeMaximalLeafCount;
bytes32[] memory leafNodes = ReceiptsToLeaves(ReceiptCountInTree, leafCount, true)... | create new receipt |
85517 | MerkleTreeGenerator | GenerateMerklePath | contract MerkleTreeGenerator is Owned {
using SafeMath for uint256;
event Log(bytes data);
LockMapping candyReceipt = LockMapping(0x91517330816D4727EDc7C3F5Ae4CC5beF02Ec70f);
uint256 constant pathMaximalLength = 7;
uint256 constant public MerkleTreeMaximalLeafCount = 1 << pathMaximalLength;
uint256... |
require(receiptId < ReceiptCountInTree);
uint256 treeIndex = MerkleTreeCount - 1;
for (; treeIndex >= 0 ; treeIndex--){
if (receiptId >= indexToMerkleTree[treeIndex].first_recipt_id)
break;
}
bytes32[pathMaximalLength] memory neighbors;
... | get users merkle tree path |
85518 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {<FILL_FUNCTION_BODY>}
/**
... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85518 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85518 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the ... |
85518 | Ownable | transferOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... |
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
| *
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner. |
85519 | Ownable | null | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {<FILL_FUNCTION_BODY>}
/**
* @dev Returns the addres... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
85519 | Ownable | owner | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSen... |
return _owner;
| *
* @dev Returns the address of the current owner. |
85519 | Ownable | renounceOwnership | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSen... |
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
| *
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.