Blockwell

Avastar

About

Stats

Public Functions 46
Event Types 14
Code Size 92,010 bytes

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

AttributionSet Event

Parameters help
generation
Generation help
artist
string help
infoURI
string help

ContractPaused Event

Parameters help

ContractUnpaused Event

Parameters help

ContractUpgrade Event

Parameters help
newContract
address help

MetadataContractAddressSet Event

Parameters help
contractAddress
address help

NewPrime Event

Parameters help
id
uint256 help
serial
uint256 help
generation
Generation help
series
Series help
gender
Gender help
traits
uint256 help

NewReplicant Event

Parameters help
id
uint256 help
serial
uint256 help
generation
Generation help
gender
Gender help
traits
uint256 help

NewTrait Event

Parameters help
id
uint256 help
generation
Generation help
gene
Gene help
rarity
Rarity help
variation
uint8 help
name
string help

TraitAccessApproved Event

Parameters help
handler
address help
primeIds
uint256[] help

TraitArtExtended Event

Parameters help
id
uint256 help

TraitsUsed Event

Parameters help
handler
address help
primeId
uint256 help
used
bool[] help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

MAX_REPLICANTS_PER_GENERATION Constant

uint16 help
25200

MAX_PRIMES_PER_SERIES Constant

uint16 help
5000

MAX_PROMO_PRIMES_PER_GENERATION Constant

uint16 help
200

TOKEN_NAME Constant

string help
Avastar

TOKEN_SYMBOL Constant

string help
AVASTAR

_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

paused Variable

bool help

upgraded Variable

bool help

newContractAddress Variable

address help

replicantCountByGeneration Variable

mapping(uint8 => uint16) help

metadataContractAddress Variable

address help
Internal Variable

avastars Variable

Avastar[] help
Internal Variable

traits Variable

Trait[] help
Internal Variable

primesByGeneration Variable

mapping(uint8 => Prime[]) help
Internal Variable

replicantsByGeneration Variable

mapping(uint8 => Replicant[]) help
Internal Variable

attributionByGeneration Variable

mapping(uint8 => Attribution) help
Internal Variable

traitHandlerByPrimeTokenId Variable

mapping(uint256 => address) help
Internal Variable

isHashUsedByGeneration Variable

mapping(uint8 => mapping(uint256 => bool)) help
Internal Variable

tokenIdByGenerationAndHash Variable

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

primeCountByGenAndSeries Variable

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

tokenIdByGenerationWaveAndSerial Variable

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

traitIdByGenerationGeneAndVariation Variable

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

admins Variable

Roles.Role help
Internal Variable

minters Variable

Roles.Role help
Internal Variable

owners Variable

Roles.Role help
Internal Variable

_tokenOwner Variable

mapping(uint256 => address) help
Internal Variable

_tokenApprovals Variable

mapping(uint256 => address) help
Internal Variable

_ownedTokensCount Variable

mapping(address => Counters.Counter) 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

Functions Expand All Collapse All

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), "ERC721: balance query for the zero address");

  return _ownedTokensCount[owner].current();
}

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), "ERC721: owner query for nonexistent token");

  return owner;
}

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, "");
}

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 {
  //solhint-disable-next-line max-line-length
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721: transfer caller is not owner nor approved"
  );

  _transferFrom(from, to, 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 {
  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"
  );

  _tokenApprovals[tokenId] = to;
  emit Approval(owner, 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), "ERC721: approved query for nonexistent token");

  return _tokenApprovals[tokenId];
}

setApprovalForAll keyboard_arrow_up

Parameters help

Name Type
to
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction

Requirements help

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

  _operatorApprovals[_msgSender()][to] = approved;
  emit ApprovalForAll(_msgSender(), 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];
}

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 {
  require(
    _isApprovedOrOwner(_msgSender(), tokenId),
    "ERC721: transfer caller is not owner nor approved"
  );
  _safeTransferFrom(from, to, tokenId, _data);
}

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

Requirements help

