Blockwell

VNFT

About

Stats

Public Functions 63
Event Types 18
Code Size 169,167 bytes

Library Use

Uses Counters for Counters.Counter.

Events (18) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
approved
address help
tokenId
uint256 help

ApprovalForAll Event

Parameters help
owner
address help
operator
address help
approved
bool help

BurnPercentageChanged Event

Parameters help
percentage
uint256 help

CareTakerAdded Event

Parameters help
nftId
uint256 help
_to
address help

CareTakerRemoved Event

Parameters help
nftId
uint256 help

ClaimedMiningRewards Event

Parameters help
who
uint256 help
owner
address help
amount
uint256 help

ItemCreated Event

Parameters help
id
uint256 help
name
string help
price
uint256 help
points
uint256 help

LifeGiven Event

Parameters help
forSupportedNFT
address help
id
uint256 help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Paused Event

Parameters help
account
address help

RoleGranted Event

Parameters help
role
bytes32 help
account
address help
sender
address help

RoleRevoked Event

Parameters help
role
bytes32 help
account
address help
sender
address help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

Unpaused Event

Parameters help
account
address help

Unwrapped Event

Parameters help
nftId
uint256 help

VnftConsumed Event

Parameters help
nftId
uint256 help
giver
address help
itemId
uint256 help

VnftFatalized Event

Parameters help
nftId
uint256 help
killer
address help

VnftMinted Event

Parameters help
to
address help

VNFTObj Struct

Members
token
address help
id
uint256 help
standard
uint256 help

NFTInfo Struct

Members
token
address help
active
bool help
standard
uint256 help

OPERATOR_ROLE Constant

bytes32 help

MINTER_ROLE Constant

bytes32 help

PAUSER_ROLE Constant

bytes32 help

DEFAULT_ADMIN_ROLE Constant

bytes32 help
0x00

_ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

_INTERFACE_ID_ERC721 Constant

bytes4 help
0x80ac58cd

_INTERFACE_ID_ERC721_METADATA Constant

bytes4 help
0x5b5e139f

_INTERFACE_ID_ERC721_ENUMERABLE Constant

bytes4 help
0x780e9d63

_INTERFACE_ID_ERC165 Constant

bytes4 help
0x01ffc9a7

muse Variable

address help

maxDevAllocation Variable

uint256 help

devAllocation Variable

uint256 help

burnPercentage Variable

uint256 help

giveLifePrice Variable

uint256 help

gameStopped Variable

bool help

lastTimeMined Variable

mapping(uint256 => uint256) help

timeUntilStarving Variable

mapping(uint256 => uint256) help

vnftScore Variable

mapping(uint256 => uint256) help

timeVnftBorn Variable

mapping(uint256 => uint256) help

itemPrice Variable

mapping(uint256 => uint256) help

itemPoints Variable

mapping(uint256 => uint256) help

itemName Variable

mapping(uint256 => string) help

itemTimeExtension Variable

mapping(uint256 => uint256) help

vnftDetails Variable

mapping(uint256 => VNFTObj) help
Internal Variable

supportedNfts Variable

NFTInfo[] help
Internal Variable

_tokenIds Variable

Counters.Counter help
Internal Variable

_itemIds Variable

Counters.Counter help
Internal Variable

careTaker Variable

mapping(uint256 => mapping(address => address)) help
Internal Variable

la Variable

uint256 help
Internal Variable

lb Variable

uint256 help
Internal Variable

ra Variable

uint256 help
Internal Variable

rb Variable

uint256 help
Internal Variable

_owner Variable

address help
Internal Variable

_tokenIdTracker Variable

Counters.Counter help
Internal Variable

_roles Variable

mapping(bytes32 => RoleData) help
Internal Variable

_holderTokens Variable

mapping(address => EnumerableSet.UintSet) help
Internal Variable

_tokenOwners Variable

EnumerableMap.UintToAddressMap help
Internal Variable

_tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

_operatorApprovals Variable

mapping(address => mapping(address => bool)) help
Internal Variable

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_tokenURIs Variable

mapping(uint256 => string) help
Internal Variable

_baseURI Variable

string help
Internal Variable

_supportedInterfaces Variable

mapping(bytes4 => bool) help
Internal Variable

_paused Variable

bool help
Internal Variable

Functions Expand All Collapse All

supportsInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help public
Mutability help view
Source Code
function supportsInterface(bytes4 interfaceId)
  public
  view
  override
  returns (bool)
{
  return _supportedInterfaces[interfaceId];
}

onERC1155Received keyboard_arrow_up

Parameters help

Name Type
address help
address help
uint256 help
uint256 help
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function onERC1155Received(
  address,
  address,
  uint256,
  uint256,
  bytes memory
) public virtual override returns (bytes4) {
  return this.onERC1155Received.selector;
}

onERC1155BatchReceived keyboard_arrow_up

Parameters help

Name Type
address help
address help
uint256[] help
uint256[] help
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function onERC1155BatchReceived(
  address,
  address,
  uint256[] memory,
  uint256[] memory,
  bytes memory
) public virtual override returns (bytes4) {
  return this.onERC1155BatchReceived.selector;
}

owner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function owner() public view returns (address) {
  return _owner;
}

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function renounceOwnership() public virtual onlyOwner {
  emit OwnershipTransferred(_owner, address(0));
  _owner = address(0);
}

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function transferOwnership(address newOwner) public virtual onlyOwner {
  require(newOwner != address(0), "Ownable: new owner is the zero address");
  emit OwnershipTransferred(_owner, newOwner);
  _owner = newOwner;
}

recoverERC20 keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
tokenAmount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function recoverERC20(address tokenAddress, uint256 tokenAmount)
  public
  onlyOwner
{
  IERC20(tokenAddress).transfer(owner(), tokenAmount);
}

paused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function paused() public view returns (bool) {
  return _paused;
}

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function balanceOf(address owner) public view override returns (uint256) {
  require(owner != address(0), "ERC721: balance query for the zero address");

  return _holderTokens[owner].length();
}

ownerOf keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function ownerOf(uint256 tokenId) public view override returns (address) {
  return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function name() public view override returns (string memory) {
  return _name;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function symbol() public view override returns (string memory) {
  return _symbol;
}

tokenURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

null
Source Code
function tokenURI(uint256 tokenId)
  public
  view
  override
  returns (string memory)
{
  require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

  string memory _tokenURI = _tokenURIs[tokenId];

  // If there is no base URI, return the token URI.
  if (bytes(_baseURI).length == 0) {
    return _tokenURI;
  }
  // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
  if (bytes(_tokenURI).length > 0) {
    return string(abi.encodePacked(_baseURI, _tokenURI));
  }
  // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
  return string(abi.encodePacked(_baseURI, tokenId.toString()));
}

baseURI keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function baseURI() public view returns (string memory) {
  return _baseURI;
}

tokenOfOwnerByIndex keyboard_arrow_up

Parameters help

Name Type
owner
address help
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenOfOwnerByIndex(address owner, uint256 index)
  public
  view
  override
  returns (uint256)
{
  return _holderTokens[owner].at(index);
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view override returns (uint256) {
  // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
  return _tokenOwners.length();
}

tokenByIndex keyboard_arrow_up

Parameters help

Name Type
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenByIndex(uint256 index) public view override returns (uint256) {
  (uint256 tokenId, ) = _tokenOwners.at(index);
  return tokenId;
}

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address to, uint256 tokenId) public virtual override {
  address owner = ownerOf(tokenId);
  require(to != owner, "ERC721: approval to current owner");

  require(
    _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
    "ERC721: approve caller is not owner nor approved for all"
  );

  _approve(to, tokenId);
}

getApproved keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

null
Source Code
function getApproved(uint256 tokenId) public view override returns (address) {
  require(_exists(tokenId), "ERC721: approved query for nonexistent token");

  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
operator
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setApprovalForAll(address operator, bool approved)
  public
  virtual
  override
{
  require(operator != _msgSender(), "ERC721: approve to caller");

  _operatorApprovals[_msgSender()][operator] = approved;
  emit ApprovalForAll(_msgSender(), operator, approved);
}

isApprovedForAll keyboard_arrow_up

Parameters help

Name Type
owner
address help
operator
address help

Properties

Visibility help public
Mutability help view
Source Code
function isApprovedForAll(address owner, address operator)
  public
  view
  override
  returns (bool)
{
  return _operatorApprovals[owner][operator];
}

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address from,
  address to,
  uint256 tokenId
) public virtual override {
  //solhint-disable-next-line max-line-length
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721: transfer caller is not owner nor approved"
  );

  _transfer(from, to, tokenId);
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId
) public virtual override {
  safeTransferFrom(from, to, tokenId, "");
}

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) public virtual override {
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721: transfer caller is not owner nor approved"
  );
  _safeTransfer(from, to, tokenId, _data);
}

burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function burn(uint256 tokenId) public virtual {
  //solhint-disable-next-line max-line-length
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721Burnable: caller is not owner nor approved"
  );
  _burn(tokenId);
}

hasRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function hasRole(bytes32 role, address account) public view returns (bool) {
  return _roles[role].members.contains(account);
}

getRoleMemberCount keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help

Properties

Visibility help public
Mutability help view
Source Code
function getRoleMemberCount(bytes32 role) public view returns (uint256) {
  return _roles[role].members.length();
}

getRoleMember keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getRoleMember(bytes32 role, uint256 index)
  public
  view
  returns (address)
{
  return _roles[role].members.at(index);
}

getRoleAdmin keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help

Properties

Visibility help public
Mutability help view
Source Code
function getRoleAdmin(bytes32 role) public view returns (bytes32) {
  return _roles[role].adminRole;
}

grantRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function grantRole(bytes32 role, address account) public virtual {
  require(
    hasRole(_roles[role].adminRole, _msgSender()),
    "AccessControl: sender must be an admin to grant"
  );

  _grantRole(role, account);
}

revokeRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function revokeRole(bytes32 role, address account) public virtual {
  require(
    hasRole(_roles[role].adminRole, _msgSender()),
    "AccessControl: sender must be an admin to revoke"
  );

  _revokeRole(role, account);
}

renounceRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function renounceRole(bytes32 role, address account) public virtual {
  require(
    account == _msgSender(),
    "AccessControl: can only renounce roles for self"
  );

  _revokeRole(role, account);
}

mint keyboard_arrow_up

Parameters help

