Blockwell

MyCryptoHeroes:Land

About

Stats

Public Functions 43
Event Types 10
Code Size 46,075 bytes

Events (10) 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

MintEvent Event

Parameters help
assetOwner
address help
tokenId
uint256 help
at
uint256 help
eventHash
bytes32 help

MinterAdded Event

Parameters help
account
address help

MinterRemoved Event

Parameters help
account
address help

Paused Event

Parameters help
account
address help

PauserAdded Event

Parameters help
account
address help

PauserRemoved Event

Parameters help
account
address help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

Unpaused Event

Parameters help
account
address help

SHARE_RATE_DECIMAL Constant

uint256 help
UNKNOWN VALUE

LEGENDARY_RARITY Constant

uint16 help
5

EPIC_RARITY Constant

uint16 help
4

RARE_RARITY Constant

uint16 help
3

UNCOMMON_RARITY Constant

uint16 help
2

COMMON_RARITY Constant

uint16 help
1

NO_LAND Constant

uint16 help
0

_ERC721_RECEIVED Constant

bytes4 help
0x150b7a02

_INTERFACE_ID_ERC721 Constant

bytes4 help
0x80ac58cd

_INTERFACE_ID_ERC165 Constant

bytes4 help
0x01ffc9a7

_INTERFACE_ID_ERC721_ENUMERABLE Constant

bytes4 help
0x780e9d63

_INTERFACE_ID_ERC721_METADATA Constant

bytes4 help
0x5b5e139f

tokenURIPrefix Variable

string help

landTypeToTotalVolume Variable

mapping(uint16 => uint256) help
Internal Variable

landTypeToSectorSupplyLimit Variable

mapping(uint16 => uint256) help
Internal Variable

landTypeAndRarityToSectorSupply Variable

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

landTypeToLandSectorList Variable

mapping(uint16 => uint256[]) help
Internal Variable

landTypeToLandSectorIndex Variable

mapping(uint16 => uint256) help
Internal Variable

landTypeAndRarityToLandSectorCount Variable

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

rarityToSectorVolume Variable

mapping(uint16 => uint256) help
Internal Variable

allowed Variable

mapping(uint256 => bool) help
Internal Variable

_tokenOwner Variable

mapping(uint256 => address) help
Internal Variable

_tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

_ownedTokensCount Variable

mapping(address => uint256) help
Internal Variable

_operatorApprovals Variable

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

_supportedInterfaces Variable

mapping(bytes4 => bool) help
Internal Variable

_ownedTokens Variable

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

_ownedTokensIndex Variable

mapping(uint256 => uint256) help
Internal Variable

_allTokens Variable

uint256[] help
Internal Variable

_allTokensIndex Variable

mapping(uint256 => uint256) help
Internal Variable

_name Variable

string help
Internal Variable

_symbol Variable

string help
Internal Variable

_tokenURIs Variable

mapping(uint256 => string) help
Internal Variable

_minters Variable

Roles.Role help
Internal Variable

_paused Variable

bool help
Internal Variable

_pausers Variable

Roles.Role help
Internal Variable

Functions Expand All Collapse All

isPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isPauser(address account) public view returns (bool) {
  return _pausers.has(account);
}

addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function addPauser(address account) public onlyPauser {
  _addPauser(account);
}