null
Source Code
function tokenURI(uint256 tokenId) external view returns (string memory) {
  require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
  return _tokenURIs[tokenId];
}

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

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),
    "ERC721Enumerable: owner index out of bounds"
  );
  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(),
    "ERC721Enumerable: global index out of bounds"
  );
  return _allTokens[index];
}

upgradeContract keyboard_arrow_up

Parameters help

Name Type
_newAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
function upgradeContract(address _newAddress)
  external
  onlySysAdmin
  whenPaused
  whenNotUpgraded
{
  require(_newAddress != address(0));
  upgraded = true;
  newContractAddress = _newAddress;
  emit ContractUpgrade(_newAddress);
}

addMinter keyboard_arrow_up

Parameters help

Name Type
_minterAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlySysAdmin checks for the following:
Source Code
function addMinter(address _minterAddress) external onlySysAdmin {
  minters.add(_minterAddress);
  require(minters.has(_minterAddress));
}

addOwner keyboard_arrow_up

Parameters help

Name Type
_ownerAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlySysAdmin checks for the following:
Source Code
function addOwner(address _ownerAddress) external onlySysAdmin {
  owners.add(_ownerAddress);
  require(owners.has(_ownerAddress));
}

addSysAdmin keyboard_arrow_up

Parameters help

Name Type
_sysAdminAddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlySysAdmin checks for the following:
Source Code
function addSysAdmin(address _sysAdminAddress) external onlySysAdmin {
  admins.add(_sysAdminAddress);
  require(admins.has(_sysAdminAddress));
}

stripRoles keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOwner checks for the following:
Source Code
function stripRoles(address _address) external onlyOwner {
  require(msg.sender != _address);
  bool stripped = false;
  if (admins.has(_address)) {
    admins.remove(_address);
    stripped = true;
  }
  if (minters.has(_address)) {
    minters.remove(_address);
    stripped = true;
  }
  if (owners.has(_address)) {
    owners.remove(_address);
    stripped = true;
  }
  require(stripped == true);
}

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlySysAdmin checks for the following:
Source Code
function pause() external onlySysAdmin whenNotPaused {
  paused = true;
  emit ContractPaused();
}

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function unpause() external onlySysAdmin whenPaused whenNotUpgraded {
  paused = false;
  emit ContractUnpaused();
}

getTraitIdByGenerationGeneAndVariation keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_gene
Gene help
_variation
uint8 help

Properties

Visibility help public
Mutability help view
Source Code
function getTraitIdByGenerationGeneAndVariation(
  Generation _generation,
  Gene _gene,
  uint8 _variation
) external view returns (uint256 traitId) {
  return
    traitIdByGenerationGeneAndVariation[uint8(_generation)][uint8(_gene)][
      _variation
    ];
}

getTraitInfoById keyboard_arrow_up

Parameters help

Name Type
_traitId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getTraitInfoById(uint256 _traitId)
  external
  view
  returns (
    uint256 id,
    Generation generation,
    Series[] memory series,
    Gender gender,
    Gene gene,
    Rarity rarity,
    uint8 variation,
    string memory name
  )
{
  require(_traitId < traits.length);
  Trait memory trait = traits[_traitId];
  return (
    trait.id,
    trait.generation,
    trait.series,
    trait.gender,
    trait.gene,
    trait.rarity,
    trait.variation,
    trait.name
  );
}

getTraitNameById keyboard_arrow_up

Parameters help

Name Type
_traitId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getTraitNameById(uint256 _traitId)
  external
  view
  returns (string memory name)
{
  require(_traitId < traits.length);
  name = traits[_traitId].name;
}

getTraitArtById keyboard_arrow_up

Parameters help

Name Type
_traitId
uint256 help

Properties

Visibility help public
Mutability help view

Modifiers help

onlySysAdmin checks for the following:
Source Code
function getTraitArtById(uint256 _traitId)
  external
  view
  onlySysAdmin
  returns (string memory art)
{
  require(_traitId < traits.length);
  Trait memory trait = traits[_traitId];
  art = trait.svg;
}