Name Type
player
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function mint(address player) public override onlyMinter {
  //pet minted has 3 days until it starves at first
  timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
  timeVnftBorn[_tokenIds.current()] = block.timestamp;

  vnftDetails[_tokenIds.current()] = VNFTObj(
    address(this),
    _tokenIds.current(),
    721
  );
  super._mint(player, _tokenIds.current());
  _tokenIds.increment();
  emit VnftMinted(msg.sender);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function pause() public virtual {
  require(
    hasRole(PAUSER_ROLE, _msgSender()),
    "ERC721PresetMinterPauserAutoId: must have pauser role to pause"
  );
  _pause();
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
function unpause() public virtual {
  require(
    hasRole(PAUSER_ROLE, _msgSender()),
    "ERC721PresetMinterPauserAutoId: must have pauser role to unpause"
  );
  _unpause();
}

contractURI keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function contractURI() public pure returns (string memory) {
  return "https://gallery.verynifty.io/api";
}

pauseGame keyboard_arrow_up

Parameters help

Name Type
_pause
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function pauseGame(bool _pause) external onlyOperator {
  gameStopped = _pause;
}

changeBurnPercentage keyboard_arrow_up

Parameters help

Name Type
percentage
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null

Requirements help

Source Code
function changeBurnPercentage(uint256 percentage) external onlyOperator {
  require(percentage <= 100);
  burnPercentage = burnPercentage;
  emit BurnPercentageChanged(burnPercentage);
}

changeGiveLifePrice keyboard_arrow_up

Parameters help

Name Type
_newPrice
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function changeGiveLifePrice(uint256 _newPrice) external onlyOperator {
  giveLifePrice = _newPrice * 10**18;
}

changeMaxDevAllocation keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function changeMaxDevAllocation(uint256 amount) external onlyOperator {
  maxDevAllocation = amount;
}

itemExists keyboard_arrow_up

Parameters help

Name Type
itemId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function itemExists(uint256 itemId) public view returns (bool) {
  if (bytes(itemName[itemId]).length > 0) {
    return true;
  }
}

isVnftAlive keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function isVnftAlive(uint256 _nftId) public view returns (bool) {
  uint256 _timeUntilStarving = timeUntilStarving[_nftId];
  if (_timeUntilStarving != 0 && _timeUntilStarving >= block.timestamp) {
    return true;
  }
}

getVnftScore keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getVnftScore(uint256 _nftId) public view returns (uint256) {
  return vnftScore[_nftId];
}

getItemInfo keyboard_arrow_up

Parameters help

Name Type
_itemId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getItemInfo(uint256 _itemId)
  public
  view
  returns (
    string memory _name,
    uint256 _price,
    uint256 _points,
    uint256 _timeExtension
  )
{
  _name = itemName[_itemId];
  _price = itemPrice[_itemId];
  _timeExtension = itemTimeExtension[_itemId];
  _points = itemPoints[_itemId];
}

getVnftInfo keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getVnftInfo(uint256 _nftId)
  public
  view
  returns (
    uint256 _vNFT,
    bool _isAlive,
    uint256 _score,
    uint256 _level,
    uint256 _expectedReward,
    uint256 _timeUntilStarving,
    uint256 _lastTimeMined,
    uint256 _timeVnftBorn,
    address _owner,
    address _token,
    uint256 _tokenId,
    uint256 _fatalityReward
  )
{
  _vNFT = _nftId;
  _isAlive = this.isVnftAlive(_nftId);
  _score = this.getVnftScore(_nftId);
  _level = this.level(_nftId);
  _expectedReward = this.getRewards(_nftId);
  _timeUntilStarving = timeUntilStarving[_nftId];
  _lastTimeMined = lastTimeMined[_nftId];
  _timeVnftBorn = timeVnftBorn[_nftId];
  _owner = this.ownerOf(_nftId);
  _token = vnftDetails[_nftId].token;
  _tokenId = vnftDetails[_nftId].id;
  _fatalityReward = getFatalityReward(_nftId);
}

editCurves keyboard_arrow_up

Parameters help

Name Type
_la
uint256 help
_lb
uint256 help
_ra
uint256 help
_rb
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function editCurves(
  uint256 _la,
  uint256 _lb,
  uint256 _ra,
  uint256 _rb
) external onlyOperator {
  la = _la;
  lb = _lb;
  ra = _ra;
  lb = _rb;
}

level keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function level(uint256 tokenId) external view returns (uint256) {
  // This is the formula L(x) = 2 * sqrt(x * 2)
  uint256 _score = vnftScore[tokenId].div(100);
  if (_score == 0) {
    return 1;
  }
  uint256 _level = sqrtu(_score.mul(la));
  return (_level.mul(lb));
}

getRewards keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getRewards(uint256 tokenId) external view returns (uint256) {
  // This is the formula to get token rewards R(level)=(level)*6/7+6
  uint256 _level = this.level(tokenId);
  if (_level == 1) {
    return 6 ether;
  }
  _level = _level.mul(1 ether).mul(ra).div(rb);
  return (_level.add(5 ether));
}

editItem keyboard_arrow_up

Parameters help

Name Type
_id
uint256 help
_price
uint256 help
_points
uint256 help
_name
string help
_timeExtension
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function editItem(
  uint256 _id,
  uint256 _price,
  uint256 _points,
  string calldata _name,
  uint256 _timeExtension
) external onlyOperator {
  itemPrice[_id] = _price;
  itemPoints[_id] = _points;
  itemName[_id] = _name;
  itemTimeExtension[_id] = _timeExtension;
}

claimMiningRewards keyboard_arrow_up

Parameters help

Name Type
nftId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
function claimMiningRewards(uint256 nftId) external notPaused {
  require(isVnftAlive(nftId), "Your vNFT is dead, you can't mine");
  require(
    block.timestamp >= lastTimeMined[nftId].add(1 days) ||
      lastTimeMined[nftId] == 0,
    "Current timestamp is over the limit to claim the tokens"
  );
  require(
    ownerOf(nftId) == msg.sender ||
      careTaker[nftId][ownerOf(nftId)] == msg.sender,
    "You must own the vNFT to claim rewards"
  );

  //reset last start mined so can't remine and cheat
  lastTimeMined[nftId] = block.timestamp;
  uint256 _reward = this.getRewards(nftId);
  muse.mint(msg.sender, _reward);
  emit ClaimedMiningRewards(nftId, msg.sender, _reward);
}

buyAccesory keyboard_arrow_up

Parameters help

Name Type
nftId
uint256 help
itemId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function buyAccesory(uint256 nftId, uint256 itemId) external notPaused {
  require(itemExists(itemId), "This item doesn't exist");
  uint256 amount = itemPrice[itemId];
  require(
    ownerOf(nftId) == msg.sender ||
      careTaker[nftId][ownerOf(nftId)] == msg.sender,
    "You must own the vNFT or be a care taker to buy items"
  );
  // require(isVnftAlive(nftId), "Your vNFT is dead");
  uint256 amountToBurn = amount.mul(burnPercentage).div(100);

  if (!isVnftAlive(nftId)) {
    vnftScore[nftId] = itemPoints[itemId];
    timeUntilStarving[nftId] = block.timestamp.add(itemTimeExtension[itemId]);
  } else {
    //recalculate timeUntilStarving.
    timeUntilStarving[nftId] = block.timestamp.add(itemTimeExtension[itemId]);
    vnftScore[nftId] = vnftScore[nftId].add(itemPoints[itemId]);
  }
  // burn 90% so they go back to community mining and staking, and send 10% to devs

  if (devAllocation <= maxDevAllocation) {
    devAllocation = devAllocation.add(amount.sub(amountToBurn));
    muse.transferFrom(msg.sender, address(this), amount);
    // burn 90% of token, 10% stay for dev and community fund
    muse.burn(amountToBurn);
  } else {
    muse.burnFrom(msg.sender, amount);
  }
  emit VnftConsumed(nftId, msg.sender, itemId);
}

setBaseURI keyboard_arrow_up

Parameters help

Name Type
baseURI_
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function setBaseURI(string memory baseURI_) public onlyOperator {
  _setBaseURI(baseURI_);
}

fatality keyboard_arrow_up

Parameters help

Name Type
_deadId
uint256 help
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function fatality(uint256 _deadId, uint256 _tokenId) external notPaused {
  require(
    !isVnftAlive(_deadId),
    "The vNFT has to be starved to claim his points"
  );
  vnftScore[_tokenId] = vnftScore[_tokenId].add(
    (vnftScore[_deadId].mul(60).div(100))
  );
  // delete vnftDetails[_deadId];
  _burn(_deadId);
  emit VnftFatalized(_deadId, msg.sender);
}

getFatalityReward keyboard_arrow_up

Parameters help

Name Type
_deadId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getFatalityReward(uint256 _deadId) public view returns (uint256) {
  if (isVnftAlive(_deadId)) {
    return 0;
  } else {
    return (vnftScore[_deadId].mul(60).div(100));
  }
}

createItem keyboard_arrow_up

Parameters help

Name Type
name
string help
price
uint256 help
points
uint256 help
timeExtension
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function createItem(
  string calldata name,
  uint256 price,
  uint256 points,
  uint256 timeExtension
) external onlyOperator returns (bool) {
  _itemIds.increment();
  uint256 newItemId = _itemIds.current();
  itemName[newItemId] = name;
  itemPrice[newItemId] = price * 10**18;
  itemPoints[newItemId] = points;
  itemTimeExtension[newItemId] = timeExtension;
  emit ItemCreated(newItemId, name, price, points);
}

addNft keyboard_arrow_up

Parameters help

Name Type
_nftToken
address help
_type
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function addNft(address _nftToken, uint256 _type) public onlyOperator {
  supportedNfts.push(
    NFTInfo({token: _nftToken, active: true, standard: _type})
  );
}

supportedNftLength keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function supportedNftLength() external view returns (uint256) {
  return supportedNfts.length;
}

updateSupportedNFT keyboard_arrow_up

Parameters help

Name Type
index
uint256 help
_active
bool help
_address
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function updateSupportedNFT(
  uint256 index,
  bool _active,
  address _address
) public onlyOperator {
  supportedNfts[index].active = _active;
  supportedNfts[index].token = _address;
}

giveLife keyboard_arrow_up

Parameters help

Name Type
index
uint256 help
_id
uint256 help
nftType
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function giveLife(
  uint256 index,
  uint256 _id,
  uint256 nftType
) external notPaused {
  uint256 amountToBurn = giveLifePrice.mul(burnPercentage).div(100);

  if (devAllocation <= maxDevAllocation) {
    devAllocation = devAllocation.add(giveLifePrice.sub(amountToBurn));
    muse.transferFrom(msg.sender, address(this), giveLifePrice);
    // burn 90% of token, 10% stay for dev and community fund
    muse.burn(amountToBurn);
  } else {
    muse.burnFrom(msg.sender, giveLifePrice);
  }

  if (nftType == 721) {
    IERC721(supportedNfts[index].token).transferFrom(
      msg.sender,
      address(this),
      _id
    );
  } else if (nftType == 1155) {
    IERC1155(supportedNfts[index].token).safeTransferFrom(
      msg.sender,
      address(this),
      _id,
      1, //the amount of tokens to transfer which always be 1
      "0x0"
    );
  }

  // mint a vNFT
  vnftDetails[_tokenIds.current()] = VNFTObj(
    supportedNfts[index].token,
    _id,
    nftType
  );

  timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
  timeVnftBorn[_tokenIds.current()] = block.timestamp;

  super._mint(msg.sender, _tokenIds.current());
  _tokenIds.increment();
  emit LifeGiven(supportedNfts[index].token, _id);
}

unwrap keyboard_arrow_up

Parameters help

Name Type
_vnftId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function unwrap(uint256 _vnftId) external {
  require(isVnftAlive(_vnftId), "Your vNFT is dead, you can't unwrap it");
  transferFrom(msg.sender, address(this), _vnftId);
  VNFTObj memory details = vnftDetails[_vnftId];
  timeUntilStarving[_vnftId] = 1;
  vnftScore[_vnftId] = 0;
  emit Unwrapped(_vnftId);
  _withdraw(details.id, details.token, msg.sender, details.standard);
}

withdraw keyboard_arrow_up

Parameters help

Name Type
_id
uint256 help
_contractAddr
address help
_to
address help
_type
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
function withdraw(
  uint256 _id,
  address _contractAddr,
  address _to,
  uint256 _type
) external onlyOperator {
  _withdraw(_id, _contractAddr, _to, _type);
}

addCareTaker keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_careTaker
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function addCareTaker(uint256 _tokenId, address _careTaker) external {
  require(
    hasRole(OPERATOR_ROLE, _msgSender()) || ownerOf(_tokenId) == msg.sender,
    "Roles: caller does not have the OPERATOR role"
  );
  careTaker[_tokenId][msg.sender] = _careTaker;
  emit CareTakerAdded(_tokenId, _careTaker);
}

clearCareTaker keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function clearCareTaker(uint256 _tokenId) external {
  require(
    hasRole(OPERATOR_ROLE, _msgSender()) || ownerOf(_tokenId) == msg.sender,
    "Roles: caller does not have the OPERATOR role"
  );
  delete careTaker[_tokenId][msg.sender];
  emit CareTakerRemoved(_tokenId);
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal VNFT._withdraw keyboard_arrow_up

Parameters help

Name Type
_id
uint256 help
_contractAddr
address help
_to
address help
_type
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _withdraw(
  uint256 _id,
  address _contractAddr,
  address _to,
  uint256 _type
) internal {
  if (_type == 1155) {
    IERC1155(_contractAddr).safeTransferFrom(address(this), _to, _id, 1, "");
  } else if (_type == 721) {
    IERC721(_contractAddr).transferFrom(address(this), _to, _id);
  }
}

internal VNFT.sqrtu keyboard_arrow_up

Parameters help

Name Type
x
uint256 help

Properties

Visibility help private
Mutability help pure
Source Code
function sqrtu(uint256 x) private pure returns (uint128) {
  if (x == 0) return 0;
  else {
    uint256 xx = x;
    uint256 r = 1;
    if (xx >= 0x100000000000000000000000000000000) {
      xx >>= 128;
      r <<= 64;
    }
    if (xx >= 0x10000000000000000) {
      xx >>= 64;
      r <<= 32;
    }
    if (xx >= 0x100000000) {
      xx >>= 32;
      r <<= 16;
    }
    if (xx >= 0x10000) {
      xx >>= 16;
      r <<= 8;
    }
    if (xx >= 0x100) {
      xx >>= 8;
      r <<= 4;
    }
    if (xx >= 0x10) {
      xx >>= 4;
      r <<= 2;
    }
    if (xx >= 0x8) {
      r <<= 1;
    }
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1;
    r = (r + x / r) >> 1; // Seven iterations should be enough
    uint256 r1 = x / r;
    return uint128(r < r1 ? r : r1);
  }
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  address msgSender = _msgSender();
  _owner = msgSender;
  emit OwnershipTransferred(address(0), msgSender);
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC721PresetMinterPauserAutoId._beforeTokenTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual override(ERC721, ERC721Pausable) {
  super._beforeTokenTransfer(from, to, tokenId);
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal AccessControl._setupRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setupRole(bytes32 role, address account) internal virtual {
  _grantRole(role, account);
}

internal AccessControl._setRoleAdmin keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
adminRole
bytes32 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
  _roles[role].adminRole = adminRole;
}

internal AccessControl._grantRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help private
Mutability help transaction
Source Code
function _grantRole(bytes32 role, address account) private {
  if (_roles[role].members.add(account)) {
    emit RoleGranted(role, account, _msgSender());
  }
}

internal AccessControl._revokeRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help private
Mutability help transaction
Source Code
function _revokeRole(bytes32 role, address account) private {
  if (_roles[role].members.remove(account)) {
    emit RoleRevoked(role, account, _msgSender());
  }
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC721._safeTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeTransfer(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _transfer(from, to, tokenId);
  require(
    _checkOnERC721Received(from, to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721._exists keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _exists(uint256 tokenId) internal view returns (bool) {
  return _tokenOwners.contains(tokenId);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view

Requirements help

null
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  require(_exists(tokenId), "ERC721: operator query for nonexistent token");
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

internal ERC721._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeMint(address to, uint256 tokenId) internal virtual {
  _safeMint(to, tokenId, "");
}

internal ERC721._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeMint(
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _mint(to, tokenId);
  require(
    _checkOnERC721Received(address(0), to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mint(address to, uint256 tokenId) internal virtual {
  require(to != address(0), "ERC721: mint to the zero address");
  require(!_exists(tokenId), "ERC721: token already minted");

  _beforeTokenTransfer(address(0), to, tokenId);

  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

  emit Transfer(address(0), to, tokenId);
}

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(uint256 tokenId) internal virtual {
  address owner = ownerOf(tokenId);

  _beforeTokenTransfer(owner, address(0), tokenId);

  // Clear approvals
  _approve(address(0), tokenId);

  // Clear metadata (if any)
  if (bytes(_tokenURIs[tokenId]).length != 0) {
    delete _tokenURIs[tokenId];
  }

  _holderTokens[owner].remove(tokenId);

  _tokenOwners.remove(tokenId);

  emit Transfer(owner, address(0), tokenId);
}

internal ERC721._transfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {
  require(
    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);

  _holderTokens[from].remove(tokenId);
  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

  emit Transfer(from, to, tokenId);
}

internal ERC721._setTokenURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help
_tokenURI
string help

Properties

Visibility help internal
Mutability help transaction

Requirements help

null
Source Code
function _setTokenURI(uint256 tokenId, string memory _tokenURI)
  internal
  virtual
{
  require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
  _tokenURIs[tokenId] = _tokenURI;
}

internal ERC721._setBaseURI keyboard_arrow_up

Parameters help

Name Type
baseURI_
string help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setBaseURI(string memory baseURI_) internal virtual {
  _baseURI = baseURI_;
}

internal ERC721._checkOnERC721Received keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help private
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) private returns (bool) {
  if (!to.isContract()) {
    return true;
  }
  bytes memory returndata = to.functionCall(
    abi.encodeWithSelector(
      IERC721Receiver(to).onERC721Received.selector,
      _msgSender(),
      from,
      tokenId,
      _data
    ),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
  bytes4 retval = abi.decode(returndata, (bytes4));
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._approve keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _approve(address to, uint256 tokenId) private {
  _tokenApprovals[tokenId] = to;
  emit Approval(ownerOf(tokenId), to, tokenId);
}

internal ERC721._beforeTokenTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
constructor() internal {
  // Derived contracts need only register support for their own interfaces,
  // we register support for ERC165 itself here
  _registerInterface(_INTERFACE_ID_ERC165);
}

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 interfaceId) internal virtual {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721Pausable._beforeTokenTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual override {
  super._beforeTokenTransfer(from, to, tokenId);

  require(!paused(), "ERC721Pausable: token transfer while paused");
}

internal ERC721._safeTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeTransfer(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _transfer(from, to, tokenId);
  require(
    _checkOnERC721Received(from, to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721._exists keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _exists(uint256 tokenId) internal view returns (bool) {
  return _tokenOwners.contains(tokenId);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view

Requirements help

null
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  require(_exists(tokenId), "ERC721: operator query for nonexistent token");
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

internal ERC721._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeMint(address to, uint256 tokenId) internal virtual {
  _safeMint(to, tokenId, "");
}

internal ERC721._safeMint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _safeMint(
  address to,
  uint256 tokenId,
  bytes memory _data
) internal virtual {
  _mint(to, tokenId);
  require(
    _checkOnERC721Received(address(0), to, tokenId, _data),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
}

internal ERC721._mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _mint(address to, uint256 tokenId) internal virtual {
  require(to != address(0), "ERC721: mint to the zero address");
  require(!_exists(tokenId), "ERC721: token already minted");

  _beforeTokenTransfer(address(0), to, tokenId);

  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

  emit Transfer(address(0), to, tokenId);
}

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(uint256 tokenId) internal virtual {
  address owner = ownerOf(tokenId);

  _beforeTokenTransfer(owner, address(0), tokenId);

  // Clear approvals
  _approve(address(0), tokenId);

  // Clear metadata (if any)
  if (bytes(_tokenURIs[tokenId]).length != 0) {
    delete _tokenURIs[tokenId];
  }

  _holderTokens[owner].remove(tokenId);

  _tokenOwners.remove(tokenId);

  emit Transfer(owner, address(0), tokenId);
}

internal ERC721._transfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _transfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {
  require(
    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);

  _holderTokens[from].remove(tokenId);
  _holderTokens[to].add(tokenId);

  _tokenOwners.set(tokenId, to);

  emit Transfer(from, to, tokenId);
}

internal ERC721._setTokenURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help
_tokenURI
string help

Properties

Visibility help internal
Mutability help transaction

Requirements help

null
Source Code
function _setTokenURI(uint256 tokenId, string memory _tokenURI)
  internal
  virtual
{
  require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
  _tokenURIs[tokenId] = _tokenURI;
}

internal ERC721._setBaseURI keyboard_arrow_up

Parameters help

Name Type
baseURI_
string help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _setBaseURI(string memory baseURI_) internal virtual {
  _baseURI = baseURI_;
}

internal ERC721._checkOnERC721Received keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help private
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) private returns (bool) {
  if (!to.isContract()) {
    return true;
  }
  bytes memory returndata = to.functionCall(
    abi.encodeWithSelector(
      IERC721Receiver(to).onERC721Received.selector,
      _msgSender(),
      from,
      tokenId,
      _data
    ),
    "ERC721: transfer to non ERC721Receiver implementer"
  );
  bytes4 retval = abi.decode(returndata, (bytes4));
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._approve keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _approve(address to, uint256 tokenId) private {
  _tokenApprovals[tokenId] = to;
  emit Approval(ownerOf(tokenId), to, tokenId);
}

internal ERC721._beforeTokenTransfer keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _beforeTokenTransfer(
  address from,
  address to,
  uint256 tokenId
) internal virtual {}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
constructor() internal {
  // Derived contracts need only register support for their own interfaces,
  // we register support for ERC165 itself here
  _registerInterface(_INTERFACE_ID_ERC165);
}

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 interfaceId) internal virtual {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}

internal Pausable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _paused = false;
}

internal Pausable._pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function _pause() internal virtual whenNotPaused {
  _paused = true;
  emit Paused(_msgSender());
}

internal Pausable._unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function _unpause() internal virtual whenPaused {
  _paused = false;
  emit Unpaused(_msgSender());
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal Ownable.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  address msgSender = _msgSender();
  _owner = msgSender;
  emit OwnershipTransferred(address(0), msgSender);
}

internal Context._msgSender keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgSender() internal view virtual returns (address payable) {
  return msg.sender;
}

internal Context._msgData keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help view
Source Code
function _msgData() internal view virtual returns (bytes memory) {
  this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  return msg.data;
}

internal ERC165.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
constructor() internal {
  // Derived contracts need only register support for their own interfaces,
  // we register support for ERC165 itself here
  _registerInterface(_INTERFACE_ID_ERC165);
}

internal ERC165._registerInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function _registerInterface(bytes4 interfaceId) internal virtual {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}