renouncePauser keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function renouncePauser() public {
  _removePauser(msg.sender);
}

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;
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyPauser checks for the following:
null
Source Code
function pause() public onlyPauser whenNotPaused {
  _paused = true;
  emit Paused(msg.sender);
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function unpause() public onlyPauser whenPaused {
  _paused = false;
  emit Unpaused(msg.sender);
}

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function balanceOf(address owner) public view returns (uint256) {
  require(owner != address(0));
  return _ownedTokensCount[owner];
}

ownerOf keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function ownerOf(uint256 tokenId) public view returns (address) {
  address owner = _tokenOwner[tokenId];
  require(owner != address(0));
  return owner;
}

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 {
  require(allowed[_tokenId]);
  super.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 returns (address) {
  require(_exists(tokenId));
  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
to
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function setApprovalForAll(address to, bool approved) public whenNotPaused {
  super.setApprovalForAll(to, 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
  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 {
  require(allowed[_tokenId]);
  super.transferFrom(_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 {
  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 {
  transferFrom(from, to, tokenId);
  require(_checkOnERC721Received(from, to, tokenId, _data));
}

supportsInterface keyboard_arrow_up

Parameters help

Name Type
interfaceId
bytes4 help

Properties

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

isMinter keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
function isMinter(address account) public view returns (bool) {
  return _minters.has(account);
}

addMinter keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function addMinter(address account) public onlyMinter {
  _addMinter(account);
}

renounceMinter keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function renounceMinter() public {
  _removeMinter(msg.sender);
}

mint keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function mint(address to, uint256 tokenId) public onlyMinter returns (bool) {
  _mint(to, tokenId);
  return true;
}

Parameters help

This function has no parameters.

Properties

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

Parameters help

This function has no parameters.

Properties

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

tokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function tokenURI(uint256 _tokenId) public view returns (string memory) {
  bytes32 tokenIdBytes;
  if (_tokenId == 0) {
    tokenIdBytes = "0";
  } else {
    uint256 value = _tokenId;
    while (value > 0) {
      tokenIdBytes = bytes32(uint256(tokenIdBytes) / (2**8));
      tokenIdBytes |= bytes32(((value % 10) + 48) * 2**(8 * 31));
      value /= 10;
    }
  }

  bytes memory prefixBytes = bytes(tokenURIPrefix);
  bytes memory tokenURIBytes = new bytes(
    prefixBytes.length + tokenIdBytes.length
  );

  uint8 i;
  uint8 index = 0;

  for (i = 0; i < prefixBytes.length; i++) {
    tokenURIBytes[index] = prefixBytes[i];
    index++;
  }

  for (i = 0; i < tokenIdBytes.length; i++) {
    tokenURIBytes[index] = tokenIdBytes[i];
    index++;
  }

  return string(tokenURIBytes);
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function totalSupply() public view returns (uint256) {
  return _allTokens.length;
}

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
  returns (uint256)
{
  require(index < balanceOf(owner));
  return _ownedTokens[owner][index];
}

tokenByIndex keyboard_arrow_up

Parameters help

Name Type
index
uint256 help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function tokenByIndex(uint256 index) public view returns (uint256) {
  require(index < totalSupply());
  return _allTokens[index];
}

setSupplyAndSector keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help
_totalVolume
uint256 help
_sectorSupplyLimit
uint256 help
legendarySupply
uint256 help
epicSupply
uint256 help
rareSupply
uint256 help
uncommonSupply
uint256 help
commonSupply
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function setSupplyAndSector(
  uint16 _landType,
  uint256 _totalVolume,
  uint256 _sectorSupplyLimit,
  uint256 legendarySupply,
  uint256 epicSupply,
  uint256 rareSupply,
  uint256 uncommonSupply,
  uint256 commonSupply
) external onlyMinter {
  require(_landType != 0, "landType 0 is noland");
  require(_totalVolume != 0, "totalVolume must not be 0");
  require(getMintedSectorCount(_landType) == 0, "This LandType already exists");
  require(
    legendarySupply
    .mul(rarityToSectorVolume[LEGENDARY_RARITY])
    .add(epicSupply.mul(rarityToSectorVolume[EPIC_RARITY]))
    .add(rareSupply.mul(rarityToSectorVolume[RARE_RARITY]))
    .add(uncommonSupply.mul(rarityToSectorVolume[UNCOMMON_RARITY]))
    .add(commonSupply.mul(rarityToSectorVolume[COMMON_RARITY])) == _totalVolume
  );
  require(
    legendarySupply.add(epicSupply).add(rareSupply).add(uncommonSupply).add(
      commonSupply
    ) == _sectorSupplyLimit
  );
  landTypeToTotalVolume[_landType] = _totalVolume;
  landTypeToSectorSupplyLimit[_landType] = _sectorSupplyLimit;
  landTypeAndRarityToSectorSupply[_landType][
    LEGENDARY_RARITY
  ] = legendarySupply;
  landTypeAndRarityToSectorSupply[_landType][EPIC_RARITY] = epicSupply;
  landTypeAndRarityToSectorSupply[_landType][RARE_RARITY] = rareSupply;
  landTypeAndRarityToSectorSupply[_landType][UNCOMMON_RARITY] = uncommonSupply;
  landTypeAndRarityToSectorSupply[_landType][COMMON_RARITY] = commonSupply;
}

unLockToken keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function unLockToken(uint256 _tokenId) public onlyMinter {
  allowed[_tokenId] = true;
}

setTokenURIPrefix keyboard_arrow_up

Parameters help

Name Type
_tokenURIPrefix
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
function setTokenURIPrefix(string calldata _tokenURIPrefix)
  external
  onlyMinter
{
  tokenURIPrefix = _tokenURIPrefix;
}

isAlreadyMinted keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function isAlreadyMinted(uint256 _tokenId) public view returns (bool) {
  return _exists(_tokenId);
}

isValidLandSector keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function isValidLandSector(uint256 _tokenId) public view returns (bool) {
  uint16 rarity = getRarity(_tokenId);
  if (!(rarityToSectorVolume[rarity] > 0)) {
    return false;
  }
  uint16 landType = getLandType(_tokenId);
  if (!(landTypeToTotalVolume[landType] > 0)) {
    return false;
  }
  uint256 serial = _tokenId % 10000;
  if (serial == 0) {
    return false;
  }
  if (serial > landTypeAndRarityToSectorSupply[landType][rarity]) {
    return false;
  }
  return true;
}

canTransfer keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function canTransfer(uint256 _tokenId) public view returns (bool) {
  return allowed[_tokenId];
}

getTotalVolume keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getTotalVolume(uint16 _landType) public view returns (uint256) {
  return landTypeToTotalVolume[_landType];
}

getSectorSupplyLimit keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getSectorSupplyLimit(uint16 _landType) public view returns (uint256) {
  return landTypeToSectorSupplyLimit[_landType];
}

getLandType keyboard_arrow_up

Parameters help

Name Type
_landSector
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getLandType(uint256 _landSector) public view returns (uint16) {
  uint16 _landType = uint16((_landSector.div(10000)) % 1000);
  return _landType;
}

getRarity keyboard_arrow_up

Parameters help

Name Type
_landSector
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getRarity(uint256 _landSector) public view returns (uint16) {
  return uint16(_landSector.div(10**7));
}

getMintedSectorCount keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getMintedSectorCount(uint16 _landType) public view returns (uint256) {
  return landTypeToLandSectorIndex[_landType];
}

getMintedSectorCountByRarity keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help
_rarity
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getMintedSectorCountByRarity(uint16 _landType, uint16 _rarity)
  public
  view
  returns (uint256)
{
  return landTypeAndRarityToLandSectorCount[_landType][_rarity];
}

getSectorSupplyByRarity keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help
_rarity
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getSectorSupplyByRarity(uint16 _landType, uint16 _rarity)
  public
  view
  returns (uint256)
{
  return landTypeAndRarityToSectorSupply[_landType][_rarity];
}

getMintedSectorList keyboard_arrow_up

Parameters help

Name Type
_landType
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getMintedSectorList(uint16 _landType)
  public
  view
  returns (uint256[] memory)
{
  return landTypeToLandSectorList[_landType];
}

getSectorVolumeByRarity keyboard_arrow_up

Parameters help

Name Type
_rarity
uint16 help

Properties

Visibility help public
Mutability help view
Source Code
function getSectorVolumeByRarity(uint16 _rarity) public view returns (uint256) {
  return rarityToSectorVolume[_rarity];
}

getShareRateWithDecimal keyboard_arrow_up

Parameters help

Name Type
_landSector
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getShareRateWithDecimal(uint256 _landSector)
  public
  view
  returns (uint256, uint256)
{
  return (
    getSectorVolumeByRarity(getRarity(_landSector)).mul(SHARE_RATE_DECIMAL).div(
      getTotalVolume(getLandType(_landSector))
    ),
    SHARE_RATE_DECIMAL
  );
}

mintLandSector keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_landSector
uint256 help
_eventHash
bytes32 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null

Requirements help

null
Source Code
function mintLandSector(
  address _owner,
  uint256 _landSector,
  bytes32 _eventHash
) public onlyMinter {
  require(!isAlreadyMinted(_landSector));
  require(isValidLandSector(_landSector));
  uint16 _landType = getLandType(_landSector);
  require(
    landTypeToLandSectorIndex[_landType] <
      landTypeToSectorSupplyLimit[_landType]
  );
  uint16 rarity = getRarity(_landSector);
  require(
    landTypeAndRarityToLandSectorCount[_landType][rarity] <
      landTypeAndRarityToSectorSupply[_landType][rarity],
    "supply over"
  );
  _mint(_owner, _landSector);
  landTypeToLandSectorList[_landType].push(_landSector);
  landTypeToLandSectorIndex[_landType]++;
  landTypeAndRarityToLandSectorCount[_landType][rarity]++;

  emit MintEvent(_owner, _landSector, block.timestamp, _eventHash);
}

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 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) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

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 {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), 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 {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

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 internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721Enumerable._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  super._transferFrom(from, to, tokenId);

  _removeTokenFromOwnerEnumeration(from, tokenId);

  _addTokenToOwnerEnumeration(to, tokenId);
}

internal ERC721Enumerable._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 {
  super._mint(to, tokenId);

  _addTokenToOwnerEnumeration(to, tokenId);

  _addTokenToAllTokensEnumeration(tokenId);
}

internal ERC721Enumerable._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _burn(address owner, uint256 tokenId) internal {
  super._burn(owner, tokenId);

  _removeTokenFromOwnerEnumeration(owner, tokenId);
  // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
  _ownedTokensIndex[tokenId] = 0;

  _removeTokenFromAllTokensEnumeration(tokenId);
}

internal ERC721Enumerable._tokensOfOwner keyboard_arrow_up

Parameters help

Name Type
owner
address help

Properties

Visibility help internal
Mutability help view
Source Code
function _tokensOfOwner(address owner)
  internal
  view
  returns (uint256[] storage)
{
  return _ownedTokens[owner];
}

internal ERC721Enumerable._addTokenToOwnerEnumeration keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
  _ownedTokensIndex[tokenId] = _ownedTokens[to].length;
  _ownedTokens[to].push(tokenId);
}

internal ERC721Enumerable._addTokenToAllTokensEnumeration keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
  _allTokensIndex[tokenId] = _allTokens.length;
  _allTokens.push(tokenId);
}

internal ERC721Enumerable._removeTokenFromOwnerEnumeration keyboard_arrow_up

Parameters help

Name Type
from
address help
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId)
  private
{
  // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
  // then delete the last slot (swap and pop).

  uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
  uint256 tokenIndex = _ownedTokensIndex[tokenId];

  // When the token to delete is the last token, the swap operation is unnecessary
  if (tokenIndex != lastTokenIndex) {
    uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

    _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
    _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
  }

  // This also deletes the contents at the last position of the array
  _ownedTokens[from].length--;

  // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occcupied by
  // lasTokenId, or just over the end of the array if the token was the last one).
}

internal ERC721Enumerable._removeTokenFromAllTokensEnumeration keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
  // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
  // then delete the last slot (swap and pop).

  uint256 lastTokenIndex = _allTokens.length.sub(1);
  uint256 tokenIndex = _allTokensIndex[tokenId];

  // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
  // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
  // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
  uint256 lastTokenId = _allTokens[lastTokenIndex];

  _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
  _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

  // This also deletes the contents at the last position of the array
  _allTokens.length--;
  _allTokensIndex[tokenId] = 0;
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

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) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

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 {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), 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 {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

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 internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721Metadata._setTokenURI keyboard_arrow_up

internal ERC721Metadata._burn keyboard_arrow_up

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

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) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

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 {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), 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 {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

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 internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

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) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

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 {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), 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 {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

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 internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _supportedInterfaces[interfaceId] = true;
}

internal MinterRole.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _addMinter(msg.sender);
}

internal MinterRole._addMinter keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addMinter(address account) internal {
  _minters.add(account);
  emit MinterAdded(account);
}

internal MinterRole._removeMinter keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _removeMinter(address account) internal {
  _minters.remove(account);
  emit MinterRemoved(account);
}

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) {
  address owner = _tokenOwner[tokenId];
  return owner != address(0);
}

internal ERC721._isApprovedOrOwner keyboard_arrow_up

Parameters help

Name Type
spender
address help
tokenId
uint256 help

Properties

Visibility help internal
Mutability help view
Source Code
function _isApprovedOrOwner(address spender, uint256 tokenId)
  internal
  view
  returns (bool)
{
  address owner = ownerOf(tokenId);
  return (spender == owner ||
    getApproved(tokenId) == spender ||
    isApprovedForAll(owner, spender));
}

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 {
  require(to != address(0));
  require(!_exists(tokenId));

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

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

internal ERC721._burn keyboard_arrow_up

Parameters help

Name Type
owner
address help
tokenId
uint256 help

Properties

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

  _clearApproval(tokenId);

  _ownedTokensCount[owner] = _ownedTokensCount[owner].sub(1);
  _tokenOwner[tokenId] = address(0);

  emit Transfer(owner, address(0), 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 {
  _burn(ownerOf(tokenId), tokenId);
}

internal ERC721._transferFrom 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 _transferFrom(
  address from,
  address to,
  uint256 tokenId
) internal {
  require(ownerOf(tokenId) == from);
  require(to != address(0));

  _clearApproval(tokenId);

  _ownedTokensCount[from] = _ownedTokensCount[from].sub(1);
  _ownedTokensCount[to] = _ownedTokensCount[to].add(1);

  _tokenOwner[tokenId] = to;

  emit Transfer(from, to, tokenId);
}

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 internal
Mutability help transaction
Source Code
function _checkOnERC721Received(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal returns (bool) {
  if (!to.isContract()) {
    return true;
  }

  bytes4 retval = IERC721Receiver(to).onERC721Received(
    msg.sender,
    from,
    tokenId,
    _data
  );
  return (retval == _ERC721_RECEIVED);
}

internal ERC721._clearApproval keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help private
Mutability help transaction
Source Code
function _clearApproval(uint256 tokenId) private {
  if (_tokenApprovals[tokenId] != address(0)) {
    _tokenApprovals[tokenId] = address(0);
  }
}

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 {
  _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 {
  require(interfaceId != 0xffffffff);
  _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 PauserRole.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {
  _addPauser(msg.sender);
}

internal PauserRole._addPauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _addPauser(address account) internal {
  _pausers.add(account);
  emit PauserAdded(account);
}

internal PauserRole._removePauser keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help internal
Mutability help transaction
Source Code
function _removePauser(address account) internal {
  _pausers.remove(account);
  emit PauserRemoved(account);
}