getAttributionByGeneration keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
function getAttributionByGeneration(Generation _generation)
  external
  view
  returns (string memory attribution)
{
  Attribution memory attrib = attributionByGeneration[uint8(_generation)];
  require(bytes(attrib.artist).length > 0);
  attribution = strConcat(attribution, attrib.artist);
  attribution = strConcat(attribution, " (");
  attribution = strConcat(attribution, attrib.infoURI);
  attribution = strConcat(attribution, ")");
}

setAttribution keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_artist
string help
_infoURI
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function setAttribution(
  Generation _generation,
  string calldata _artist,
  string calldata _infoURI
) external onlySysAdmin onlyBeforeProd(_generation) {
  require(bytes(_artist).length > 0 && bytes(_infoURI).length > 0);
  attributionByGeneration[uint8(_generation)] = Attribution(
    _generation,
    _artist,
    _infoURI
  );
  emit AttributionSet(_generation, _artist, _infoURI);
}

createTrait keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_series
Series[] help
_gender
Gender help
_gene
Gene help
_rarity
Rarity help
_variation
uint8 help
_name
string help
_svg
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function createTrait(
  Generation _generation,
  Series[] calldata _series,
  Gender _gender,
  Gene _gene,
  Rarity _rarity,
  uint8 _variation,
  string calldata _name,
  string calldata _svg
)
  external
  onlySysAdmin
  whenNotPaused
  onlyBeforeProd(_generation)
  returns (uint256 traitId)
{
  require(_series.length > 0);
  require(bytes(_name).length > 0);
  require(bytes(_svg).length > 0);

  // Get Trait ID
  traitId = traits.length;

  // Create and store trait
  traits.push(
    Trait(
      traitId,
      _generation,
      _gender,
      _gene,
      _rarity,
      _variation,
      _series,
      _name,
      _svg
    )
  );

  // Create generation/gene/variation to traitId mapping required by assembleArtwork
  traitIdByGenerationGeneAndVariation[uint8(_generation)][uint8(_gene)][
    uint8(_variation)
  ] = traitId;

  // Send the NewTrait event
  emit NewTrait(traitId, _generation, _gene, _rarity, _variation, _name);

  // Return the new Trait ID
  return traitId;
}

extendTraitArt keyboard_arrow_up

Parameters help

Name Type
_traitId
uint256 help
_svg
string help

Properties

Visibility help public
Mutability help transaction
Source Code
function extendTraitArt(uint256 _traitId, string calldata _svg)
  external
  onlySysAdmin
  whenNotPaused
  onlyBeforeProd(traits[_traitId].generation)
{
  require(_traitId < traits.length);
  string memory art = strConcat(traits[_traitId].svg, _svg);
  traits[_traitId].svg = art;
  emit TraitArtExtended(_traitId);
}

getAvastarWaveByTokenId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getAvastarWaveByTokenId(uint256 _tokenId)
  external
  view
  returns (Wave wave)
{
  require(_tokenId < avastars.length);
  wave = avastars[_tokenId].wave;
}

renderAvastar keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function renderAvastar(uint256 _tokenId)
  external
  view
  returns (string memory svg)
{
  require(_tokenId < avastars.length);
  Avastar memory avastar = avastars[_tokenId];
  uint256 traits = (avastar.wave == Wave.PRIME)
    ? primesByGeneration[uint8(avastar.generation)][avastar.serial].traits
    : replicantsByGeneration[uint8(avastar.generation)][avastar.serial].traits;
  svg = assembleArtwork(avastar.generation, traits);
}

getPrimeByGenerationAndSerial keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_serial
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getPrimeByGenerationAndSerial(Generation _generation, uint256 _serial)
  external
  view
  returns (
    uint256 tokenId,
    uint256 serial,
    uint256 traits,
    Generation generation,
    Series series,
    Gender gender,
    uint8 ranking
  )
{
  require(_serial < primesByGeneration[uint8(_generation)].length);
  Prime memory prime = primesByGeneration[uint8(_generation)][_serial];
  return (
    prime.id,
    prime.serial,
    prime.traits,
    prime.generation,
    prime.series,
    prime.gender,
    prime.ranking
  );
}

