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 |
|---|---|---|---|---|---|
311 | ERC721 | _safeTransfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
| *
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This i... |
311 | ERC721 | _exists | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
return _owners[tokenId] != address(0);
| *
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`). |
311 | ERC721 | _isApprovedOrOwner | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
| *
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist. |
311 | ERC721 | _safeMint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
_safeMint(to, tokenId, "");
| *
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event. |
311 | ERC721 | _safeMint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| *
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients. |
311 | ERC721 | _mint | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| *
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event. |
311 | ERC721 | _burn | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
| *
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event. |
311 | ERC721 | _transfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
... | *
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event. |
311 | ERC721 | _approve | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
| *
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event. |
311 | ERC721 | _checkOnERC721Received | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... |
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
... | *
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the to... |
311 | ERC721 | _beforeTokenTransfer | contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _ow... | *
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to... | |
312 | Priced | setPriceData | contract Priced is Ownable {
uint256 private price = 500000000000000000; // Basic price in wei
uint16 private zMax = 1600; // Max z for get price percent
uint256 private zPrice = 25000000000000000; // Price for each item in z index (in wei)
uint8 private commis... |
price = _price;
zMax = _zMax;
zPrice = _zPrice;
commission = _commission;
| Update commission in percent |
312 | Control | withdrawBalance | contract Control is Ownable {
/**
* Withdraw balance
*/
function withdrawBalance(address recipient, uint256 value) external onlyOwner {<FILL_FUNCTION_BODY>}
} |
require(value > 0);
require(value < address(this).balance);
recipient.transfer(value);
| *
* Withdraw balance |
312 | Storage | addStar | contract Storage {
struct Star {
address owner; // Star owner
uint8 gid; // Star galaxy id
uint8 zIndex; // Star z
uint16 box; // Current xy box
uint8 inbox; // Random x-y in box
uint8 stype; // Star type
uint8 color; // St... |
Star memory _star = Star({
owner: owner,
gid: gid, zIndex: zIndex, box: box, inbox: inbox,
stype: stype, color: color,
price: price, sell: 0, deleted: false, name: "", message: ""
});
uint256 starId = stars.push(_star) - 1;
placeSt... | *
* Add new star |
312 | Storage | getStar | contract Storage {
struct Star {
address owner; // Star owner
uint8 gid; // Star galaxy id
uint8 zIndex; // Star z
uint16 box; // Current xy box
uint8 inbox; // Random x-y in box
uint8 stype; // Star type
uint8 color; // St... |
Star storage _star = stars[starId];
owner = _star.owner;
gid = _star.gid;
zIndex = _star.zIndex;
box = _star.box;
inbox = _star.inbox;
stype = _star.stype;
color = _star.color;
price = _star.pric... | *
* Get star by id |
312 | Validation | setValidationData | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
zMin = _zMin;
zMax = _zMax;
lName = _lName;
lMessage = _lMessage;
maxCT = _maxCT;
maxIRandom = _maxIR;
boxSize = _boxSize;
inboxXY = uint8((boxSize * boxSize) / 4);
| *
* Set validation data |
312 | Validation | setBoxCount | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
require(isValidZ(z));
boxes[getZIndex(z)] = count;
| *
* Get set boxes |
312 | Validation | getZIndex | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
return uint8(z / boxSize);
| *
* Get z index and z count |
312 | Validation | isValidGid | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
return gid > 0 && gid <= gidMax;
| *
* Validate star parameters |
312 | Validation | isValidNameLength | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
return UTF8.getStringLength(name) <= lName;
| *
* Check name and message length |
312 | Validation | isValidMsgValue | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
if (msg.value < price) return false;
if (msg.value > price)
msg.sender.transfer(msg.value - price);
return true;
| *
* Check is valid msg value |
312 | Validation | getRandom16 | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
nonce++;
return Math.rand16(nonce, min, max);
| *
* Get random number |
312 | Validation | getRandomPosition | contract Validation is Priced, Storage {
uint8 private gidMax = 5;
uint16 private zMin = 100;
uint16 private zMax = 1600;
uint8 private lName = 25;
uint8 private lMessage = 140;
uint8 private maxCT = 255; // Max color, types
uint256 private nonce ... |
uint16 boxCount = getBoxCountZIndex(zIndex);
uint16 randBox = 0;
if (boxCount == 0) revert();
uint8 ii = maxIRandom;
bool valid = false;
while (!valid && ii > 0) {
randBox = getRandom16(0, boxCount);
valid = isValidBox(gid, zIndex, ... | *
* Get random star position |
312 | Stars | Stars | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Add star with zero index
uint256 starId = addStar(address(0), 0, 0, 0, 0, 0, 0, 0);
setStarNameMessage(starId, "Universe", "Big Bang!");
| *
* Constructor |
312 | Stars | createStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Check basic requires
require(isValidGid(gid));
require(isValidZ(z));
require(isValidNameLength(name));
require(isValidMessageLength(message));
// Get zIndex
uint8 zIndex = getZIndex(z);
uint256 starPrice = getCreatePrice(z, getZCount(gid... | *
* Create star |
312 | Stars | updateStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Exists and owned star
require(starExists(starId));
require(isStarOwner(starId, msg.sender));
// Check basic requires
require(isValidNameLength(name));
require(isValidMessageLength(message));
// Get star update price
uint256 commissi... | *
* Update start method |
312 | Stars | deleteStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Exists and owned star
require(starExists(starId));
require(isStarOwner(starId, msg.sender));
// Get star update price
uint256 commission = getCommission(stars[starId].price);
require(isValidMsgValue(commission));
// Update star data
setStar... | *
* Delete star |
312 | Stars | sellStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Exists and owned star
require(starExists(starId));
require(isStarOwner(starId, msg.sender));
require(sellPrice < 10**28);
// Set star sell price
setStarSellPrice(starId, sellPrice);
emit StarUpdated(starId, 2);
| *
* Set star sell price |
312 | Stars | giftStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Check star exists owned
require(starExists(starId));
require(recipient != address(0));
require(isStarOwner(starId, msg.sender));
require(!isStarOwner(starId, recipient));
// Get gift commission
uint256 commission = getCommission(stars[starId].price);
... | *
* Gift star |
312 | Stars | buyStar | contract Stars is Control, Validation {
// Contrac events
event StarCreated(uint256 starId);
event StarUpdated(uint256 starId, uint8 reason);
event StarDeleted(uint256 starId, address owner);
event StarSold (uint256 starId, address seller, address buyer, uint256 price);
event StarGifted ... |
// Exists and NOT owner
require(starExists(starId));
require(!isStarOwner(starId, msg.sender));
require(stars[starId].sell > 0);
// Get sell commission and check value
uint256 commission = getCommission(stars[starId].price);
uint256 starPrice = stars[st... | *
* Buy star |
316 | 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 | |
316 | 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 | |
316 | 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 | |
316 | 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 | |
316 | 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 | |
316 | 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 | |
316 | Lima | Lima | contract Lima 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 functional... |
balances[msg.sender] = 7000000000000000000000000000; // 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 = 7000000000000000000000000000; ... | 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 |
316 | Lima | approveAndCall | contract Lima 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 functional... |
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 |
317 | BasicToken | transfer | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
... | *
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred. |
317 | BasicToken | balanceOf | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... |
return balances[_owner];
| *
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address. |
317 | StandardToken | transferFrom | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfe... | *
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred |
317 | StandardToken | approve | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| *
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate thi... |
317 | StandardToken | allowance | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transf... |
return allowed[_owner][_spender];
| *
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender. |
322 | usingOraclize | parseInt | contract usingOraclize {
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
... |
return parseInt(_a, 0);
| parseInt |
322 | usingOraclize | parseInt | contract usingOraclize {
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
... |
bytes memory bresult = bytes(_a);
uint mint = 0;
bool decimals = false;
for (uint i=0; i<bresult.length; i++){
if ((bresult[i] >= 48)&&(bresult[i] <= 57)){
if (decimals){
if (_b == 0) break;
else _b--;
... | parseInt(parseFloat*10^_b) |
322 | usingOraclize | copyBytes | contract usingOraclize {
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
... |
uint minLength = length + toOffset;
// Buffer too small
require(to.length >= minLength); // Should be a better way?
// NOTE: the offset 32 is added to skip the `size` field of both bytes variables
uint i = 32 + fromOffset;
uint j = 32 + toOffset;
whi... | the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license |
322 | usingOraclize | safer_ecrecover | contract usingOraclize {
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
... |
// We do our own memory management here. Solidity uses memory offset
// 0x40 to store the current end of memory. We write past it (as
// writes are memory extensions), but don't update the offset so
// Solidity will reuse it. The memory used here is only needed for
// this ... | the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
Duplicate Solidity's ecrecover, but catching the CALL return value |
322 | usingOraclize | ecrecovery | contract usingOraclize {
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
byte constant proofType_NONE = 0x00;
byte constant proofType_TLSNotary = 0x10;
byte constant proofType_Android = 0x20;
byte constant proofType_Ledger = 0x30;
... |
bytes32 r;
bytes32 s;
uint8 v;
if (sig.length != 65)
return (false, 0);
// The signature format is a compact form of:
// {bytes32 r}{bytes32 s}{uint8 v}
// Compact means, uint8 is not padded to 32 bytes.
assembly {
r ... | the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license |
322 | Mortal | null | contract Mortal {
/* Define variable owner of the type address */
address owner;
/* This function is executed at initialization and sets the owner of the contract */
constructor() public {<FILL_FUNCTION_BODY>}
/* Function to recover the funds on the contract */
function kill() public {... |
owner = msg.sender;
| This function is executed at initialization and sets the owner of the contract |
322 | Mortal | kill | contract Mortal {
/* Define variable owner of the type address */
address owner;
/* This function is executed at initialization and sets the owner of the contract */
constructor() public {
owner = msg.sender;
}
/* Function to recover the funds on the contract */
function ... |
if (msg.sender == owner) {
selfdestruct(owner);
}
| Function to recover the funds on the contract |
322 | BucketContract | setWinner | contract BucketContract is Mortal {
mapping (address => uint) public betAmount;
mapping (address => bool) public hasBet;
address[] public betters;
uint[] public amountWon;
uint[] public amountBid;
address public owner;
uint256 public totalBid;
bool public payoutComplete;
bool public isWinner;
uint25... |
require(_gameId == gameContractObject.gameId());
assert(gameContractObject.state() == GameContract.GameState.RandomReceived);
assert(!isWinner);
isWinner = true;
address houseAddressOne = gameContractObject.getHouseAddressOne();
address houseAddressTwo = gameContractObject.getHouseAddressTwo();
ad... | setWinner function - set the winning contract |
322 | GameContract | setHouseAddressShare | contract GameContract is usingOraclize, Mortal {
enum GameState {
Deployed,
Started,
RandomRequesting,
RandomReceived,
Settled,
Finishing,
Finished
}
address public owner;
address public otherSettingOwner;
uint256 public price = 1e16;
uint256 public gameId;
uint public startTime = 0... |
require(_share >= 1 && _share <= 100);
require(_share + shareOfReferralAddress <= 100);
shareOfHouseAddress = _share;
| House Share will be value between 1-100 |
323 | Context | null | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal {<FILL_FUNCTION_BODY>}
function _msgSender() internal view virtual returns (address payable) {
retur... | Empty internal constructor, to prevent people from mistakenly deploying
an instance of this contract, which should be used via inheritance. | |
323 | MatrixETF | null | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
323 | MatrixETF | name | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _name;
| *
* @dev Returns the name of the token. |
323 | MatrixETF | symbol | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
323 | MatrixETF | decimals | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
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
* ... |
323 | MatrixETF | totalSupply | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
323 | MatrixETF | balanceOf | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
323 | MatrixETF | transfer | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approveCheck(_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`. |
323 | MatrixETF | allowance | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
323 | MatrixETF | approve | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
323 | MatrixETF | transferFrom | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_approveCheck(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 ha... |
323 | MatrixETF | increaseAllowance | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
| *
* @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.
*
* Requi... |
323 | MatrixETF | decreaseAllowance | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
| *
* @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.
*
* Requi... |
323 | MatrixETF | addApprove | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
| *
* @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.
*
* Requi... |
323 | MatrixETF | _transfer | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @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:
*
* - `s... |
323 | MatrixETF | _mint | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].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. |
323 | MatrixETF | _burn | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(acco... | *
* @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. |
323 | MatrixETF | _approve | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
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:
... |
323 | MatrixETF | _approveCheck | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds... | *
* @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:
... |
323 | MatrixETF | _setupDecimals | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... |
_decimals = decimals_;
| *
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does. |
323 | MatrixETF | _beforeTokenTransfer | contract MatrixETF is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
... | *
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens ... | |
324 | ERC20 | null | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_name = name;
_symbol = symbol;
_decimals = 18;
| *
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction. |
324 | ERC20 | name | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
return _name;
| *
* @dev Returns the name of the token. |
324 | ERC20 | symbol | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
return _symbol;
| *
* @dev Returns the symbol of the token, usually a shorter version of the
* name. |
324 | ERC20 | decimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
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
* ... |
324 | ERC20 | totalSupply | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
return _totalSupply;
| *
* @dev See {IERC20-totalSupply}. |
324 | ERC20 | balanceOf | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
return _balances[account];
| *
* @dev See {IERC20-balanceOf}. |
324 | ERC20 | transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_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`. |
324 | ERC20 | allowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
return _allowances[owner][spender];
| *
* @dev See {IERC20-allowance}. |
324 | ERC20 | approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_approve(_msgSender(), spender, amount);
return true;
| *
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address. |
324 | ERC20 | transferFrom | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_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`... |
324 | ERC20 | increaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_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.
*
* Requi... |
324 | ERC20 | decreaseAllowance | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_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.
*
* Requi... |
324 | ERC20 | _transfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds bal... | *
* @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:
*
* - `s... |
324 | ERC20 | _mint | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_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. |
324 | ERC20 | _burn | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(acco... | *
* @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. |
324 | ERC20 | _approve | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
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 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:
*
... |
324 | ERC20 | _setupDecimals | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... |
_decimals = decimals_;
| *
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does. |
324 | ERC20 | _beforeTokenTransfer | contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private... | *
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens ... | |
324 | 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 () public{<FILL_FUNCTION_BODY>}
/**
* ... |
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
| *
* @dev Initializes the contract setting the deployer as the initial owner. |
324 | 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 () public{
address msgSender = _msgSender(... |
return _owner;
| *
* @dev Returns the address of the current owner. |
324 | 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 () public{
address msgSender = _msgSender(... |
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 ... |
324 | 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 () public{
address msgSender = _msgSender(... |
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. |
324 | Staking | emergencyWithdraw | contract Staking is Ownable {
using SafeMath for uint256;
using SafeERC20 for OrexToken;
using Address for address;
OrexToken public token;
// annual yield period
uint256 private constant DURATION = 365 days;
uint256 private constant MINIMUM_AMOUNT = 1e18;
//uint256 pub... |
require(amount <= _stakerTokenBalance[msg.sender] && _stakerTokenBalance[msg.sender] > 0, "Bad withdraw.");
if(_stakerStakingPlan[msg.sender] == 4 || _stakerStakingPlan[msg.sender] == 5){
require(block.timestamp >= _stakerStakingTime[msg.sender] + 30 days, "Early withdrawal ava... | Withdraw without caring about rewards. EMERGENCY ONLY. |
325 | 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. |
325 | 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 address(0);
| *
* @dev Returns the address of the current owner. |
325 | 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));
| *
* @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 ... |
325 | 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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.