getPrimeByTokenId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getPrimeByTokenId(uint256 _tokenId)
  external
  view
  returns (
    uint256 tokenId,
    uint256 serial,
    uint256 traits,
    Generation generation,
    Series series,
    Gender gender,
    uint8 ranking
  )
{
  require(_tokenId < avastars.length);
  Avastar memory avastar = avastars[_tokenId];
  require(avastar.wave == Wave.PRIME);
  Prime memory prime = primesByGeneration[uint8(avastar.generation)][
    avastar.serial
  ];
  return (
    prime.id,
    prime.serial,
    prime.traits,
    prime.generation,
    prime.series,
    prime.gender,
    prime.ranking
  );
}

getPrimeReplicationByTokenId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getPrimeReplicationByTokenId(uint256 _tokenId)
  external
  view
  returns (uint256 tokenId, bool[12] memory replicated)
{
  require(_tokenId < avastars.length);
  Avastar memory avastar = avastars[_tokenId];
  require(avastar.wave == Wave.PRIME);
  Prime memory prime = primesByGeneration[uint8(avastar.generation)][
    avastar.serial
  ];
  return (prime.id, prime.replicated);
}

mintPrime keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_traits
uint256 help
_generation
Generation help
_series
Series help
_gender
Gender help
_ranking
uint8 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function mintPrime(
  address _owner,
  uint256 _traits,
  Generation _generation,
  Series _series,
  Gender _gender,
  uint8 _ranking
) external onlyMinter whenNotPaused returns (uint256 tokenId, uint256 serial) {
  require(_owner != address(0));
  require(_traits != 0);
  require(isHashUsedByGeneration[uint8(_generation)][_traits] == false);
  require(_ranking > 0 && _ranking <= 100);
  uint16 count = primeCountByGenAndSeries[uint8(_generation)][uint8(_series)];
  if (_series != Series.PROMO) {
    require(count < MAX_PRIMES_PER_SERIES);
  } else {
    require(count < MAX_PROMO_PRIMES_PER_GENERATION);
  }

  // Get Prime Serial and mint Avastar, getting tokenId
  serial = primesByGeneration[uint8(_generation)].length;
  tokenId = mintAvastar(_owner, serial, _traits, _generation, Wave.PRIME);

  // Create and store Prime struct
  bool[12] memory replicated;
  primesByGeneration[uint8(_generation)].push(
    Prime(
      tokenId,
      serial,
      _traits,
      replicated,
      _generation,
      _series,
      _gender,
      _ranking
    )
  );

  // Increment count for given Generation/Series
  primeCountByGenAndSeries[uint8(_generation)][uint8(_series)]++;

  // Send the NewPrime event
  emit NewPrime(tokenId, serial, _generation, _series, _gender, _traits);

  // Return the tokenId, serial
  return (tokenId, serial);
}

getReplicantByGenerationAndSerial keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_serial
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getReplicantByGenerationAndSerial(
  Generation _generation,
  uint256 _serial
)
  external
  view
  returns (
    uint256 tokenId,
    uint256 serial,
    uint256 traits,
    Generation generation,
    Gender gender,
    uint8 ranking
  )
{
  require(_serial < replicantsByGeneration[uint8(_generation)].length);
  Replicant memory replicant = replicantsByGeneration[uint8(_generation)][
    _serial
  ];
  return (
    replicant.id,
    replicant.serial,
    replicant.traits,
    replicant.generation,
    replicant.gender,
    replicant.ranking
  );
}

getReplicantByTokenId keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
function getReplicantByTokenId(uint256 _tokenId)
  external
  view
  returns (
    uint256 tokenId,
    uint256 serial,
    uint256 traits,
    Generation generation,
    Gender gender,
    uint8 ranking
  )
{
  require(_tokenId < avastars.length);
  Avastar memory avastar = avastars[_tokenId];
  require(avastar.wave == Wave.REPLICANT);
  Replicant memory replicant = replicantsByGeneration[
    uint8(avastar.generation)
  ][avastar.serial];
  return (
    replicant.id,
    replicant.serial,
    replicant.traits,
    replicant.generation,
    replicant.gender,
    replicant.ranking
  );
}

mintReplicant keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_traits
uint256 help
_generation
Generation help
_gender
Gender help
_ranking
uint8 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function mintReplicant(
  address _owner,
  uint256 _traits,
  Generation _generation,
  Gender _gender,
  uint8 _ranking
) external onlyMinter whenNotPaused returns (uint256 tokenId, uint256 serial) {
  require(_traits != 0);
  require(isHashUsedByGeneration[uint8(_generation)][_traits] == false);
  require(_ranking > 0 && _ranking <= 100);
  require(
    replicantCountByGeneration[uint8(_generation)] <
      MAX_REPLICANTS_PER_GENERATION
  );

  // Get Replicant Serial and mint Avastar, getting tokenId
  serial = replicantsByGeneration[uint8(_generation)].length;
  tokenId = mintAvastar(_owner, serial, _traits, _generation, Wave.REPLICANT);

  // Create and store Replicant struct
  replicantsByGeneration[uint8(_generation)].push(
    Replicant(tokenId, serial, _traits, _generation, _gender, _ranking)
  );

  // Increment count for given Generation
  replicantCountByGeneration[uint8(_generation)]++;

  // Send the NewReplicant event
  emit NewReplicant(tokenId, serial, _generation, _gender, _traits);

  // Return the tokenId, serial
  return (tokenId, serial);
}

isAvastarTeleporter keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
function isAvastarTeleporter() external pure returns (bool) {
  return true;
}

setMetadataContractAddress keyboard_arrow_up

Parameters help

Name Type
_address
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
function setMetadataContractAddress(address _address)
  external
  onlySysAdmin
  whenPaused
  whenNotUpgraded
{
  // Cast the candidate contract to the IAvastarMetadata interface
  IAvastarMetadata candidateContract = IAvastarMetadata(_address);

  // Verify that we have the appropriate address
  require(candidateContract.isAvastarMetadata());

  // Set the contract address
  metadataContractAddress = _address;

  // Emit the event
  emit MetadataContractAddressSet(_address);
}

getMetadataContractAddress keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
function getMetadataContractAddress()
  external
  view
  returns (address contractAddress)
{
  return metadataContractAddress;
}

tokenURI keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint help

Properties

Visibility help public
Mutability help view
Source Code
function tokenURI(uint256 _tokenId) external view returns (string memory uri) {
  require(_tokenId < avastars.length);
  return IAvastarMetadata(metadataContractAddress).tokenURI(_tokenId);
}

approveTraitAccess keyboard_arrow_up

Parameters help

Name Type
_handler
address help
_primeIds
uint256[] help

Properties

Visibility help public
Mutability help transaction
Source Code
function approveTraitAccess(address _handler, uint256[] calldata _primeIds)
  external
{
  require(_primeIds.length > 0 && _primeIds.length <= 256);
  uint256 primeId;
  bool approvedAtLeast1 = false;
  for (uint8 i = 0; i < _primeIds.length; i++) {
    primeId = _primeIds[i];
    require(primeId < avastars.length);
    require(msg.sender == super.ownerOf(primeId), "Must be token owner");
    if (traitHandlerByPrimeTokenId[primeId] != _handler) {
      traitHandlerByPrimeTokenId[primeId] = _handler;
      approvedAtLeast1 = true;
    }
  }
  require(approvedAtLeast1, "No unhandled primes specified");

  // Emit the event
  emit TraitAccessApproved(_handler, _primeIds);
}

useTraits keyboard_arrow_up

Parameters help

Name Type
_primeId
uint256 help
_traitFlags
bool[] help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function useTraits(uint256 _primeId, bool[12] calldata _traitFlags) external {
  // Make certain token id is valid
  require(_primeId < avastars.length);

  // Make certain caller is token owner OR approved handler
  require(
    msg.sender == super.ownerOf(_primeId) ||
      msg.sender == traitHandlerByPrimeTokenId[_primeId],
    "Must be token owner or approved handler"
  );

  // Get the Avastar and make sure it's a Prime
  Avastar memory avastar = avastars[_primeId];
  require(avastar.wave == Wave.PRIME);

  // Get the Prime
  Prime storage prime = primesByGeneration[uint8(avastar.generation)][
    avastar.serial
  ];

  // Set the flags.
  bool usedAtLeast1;
  for (uint8 i = 0; i < 12; i++) {
    if (_traitFlags.length > i) {
      if (!prime.replicated[i] && _traitFlags[i]) {
        prime.replicated[i] = true;
        usedAtLeast1 = true;
      }
    } else {
      break;
    }
  }

  // Revert if no flags changed
  require(usedAtLeast1, "No reusable traits specified");

  // Clear trait handler
  traitHandlerByPrimeTokenId[_primeId] = address(0);

  // Emit the TraitsUsed event
  emit TraitsUsed(msg.sender, _primeId, prime.replicated);
}

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 AvastarFactory.mintAvastar keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_serial
uint256 help
_traits
uint256 help
_generation
Generation help
_wave
Wave help

Properties

Visibility help internal
Mutability help transaction

Modifiers help

Source Code
function mintAvastar(
  address _owner,
  uint256 _serial,
  uint256 _traits,
  Generation _generation,
  Wave _wave
) internal whenNotPaused returns (uint256 tokenId) {
  // Mapped Token Id for given generation and serial should always be 0 (uninitialized)
  require(
    tokenIdByGenerationWaveAndSerial[uint8(_generation)][uint8(_wave)][
      _serial
    ] == 0
  );

  // Serial should always be the current length of the primes or replicants array for the given generation
  if (_wave == Wave.PRIME) {
    require(_serial == primesByGeneration[uint8(_generation)].length);
  } else {
    require(_serial == replicantsByGeneration[uint8(_generation)].length);
  }

  // Get Token ID
  tokenId = avastars.length;

  // Create and store Avastar token
  Avastar memory avastar = Avastar(
    tokenId,
    _serial,
    _traits,
    _generation,
    _wave
  );

  // Store the avastar
  avastars.push(avastar);

  // Indicate use of Trait Hash within given generation
  isHashUsedByGeneration[uint8(avastar.generation)][avastar.traits] = true;

  // Store token ID by Generation and Trait Hash
  tokenIdByGenerationAndHash[uint8(avastar.generation)][
    avastar.traits
  ] = avastar.id;

  // Create generation/wave/serial to tokenId mapping
  tokenIdByGenerationWaveAndSerial[uint8(avastar.generation)][
    uint8(avastar.wave)
  ][avastar.serial] = avastar.id;

  // Mint the token
  super._mint(_owner, tokenId);
}

internal TraitFactory.assembleArtwork keyboard_arrow_up

Parameters help

Name Type
_generation
Generation help
_traitHash
uint256 help

Properties

Visibility help internal
Mutability help view

Requirements help

Source Code
function assembleArtwork(Generation _generation, uint256 _traitHash)
  internal
  view
  returns (string memory svg)
{
  require(_traitHash > 0);

    string memory accumulator
   = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="1000px" width="1000px" viewBox="0 0 1000 1000">';
  uint256 slotConst = 256;
  uint256 slotMask = 255;
  uint256 bitMask;
  uint256 slottedValue;
  uint256 slotMultiplier;
  uint256 variation;
  uint256 traitId;
  Trait memory trait;

  // Iterate trait hash by Gene and assemble SVG sandwich
  for (uint8 slot = 0; slot <= uint8(Gene.HAIR_STYLE); slot++) {
    slotMultiplier = uint256(slotConst**slot); // Create slot multiplier
    bitMask = slotMask * slotMultiplier; // Create bit mask for slot
    slottedValue = _traitHash & bitMask; // Extract slotted value from hash
    if (slottedValue > 0) {
      variation = (slot > 0) // Extract variation from slotted value
        ? slottedValue / slotMultiplier
        : slottedValue;
      if (variation > 0) {
        traitId = traitIdByGenerationGeneAndVariation[uint8(_generation)][slot][
          uint8(variation)
        ];
        trait = traits[traitId];
        accumulator = strConcat(accumulator, trait.svg);
      }
    }
  }

  return strConcat(accumulator, "</svg>");
}

internal AvastarBase.uintToStr keyboard_arrow_up

Parameters help

Name Type
_i
uint help

Properties

Visibility help internal
Mutability help pure
Source Code
function uintToStr(uint256 _i) internal pure returns (string memory result) {
  if (_i == 0) {
    return "0";
  }
  uint256 j = _i;
  uint256 len;
  while (j != 0) {
    len++;
    j /= 10;
  }
  bytes memory bstr = new bytes(len);
  uint256 k = len - 1;
  while (_i != 0) {
    bstr[k--] = byte(uint8(48 + (_i % 10)));
    _i /= 10;
  }
  result = string(bstr);
}

internal AvastarBase.strConcat keyboard_arrow_up

Parameters help

Name Type
_a
string help
_b
string help

Properties

Visibility help internal
Mutability help pure
Source Code
function strConcat(string memory _a, string memory _b)
  internal
  pure
  returns (string memory result)
{
  result = string(abi.encodePacked(bytes(_a), bytes(_b)));
}

internal ERC721._safeTransferFrom 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 _safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal {
  _transferFrom(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) {
  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

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 {
  _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 {
  _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 {
  require(to != address(0), "ERC721: mint to the zero address");
  require(!_exists(tokenId), "ERC721: token already minted");

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to].increment();

  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, "ERC721: burn of token that is not own");

  _clearApproval(tokenId);

  _ownedTokensCount[owner].decrement();
  _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,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _clearApproval(tokenId);

  _ownedTokensCount[from].decrement();
  _ownedTokensCount[to].increment();

  _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(
    _msgSender(),
    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 Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

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 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 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 {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _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 occupied by
  // lastTokenId, 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 Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

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 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 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 {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721._safeTransferFrom 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 _safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal {
  _transferFrom(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) {
  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

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 {
  _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 {
  _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 {
  require(to != address(0), "ERC721: mint to the zero address");
  require(!_exists(tokenId), "ERC721: token already minted");

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to].increment();

  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, "ERC721: burn of token that is not own");

  _clearApproval(tokenId);

  _ownedTokensCount[owner].decrement();
  _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,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _clearApproval(tokenId);

  _ownedTokensCount[from].decrement();
  _ownedTokensCount[to].increment();

  _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(
    _msgSender(),
    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 Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

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 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 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 {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721Metadata._setTokenURI keyboard_arrow_up

internal ERC721Metadata._burn keyboard_arrow_up

internal Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

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 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 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 {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}

internal ERC721._safeTransferFrom 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 _safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes memory _data
) internal {
  _transferFrom(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) {
  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

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 {
  _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 {
  _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 {
  require(to != address(0), "ERC721: mint to the zero address");
  require(!_exists(tokenId), "ERC721: token already minted");

  _tokenOwner[tokenId] = to;
  _ownedTokensCount[to].increment();

  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, "ERC721: burn of token that is not own");

  _clearApproval(tokenId);

  _ownedTokensCount[owner].decrement();
  _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,
    "ERC721: transfer of token that is not own"
  );
  require(to != address(0), "ERC721: transfer to the zero address");

  _clearApproval(tokenId);

  _ownedTokensCount[from].decrement();
  _ownedTokensCount[to].increment();

  _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(
    _msgSender(),
    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 Context.constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help internal
Mutability help transaction
Source Code
constructor() internal {}

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 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 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 {
  require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
  _supportedInterfaces[interfaceId] = true;
}